fix(doris): preserve external catalog in object browser

This commit is contained in:
t8y2 committed 2026-07-11 13:34:18 +08:00
1 parent 8d14a056b7
commit a1b8174951
8 files changed
+39 -13

No files matched your search

@@ -12,6 +12,7 @@ import type { TableInfoTab } from "@/types/database";
export type NavigationTarget = {
connectionId: string;
database: string;
catalog?: string;
schema?: string;
tableName: string;
tableType?: string;
@@ -27,7 +28,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
connectionStore.activeConnectionId = target.connectionId;
const config = connectionStore.getConfig(target.connectionId);
const tabTitle = target.schema ? `${target.schema}.${target.tableName}` : target.tableName;
const tabTitle = target.catalog ? `${target.catalog}.${target.schema || target.database}.${target.tableName}` : target.schema ? `${target.schema}.${target.tableName}` : target.tableName;
if (config?.db_type === "qdrant" || config?.db_type === "milvus" || config?.db_type === "weaviate" || config?.db_type === "chromadb") {
await connectionStore.ensureConnected(target.connectionId);
const tabId = queryStore.createTab(target.connectionId, target.database || "default", tabTitle, "vector");
@@ -36,7 +37,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
}
const tabId = (() => {
if (settingsStore.editorSettings.reuseDataTab) {
const existing = queryStore.tabs.find((tab) => tab.mode === "data" && tab.connectionId === target.connectionId && tab.database === target.database);
const existing = queryStore.tabs.find((tab) => tab.mode === "data" && tab.connectionId === target.connectionId && tab.database === target.database && (tab.tableMeta?.catalog || "") === (target.catalog || ""));
if (existing) {
existing.title = tabTitle;
existing.schema = target.schema;
@@ -63,6 +64,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
const sql = await buildTableSelectSql({
databaseType: effectiveDbType,
schema: target.schema,
catalog: target.catalog,
tableName: target.tableName,
tableType: targetTableType,
columns: columns.map((column) => column.name),
@@ -72,6 +74,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
});
queryStore.updateSql(tabId, sql);
queryStore.setTableMeta(tabId, {
catalog: target.catalog,
schema: target.schema,
tableName: target.tableName,
tableType: targetTableType,
@@ -84,6 +87,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
const sql = await buildTableSelectSql({
databaseType: effectiveDbType,
schema: target.schema,
catalog: target.catalog,
tableName: target.tableName,
tableType: targetTableType,
whereInput: target.whereInput,
@@ -92,6 +96,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
queryStore.updateSql(tabId, sql);
queryStore.setTableMeta(tabId, {
schema: target.schema,
catalog: target.catalog,
tableName: target.tableName,
tableType: targetTableType,
columns: [],
@@ -109,6 +114,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
const emptySql = await buildTableSelectSql({
databaseType: effectiveDbType,
schema: target.schema,
catalog: target.catalog,
tableName: target.tableName,
tableType: targetTableType,
whereInput: target.whereInput,
@@ -118,12 +124,13 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
await queryStore.executeTabSql(tabId, emptySql, { pagination: { limit: pageLimit, offset: 0 } });
}
try {
const columns = await api.getColumns(target.connectionId, target.database, querySchema, target.tableName);
const indexes = await api.listIndexes(target.connectionId, target.database, querySchema, target.tableName).catch(() => []);
const columns = await api.getColumns(target.connectionId, target.database, querySchema, target.tableName, target.catalog);
const indexes = await api.listIndexes(target.connectionId, target.database, querySchema, target.tableName, target.catalog).catch(() => []);
const primaryKeys = editableRowIdentifierColumns(effectiveDbType, columns, indexes, targetTableType);
const useRowId = usesSyntheticRowIdKey(effectiveDbType, primaryKeys, targetTableType);
queryStore.setTableMeta(tabId, {
schema: target.schema,
catalog: target.catalog,
tableName: target.tableName,
tableType: targetTableType,
columns,
@@ -133,6 +140,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
const newSql = await buildTableSelectSql({
databaseType: effectiveDbType,
schema: target.schema,
catalog: target.catalog,
tableName: target.tableName,
tableType: targetTableType,
whereInput: target.whereInput,