mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-02 02:34:42 +08:00
feat(xugu): mark public synonym scope in sidebar
This commit is contained in:
@@ -78,6 +78,7 @@ import { focusSidebarRenameInput } from "@/lib/sidebar/sidebarRenameFocus";
|
||||
import { ensureSqlExtension, stripSqlExtension } from "@/lib/savedSql/savedSqlFileName";
|
||||
import { savedSqlErrorMessage } from "@/lib/savedSql/savedSqlErrors";
|
||||
import { useSavedSqlStore } from "@/stores/savedSqlStore";
|
||||
import { isXuguPublicSynonymTreeNode } from "@/lib/sidebar/xuguPublicSynonyms";
|
||||
// --- Drag and Drop ---
|
||||
import { useDragSort } from "@/composables/useDragSort";
|
||||
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" };
|
||||
case "linked-server-schema":
|
||||
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" };
|
||||
}
|
||||
case "table":
|
||||
return { icon: Table, colorClass: "text-green-500" };
|
||||
case "view":
|
||||
|
||||
+6
@@ -3,6 +3,7 @@ import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
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 {
|
||||
const start = runtimeSource.indexOf(`function ${name}(`);
|
||||
@@ -25,4 +26,9 @@ describe("Xugu public synonym actions", () => {
|
||||
expect(functionSource("dropSchema")).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