fix(sidebar): expand grouped table metadata
This commit is contained in:
parent
e7a8ba2a50
commit
2e3e5f0b2f
|
|
@ -320,7 +320,7 @@ async function toggle() {
|
|||
} else if (node.type === "schema" && node.connectionId && node.database && node.schema) {
|
||||
await connectionStore.loadTables(node.connectionId, node.database, node.schema);
|
||||
} else if ((node.type === "table" || node.type === "view") && node.connectionId && node.database) {
|
||||
await connectionStore.loadTableGroups(node.connectionId, node.database, node.label, node.schema);
|
||||
await connectionStore.loadTableGroups(node.connectionId, node.database, node.label, node.schema, node.id);
|
||||
} else if (node.type === "group-columns" && node.connectionId && node.database && node.tableName) {
|
||||
await connectionStore.loadColumns(node.connectionId, node.database, node.tableName, node.schema);
|
||||
} else if (node.type === "group-indexes" && node.connectionId && node.database && node.tableName) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { buildTableTreeNodes, expandCachedObjectBrowserNodes, objectGroupRefreshParentId } from "../../apps/desktop/src/lib/tableTree.ts";
|
||||
import { readFileSync } from "node:fs";
|
||||
import {
|
||||
buildTableTreeNodes,
|
||||
expandCachedObjectBrowserNodes,
|
||||
objectGroupRefreshParentId,
|
||||
} from "../../apps/desktop/src/lib/tableTree.ts";
|
||||
import type { TableInfo } from "../../apps/desktop/src/types/database.ts";
|
||||
|
||||
const treeItemSource = readFileSync("apps/desktop/src/components/sidebar/TreeItem.vue", "utf8");
|
||||
|
||||
function table(name: string, tableType: "TABLE" | "VIEW" = "TABLE"): TableInfo {
|
||||
return { name, table_type: tableType };
|
||||
}
|
||||
|
|
@ -114,3 +121,10 @@ test("resolves grouped object refreshes to the parent schema node", () => {
|
|||
"conn:db:public",
|
||||
);
|
||||
});
|
||||
|
||||
test("table expander loads groups by the actual tree node id", () => {
|
||||
assert.match(
|
||||
treeItemSource,
|
||||
/loadTableGroups\(node\.connectionId,\s*node\.database,\s*node\.label,\s*node\.schema,\s*node\.id\)/,
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue