feat(xugu): mark public synonym scope in sidebar
This commit is contained in:
1 parent
b3fcb3a6f1
commit
0a239bddb2
2 files changed
+11
-1
No files matched your search
@@ -78,6 +78,7 @@ import { focusSidebarRenameInput } from "@/lib/sidebar/sidebarRenameFocus";
|
|||||||
import { ensureSqlExtension, stripSqlExtension } from "@/lib/savedSql/savedSqlFileName";
|
import { ensureSqlExtension, stripSqlExtension } from "@/lib/savedSql/savedSqlFileName";
|
||||||
import { savedSqlErrorMessage } from "@/lib/savedSql/savedSqlErrors";
|
import { savedSqlErrorMessage } from "@/lib/savedSql/savedSqlErrors";
|
||||||
import { useSavedSqlStore } from "@/stores/savedSqlStore";
|
import { useSavedSqlStore } from "@/stores/savedSqlStore";
|
||||||
|
import { isXuguPublicSynonymTreeNode } from "@/lib/sidebar/xuguPublicSynonyms";
|
||||||
// --- Drag and Drop ---
|
// --- Drag and Drop ---
|
||||||
import { useDragSort } from "@/composables/useDragSort";
|
import { useDragSort } from "@/composables/useDragSort";
|
||||||
import { sidebarTreeRuntimeKey } from "@/lib/sidebar/sidebarTreeRuntime";
|
import { sidebarTreeRuntimeKey } from "@/lib/sidebar/sidebarTreeRuntime";
|
||||||
@@ -235,8 +236,11 @@ function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {
|
|||||||
return { icon: Database, colorClass: "text-yellow-500" };
|
return { icon: Database, colorClass: "text-yellow-500" };
|
||||||
case "linked-server-schema":
|
case "linked-server-schema":
|
||||||
return { icon: FolderOpen, colorClass: "text-sky-400" };
|
return { icon: FolderOpen, colorClass: "text-sky-400" };
|
||||||
case "schema":
|
case "schema": {
|
||||||
|
const databaseType = node.connectionId ? effectiveDatabaseTypeForConnection(connectionStore.getConfig(node.connectionId)) : undefined;
|
||||||
|
if (isXuguPublicSynonymTreeNode(databaseType, node.type, node.schema)) return { icon: Link2, colorClass: "text-sky-500" };
|
||||||
return { icon: FolderOpen, colorClass: "text-sky-400" };
|
return { icon: FolderOpen, colorClass: "text-sky-400" };
|
||||||
|
}
|
||||||
case "table":
|
case "table":
|
||||||
return { icon: Table, colorClass: "text-green-500" };
|
return { icon: Table, colorClass: "text-green-500" };
|
||||||
case "view":
|
case "view":
|
||||||
|
|||||||
+6
@@ -3,6 +3,7 @@ import { fileURLToPath } from "node:url";
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
const runtimeSource = readFileSync(fileURLToPath(new URL("../SidebarTreeRuntimeHost.vue", import.meta.url)), "utf8");
|
const runtimeSource = readFileSync(fileURLToPath(new URL("../SidebarTreeRuntimeHost.vue", import.meta.url)), "utf8");
|
||||||
|
const treeItemSource = readFileSync(fileURLToPath(new URL("../TreeItem.vue", import.meta.url)), "utf8");
|
||||||
|
|
||||||
function functionSource(name: string): string {
|
function functionSource(name: string): string {
|
||||||
const start = runtimeSource.indexOf(`function ${name}(`);
|
const start = runtimeSource.indexOf(`function ${name}(`);
|
||||||
@@ -25,4 +26,9 @@ describe("Xugu public synonym actions", () => {
|
|||||||
expect(functionSource("dropSchema")).toContain("isXuguPublicSynonymTreeNode");
|
expect(functionSource("dropSchema")).toContain("isXuguPublicSynonymTreeNode");
|
||||||
expect(functionSource("confirmDropSchema")).toContain("isXuguPublicSynonymTreeNode");
|
expect(functionSource("confirmDropSchema")).toContain("isXuguPublicSynonymTreeNode");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("uses a distinct link icon for the database-global synonym scope", () => {
|
||||||
|
expect(treeItemSource).toContain("isXuguPublicSynonymTreeNode(databaseType, node.type, node.schema)");
|
||||||
|
expect(treeItemSource).toContain('return { icon: Link2, colorClass: "text-sky-500" }');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user