mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-31 00:22:30 +00:00
feat(objects): show functions and procedures in sidebar tree
Add list_objects support for agent-driven databases (Dameng, Oracle, etc.) and ExternalDriver plugin connections. SQL Server dbo schema now uses listObjects to display grouped object nodes including routines. - Add list_objects RPC to JDBC agent plugin - Add extract_agent and ExternalDriver branches in list_objects_core - Add get_object_source support for agent connections - Click function/procedure nodes to view source via object browser - Fix duplicate tree node IDs when same name exists as view and function
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { TableInfo, TreeNode } from "@/types/database";
|
||||
import type { ObjectInfo, TreeNode } from "@/types/database";
|
||||
import { buildGroupedObjectTreeNodes } from "@/lib/tableTree";
|
||||
|
||||
export const SQLSERVER_DEFAULT_SCHEMA = "dbo";
|
||||
|
||||
@@ -10,20 +11,18 @@ export function buildSqlServerDatabaseTreeNodes(
|
||||
connectionId: string,
|
||||
database: string,
|
||||
schemas: string[],
|
||||
defaultSchemaTables: TableInfo[],
|
||||
defaultSchemaObjects: ObjectInfo[],
|
||||
): TreeNode[] {
|
||||
const databaseNodeId = `${connectionId}:${database}`;
|
||||
const defaultSchema = schemas.find(isDefaultSchema) || SQLSERVER_DEFAULT_SCHEMA;
|
||||
const defaultTableNodes = defaultSchemaTables.map((table) => ({
|
||||
id: `${databaseNodeId}:${defaultSchema}:${table.name}`,
|
||||
label: table.name,
|
||||
type: (table.table_type === "VIEW" ? "view" : "table") as "view" | "table",
|
||||
|
||||
const defaultObjectNodes = buildGroupedObjectTreeNodes({
|
||||
nodeId: databaseNodeId,
|
||||
connectionId,
|
||||
database,
|
||||
schema: defaultSchema,
|
||||
isExpanded: false,
|
||||
children: [],
|
||||
}));
|
||||
objects: defaultSchemaObjects,
|
||||
});
|
||||
|
||||
const schemaNodes = schemas
|
||||
.filter((schema) => !isDefaultSchema(schema))
|
||||
@@ -38,5 +37,5 @@ export function buildSqlServerDatabaseTreeNodes(
|
||||
children: [],
|
||||
}));
|
||||
|
||||
return [...defaultTableNodes, ...schemaNodes];
|
||||
return [...defaultObjectNodes, ...schemaNodes];
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ export function buildGroupedObjectTreeNodes({
|
||||
objectCount: items.length,
|
||||
isExpanded: false,
|
||||
children: items.map((obj) => ({
|
||||
id: `${nodeId}:${obj.name}`,
|
||||
id: `${nodeId}:${def.key}:${obj.name}`,
|
||||
label: obj.name,
|
||||
type: def.childType,
|
||||
connectionId,
|
||||
|
||||
Reference in New Issue
Block a user