feat(xugu): expose object type members in schema tree
This commit is contained in:
1 parent
d7e93453c7
commit
1b37e97486
30 files changed
+1364
-63
No files matched your search
@@ -193,6 +193,7 @@ describe("connectionStore metadata loading", () => {
|
||||
search_in_definitions: false,
|
||||
parent_schema: "app_schema",
|
||||
parent_name: "business_api",
|
||||
parent_type: "package",
|
||||
match_mode: "prefix",
|
||||
});
|
||||
expect(packageNode.isExpanded).toBe(true);
|
||||
|
||||
@@ -110,6 +110,7 @@ import { normalizeRedisDatabaseAliases, redisDatabaseAlias, redisDatabaseLabel }
|
||||
import { appendAgentDriverUpdateHint, hasAgentDriverUpdate, hasInstalledAgentVersion, type AgentDriverInstallState } from "@/lib/connection/agentDriverInstallHint";
|
||||
import { appendConnectionErrorHints } from "@/lib/connection/connectionErrorHints";
|
||||
import { appendVisibleDatabaseSelection } from "@/lib/connection/connectionVisibleDatabases";
|
||||
import { buildXuguTypeMemberNodes, isXuguTypeMemberContainer } from "@/lib/sidebar/xuguTypeMembers";
|
||||
import { filterNacosNamespacesForSidebar, normalizeNacosNamespacesForDisplay } from "@/lib/nacos/nacosNamespaceVisibility";
|
||||
import { buildPackageMemberNodes, markPackageNodesExpandable } from "@/lib/sidebar/packageMembers";
|
||||
import { configuredDatabaseProductName, connectionConfigFingerprint, normalizeDatabaseConnectionInfo } from "@/lib/connection/connectionDatabaseInfo";
|
||||
@@ -1871,7 +1872,8 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
schema: options.effectiveSchema,
|
||||
objects: supplementalObjects,
|
||||
});
|
||||
if (supportsPackageMemberExpansion(effectiveDatabaseTypeForConnection(getConfig(options.connectionId)))) {
|
||||
const databaseType = effectiveDatabaseTypeForConnection(getConfig(options.connectionId));
|
||||
if (supportsPackageMemberExpansion(databaseType)) {
|
||||
supplementalChildren = markPackageNodesExpandable(supplementalChildren);
|
||||
}
|
||||
if (supplementalChildren.length === 0) return;
|
||||
@@ -5608,6 +5610,7 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
search_in_definitions: !!request.search_in_definitions,
|
||||
parent_schema: request.parent_schema ?? "",
|
||||
parent_name: request.parent_name ?? "",
|
||||
parent_type: request.parent_type ?? "",
|
||||
match_mode: request.match_mode ?? "prefix",
|
||||
});
|
||||
}
|
||||
@@ -5621,7 +5624,8 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
|
||||
async function loadPackageMembers(node: TreeNode, options?: LoadTreeOptions): Promise<void> {
|
||||
if (node.type !== "package" || !node.connectionId || !node.database) return;
|
||||
if (!supportsPackageMemberExpansion(effectiveDatabaseTypeForConnection(getConfig(node.connectionId)))) return;
|
||||
const databaseType = effectiveDatabaseTypeForConnection(getConfig(node.connectionId));
|
||||
if (!supportsPackageMemberExpansion(databaseType)) return;
|
||||
const connectionId = node.connectionId;
|
||||
const database = node.database;
|
||||
const schema = node.schema;
|
||||
@@ -5654,6 +5658,7 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
search_in_definitions: false,
|
||||
parent_schema: schema ?? null,
|
||||
parent_name: packageName,
|
||||
...(databaseType === "xugu" ? { parent_type: "package" as const } : {}),
|
||||
match_mode: "prefix",
|
||||
});
|
||||
const targetNode = treeNodeLoadTarget(load);
|
||||
@@ -5671,6 +5676,60 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function loadXuguTypeMembers(node: TreeNode): Promise<void> {
|
||||
if (!isXuguTypeMemberContainer(node, getConfig(node.connectionId || "")?.db_type)) return;
|
||||
const connectionId = node.connectionId;
|
||||
const database = node.database;
|
||||
if (!connectionId || !database) return;
|
||||
if (node.isExpanded) {
|
||||
node.isExpanded = false;
|
||||
if (!sidebarSearchQuery.value) releaseCollapsedTreeNodeChildren(node.id);
|
||||
return;
|
||||
}
|
||||
if (node.children && node.children.length > 0) {
|
||||
node.isExpanded = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const schema = node.schema || "";
|
||||
const parentName = node.objectName || node.label;
|
||||
node.isLoading = true;
|
||||
try {
|
||||
const [attributes, methods] = await Promise.all([
|
||||
completionAssistantSearch({
|
||||
connection_id: connectionId,
|
||||
database,
|
||||
schema,
|
||||
object_kinds: ["column"],
|
||||
mask: "",
|
||||
max_results: 500,
|
||||
global_search: false,
|
||||
parent_schema: schema,
|
||||
parent_name: parentName,
|
||||
parent_type: "type",
|
||||
match_mode: "prefix",
|
||||
}),
|
||||
completionAssistantSearch({
|
||||
connection_id: connectionId,
|
||||
database,
|
||||
schema,
|
||||
object_kinds: ["routine"],
|
||||
mask: "",
|
||||
max_results: 500,
|
||||
global_search: false,
|
||||
parent_schema: schema,
|
||||
parent_name: parentName,
|
||||
parent_type: "type",
|
||||
match_mode: "prefix",
|
||||
}),
|
||||
]);
|
||||
node.children = buildXuguTypeMemberNodes(node, [...attributes.candidates, ...methods.candidates]);
|
||||
node.isExpanded = true;
|
||||
} finally {
|
||||
node.isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
const ORACLE_SYSTEM_COMPLETION_SCHEMAS = new Set(["SYS", "SYSTEM", "SYSMAN", "DBSNMP", "OUTLN", "XDB", "MDSYS", "CTXSYS", "WMSYS"]);
|
||||
const FILTERED_ROUTINE_COMPLETION_DATABASES = new Set<DatabaseType>(["mysql", "postgres", "sqlserver", "oracle"]);
|
||||
|
||||
@@ -7283,6 +7342,7 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
loadTableForLocate,
|
||||
loadObjectGroupChildren,
|
||||
loadPackageMembers,
|
||||
loadXuguTypeMembers,
|
||||
loadMoreObjectGroupChildren,
|
||||
loadAllObjectGroupChildren,
|
||||
loadTableGroups,
|
||||
|
||||
Reference in new issue
Block a user