fix(tree): label Xugu table child groups

This commit is contained in:
Elias authored and GitHub committed 2026-07-28 23:22:11 +08:00
1 parent 7f5cb3b0cc
commit 3e26b7769b
3 files changed
+49 -19

No files matched your search

@@ -0,0 +1,16 @@
import { describe, expect, it } from "vitest";
import { isTreeGroupNodeType } from "@/lib/sidebar/treeNodeGroup";
describe("isTreeGroupNodeType", () => {
it("recognizes Xugu table child groups as translated tree groups", () => {
expect(isTreeGroupNodeType("group-constraints")).toBe(true);
expect(isTreeGroupNodeType("group-table-partitions")).toBe(true);
expect(isTreeGroupNodeType("group-table-subpartitions")).toBe(true);
});
it("does not classify Xugu child objects as groups", () => {
expect(isTreeGroupNodeType("constraint")).toBe(false);
expect(isTreeGroupNodeType("partition")).toBe(false);
expect(isTreeGroupNodeType("subpartition")).toBe(false);
});
});
@@ -0,0 +1,25 @@
import type { TreeNodeType } from "@/types/database";
const treeGroupNodeTypes = new Set<TreeNodeType>([
"group-columns",
"group-indexes",
"group-fkeys",
"group-triggers",
"group-constraints",
"group-table-partitions",
"group-table-subpartitions",
"group-tables",
"group-views",
"group-materialized-views",
"group-procedures",
"group-functions",
"group-sequences",
"group-packages",
"group-types",
"group-partitions",
"group-extensions",
]);
export function isTreeGroupNodeType(type: TreeNodeType): boolean {
return treeGroupNodeTypes.has(type);
}