feat(sidebar): copy MySQL object display paths

Closes #5903
This commit is contained in:
t8y2 committed 2026-08-13 14:35:09 +00:00
1 parent 34f6389503
commit 0b530145ba
12 files changed
+176 -6

No files matched your search

@@ -45,6 +45,7 @@ const sourceNodeTypes = new Set<TreeNodeType>(["materialized_view", "procedure",
const savedSqlNodeTypes = new Set<TreeNodeType>(["saved-sql-file"]);
const tableChildGroupNodeTypes = new Set<TreeNodeType>(["group-columns", "group-indexes", "group-fkeys", "group-triggers", "group-constraints", "group-partitions", "group-table-partitions", "group-table-subpartitions"]);
const databaseChildGroupNodeTypes = new Set<TreeNodeType>(["group-tables", "group-views", "group-materialized-views", "group-procedures", "group-functions", "group-triggers", "group-sequences", "group-synonyms", "group-packages", "group-types"]);
const displayPathObjectNodeTypes = new Set<TreeNodeType>(["table", "view", "materialized_view", "procedure", "function", "trigger"]);
export function objectSourceKindForTreeNode(type: TreeNodeType): ObjectSourceKind | null {
if (type === "view") return "VIEW";
@@ -156,3 +157,13 @@ export function copyNameForTreeNode(node: TreeNode): string {
}
return node.label;
}
export function copyDisplayPathForTreeNode(node: TreeNode, connectionName: string): string | null {
const connection = connectionName.trim();
const database = node.database?.trim();
if (!connection || !database) return null;
if (node.type === "database") return `${connection}.${database}`;
if (!displayPathObjectNodeTypes.has(node.type)) return null;
const objectName = (node.objectName || (node.type === "table" ? node.tableName : undefined) || node.label).trim();
return objectName ? `${connection}.${database}.${objectName}` : null;
}