feat(xugu): add visual user and privilege management

This commit is contained in:
Elias authored and GitHub committed 2026-09-29 14:13:38 +08:00
1 parent 4949cce746
commit ad221eeb88
14 files changed
+2500 -3

No files matched your search

@@ -1036,6 +1036,9 @@ async function toggle(requestId = beginNavigationRequest()) {
} else if (node.type === "user-admin" && node.connectionId) {
await connectionStore.ensureConnected(node.connectionId);
queryStore.openUserAdmin(node.connectionId);
} else if (node.type === "xugu-user-admin" && node.connectionId) {
await connectionStore.ensureConnected(node.connectionId);
queryStore.openXuguUserAdmin(node.connectionId);
} else if (node.type === "dameng-users" && node.connectionId) {
await connectionStore.ensureConnected(node.connectionId);
queryStore.openDamengUsers(node.connectionId);
@@ -1844,6 +1847,18 @@ async function openUserAdmin() {
}
}
async function openXuguUserPermissions() {
const node = activeNode.value;
if (!node.connectionId) return;
try {
await connectionStore.ensureConnected(node.connectionId);
connectionStore.activeConnectionId = node.connectionId;
queryStore.openXuguUserAdmin(node.connectionId);
} catch (e: any) {
toast(t("connection.connectFailed", { message: translateBackendError(t, e?.message || String(e)) }), 5000);
}
}
async function openProcessList() {
const node = activeNode.value;
if (!node.connectionId) return;
@@ -6060,6 +6075,11 @@ function buildSpecialSidebarMenu(context: SidebarMenuFactoryContext): boolean {
return true;
}
if (node.type === "xugu-user-admin") {
items.push({ label: t("contextMenu.openXuguUserPermissions"), action: openXuguUserPermissions, icon: ShieldCheck });
return true;
}
if (node.type === "dameng-job-admin") {
items.push({ label: t("contextMenu.openDamengJobAdmin"), action: openDamengJobAdmin, icon: CalendarClock });
return true;
@@ -309,6 +309,8 @@ 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 "xugu-user-admin":
return { icon: ShieldCheck, colorClass: "text-primary" };
case "dameng-users":
return { icon: UsersRound, colorClass: "text-primary" };
case "dameng-roles":
@@ -447,7 +449,7 @@ function displayLabel(node: TreeNode): string {
// Use the canonical key for persisted trees created before this label was
// internationalized; those nodes may still contain the old Chinese text.
if (node.type === "nacos-access-control") return t("nacos.accessControlSidebarLabel");
if (node.type === "user-admin" || node.type === "dameng-users" || node.type === "dameng-roles" || node.type === "dameng-job-admin" || node.type === "meilisearch-system") return t(node.label);
if (node.type === "user-admin" || node.type === "xugu-user-admin" || node.type === "dameng-users" || node.type === "dameng-roles" || node.type === "dameng-job-admin" || node.type === "meilisearch-system") return t(node.label);
if (node.type === "oracle-db-links" || node.type === "linked-server-root") return t(node.label);
if (node.type === "saved-sql-root") return t(node.label);
if (node.type === "mqtt-topic" && node.id.endsWith(":mqtt-topic:__console__")) return t(node.label);