feat(dameng): add user and role administration
This commit is contained in:
1 parent
9bacb752e4
commit
ec4f8582e6
25 files changed
+3435
-4
No files matched your search
@@ -45,6 +45,7 @@ import {
|
||||
ListFilter,
|
||||
Clipboard,
|
||||
UsersRound,
|
||||
ShieldCheck,
|
||||
Activity,
|
||||
Gauge,
|
||||
CalendarClock,
|
||||
@@ -725,6 +726,12 @@ async function toggle() {
|
||||
} else if (node.type === "user-admin" && node.connectionId) {
|
||||
await connectionStore.ensureConnected(node.connectionId);
|
||||
queryStore.openUserAdmin(node.connectionId);
|
||||
} else if (node.type === "dameng-users" && node.connectionId) {
|
||||
await connectionStore.ensureConnected(node.connectionId);
|
||||
queryStore.openDamengUsers(node.connectionId);
|
||||
} else if (node.type === "dameng-roles" && node.connectionId) {
|
||||
await connectionStore.ensureConnected(node.connectionId);
|
||||
queryStore.openDamengRoles(node.connectionId);
|
||||
} else if (node.type === "dameng-job-admin" && node.connectionId) {
|
||||
await connectionStore.ensureConnected(node.connectionId);
|
||||
queryStore.openDamengJobAdmin(node.connectionId);
|
||||
@@ -1301,6 +1308,30 @@ async function openServerDashboard() {
|
||||
}
|
||||
}
|
||||
|
||||
async function openDamengUsers() {
|
||||
const node = activeNode.value;
|
||||
if (!node.connectionId) return;
|
||||
try {
|
||||
await connectionStore.ensureConnected(node.connectionId);
|
||||
connectionStore.activeConnectionId = node.connectionId;
|
||||
queryStore.openDamengUsers(node.connectionId);
|
||||
} catch (e: any) {
|
||||
toast(t("connection.connectFailed", { message: translateBackendError(t, e) }), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
async function openDamengRoles() {
|
||||
const node = activeNode.value;
|
||||
if (!node.connectionId) return;
|
||||
try {
|
||||
await connectionStore.ensureConnected(node.connectionId);
|
||||
connectionStore.activeConnectionId = node.connectionId;
|
||||
queryStore.openDamengRoles(node.connectionId);
|
||||
} catch (e: any) {
|
||||
toast(t("connection.connectFailed", { message: translateBackendError(t, e) }), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
async function openDamengJobAdmin() {
|
||||
const node = activeNode.value;
|
||||
if (!node.connectionId) return;
|
||||
@@ -4148,6 +4179,8 @@ function buildConnectionSidebarMenu(context: SidebarMenuFactoryContext): boolean
|
||||
items.push({ label: t("contextMenu.serverDashboard"), action: openServerDashboard, icon: Gauge });
|
||||
}
|
||||
if (currentDatabaseType() === "dameng") {
|
||||
items.push({ label: t("contextMenu.damengUsers"), action: openDamengUsers, icon: UsersRound });
|
||||
items.push({ label: t("contextMenu.damengRoles"), action: openDamengRoles, icon: ShieldCheck });
|
||||
items.push({ label: t("contextMenu.damengJobAdmin"), action: openDamengJobAdmin, icon: CalendarClock });
|
||||
}
|
||||
if (canCopyFinalProxyPort.value) {
|
||||
|
||||
@@ -255,6 +255,10 @@ function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {
|
||||
return { icon: TableProperties, colorClass: "text-primary" };
|
||||
case "user-admin":
|
||||
return { icon: UsersRound, colorClass: "text-primary" };
|
||||
case "dameng-users":
|
||||
return { icon: UsersRound, colorClass: "text-primary" };
|
||||
case "dameng-roles":
|
||||
return { icon: ShieldCheck, colorClass: "text-primary" };
|
||||
case "dameng-job-admin":
|
||||
return { icon: CalendarClock, colorClass: "text-primary" };
|
||||
case "index":
|
||||
@@ -349,7 +353,7 @@ function isGroupLabel(node: TreeNode): boolean {
|
||||
function displayLabel(node: TreeNode): string {
|
||||
if (node.type === "load-more") return t(node.label);
|
||||
if (node.type === "object-browser") return t(node.label, { count: node.objectCount ?? 0 });
|
||||
if (node.type === "user-admin" || node.type === "dameng-job-admin") return t(node.label);
|
||||
if (node.type === "user-admin" || node.type === "dameng-users" || node.type === "dameng-roles" || node.type === "dameng-job-admin") return t(node.label);
|
||||
if (node.type === "linked-server-root") return t(node.label);
|
||||
if (node.type === "mqtt-topic" && node.id.endsWith(":mqtt-topic:__console__")) return t(node.label);
|
||||
if (node.label === "tree.defaultDatabase") return t(node.label);
|
||||
|
||||
Reference in new issue
Block a user