diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue index 4b3a342db5..bc2b4e2fcf 100644 --- a/apps/desktop/src/components/connection/ConnectionDialog.vue +++ b/apps/desktop/src/components/connection/ConnectionDialog.vue @@ -88,6 +88,7 @@ import { MQ_PINNED_VERSION_OPTIONS, pinnedVersionToSelection, selectionToPinnedV import { mongodbAuthFailureHint, mongoConnectionUsesOidc, mongoUrlParam, mongoUrlParamIsTrue, normalizeMongoTlsFormState, setMongoUrlParam, setMongoUrlParamBoolean } from "@/lib/mongo/mongoConnectionOptions"; import { isMongoLegacyDriverProfile } from "@/lib/mongo/mongoCapabilities"; import { mysqlCleartextPasswordAuthEnabled, setMysqlCleartextPasswordAuthEnabled } from "@/lib/database/mysqlConnectionOptions"; +import { supportsOracleDatabaseLinks } from "@/lib/database/oracleDatabaseLinks"; import { applyDamengSslUrlParams, damengSslFormConfig } from "@/lib/database/damengSslOptions"; import { DAMENG_BUILTIN_DRIVER_PROFILE, DAMENG_CUSTOM_DRIVER_PROFILE, DAMENG_DEFAULT_JDBC_DRIVER_CLASS, damengCustomJdbcUrl, damengDriverModeForConfig, defaultDamengJdbcUrl, type DamengDriverMode } from "@/lib/database/damengDriverOptions"; import { doltSystemTablesVisible, isDoltDriverProfile, setDoltSystemTablesVisible } from "@/lib/database/doltProfile"; @@ -448,6 +449,7 @@ const defaultForm = (): ConnectionForm => ({ docs_notes_path: undefined, read_only: false, show_system_schemas: false, + show_database_links: true, sidebar_auto_load_all_tables: false, is_production: false, production_databases: [], @@ -3139,6 +3141,7 @@ watch( docs_notes_path: config.docs_notes_path, read_only: config.read_only || false, show_system_schemas: config.show_system_schemas || false, + show_database_links: config.show_database_links !== false, sidebar_auto_load_all_tables: config.sidebar_auto_load_all_tables === true, is_production: config.is_production || false, production_databases: config.production_databases || [], @@ -5382,6 +5385,7 @@ function connectionConfigForSubmit(id: string, generatedName = "", validatePlugi config.visible_databases = Array.isArray(config.visible_databases) && config.visible_databases.length > 0 ? config.visible_databases : undefined; } if (!config.show_system_schemas) config.show_system_schemas = undefined; + if (config.show_database_links !== false) config.show_database_links = undefined; if (!config.sidebar_auto_load_all_tables) config.sidebar_auto_load_all_tables = undefined; if (config.visible_schemas && Object.keys(config.visible_schemas).length === 0) config.visible_schemas = undefined; if (config.agent_java_options && config.agent_java_options.length === 0) config.agent_java_options = undefined; @@ -10271,6 +10275,13 @@ function openExternalUrl(url: string) { {{ t("connection.showSystemSchemasHint") }} +
+ + +
diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.ts index a15da0debd..1506786f3c 100644 --- a/apps/desktop/src/i18n/locales/az.ts +++ b/apps/desktop/src/i18n/locales/az.ts @@ -1279,6 +1279,8 @@ export default withEnglishFallback({ doltShowSystemTablesHint: "Bu əlaqənin cədvəl siyahılarında Dolt-un daxili versiya idarəetmə cədvəllərini göstər.", showSystemSchemas: "Sistem sxemlərini göstər", showSystemSchemasHint: "Bu əlaqə üçün yan paneldə və sxem seçicilərində daxili və metaməlumat sxemlərini göstər.", + showDatabaseLinks: "Verilənlər bazası keçidlərini göstər", + showDatabaseLinksHint: "Bu əlaqə üçün yan paneldə verilənlər bazası keçidləri (DB Link) bölməsini göstər.", docsNotesPath: "Qeydlər faylı", docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathHint: "Sənədləşdirmə qeydlərinin saxlandığı yer. Onları tətbiqin məlumat qovluğunda saxlamaq üçün boş buraxın və ya dəyişiklik sorğularında sxem sənədlərini nəzərdən keçirmək üçün repozitoriyanızdakı faylı göstərin.", diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts index 1879df72d5..c0a8f51a63 100644 --- a/apps/desktop/src/i18n/locales/en.ts +++ b/apps/desktop/src/i18n/locales/en.ts @@ -1574,6 +1574,8 @@ export default { doltShowSystemTablesHint: "Show Dolt's built-in version-control tables in table lists for this connection.", showSystemSchemas: "Show System Schemas", showSystemSchemasHint: "Show built-in and metadata schemas in the sidebar and schema pickers for this connection.", + showDatabaseLinks: "Show Database Links", + showDatabaseLinksHint: "Show the database links entry in the sidebar for this connection.", tableLoading: "Table loading", autoLoadAllTables: "Load all tables automatically", autoLoadAllTablesHint: "In Advanced sidebar view, opening a Tables group loads every page for this connection so table-name filtering covers all tables. Large schemas may take longer.", diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts index e5956dab98..a8bb0d565d 100644 --- a/apps/desktop/src/i18n/locales/es.ts +++ b/apps/desktop/src/i18n/locales/es.ts @@ -1495,6 +1495,8 @@ export default withEnglishFallback({ jdbcMissingRuntimeDependencyHint: "El controlador JDBC actual carece de dependencias de ejecución. Utilice las coordenadas Maven en 'Administración de controladores' para instalar, o importe el controlador y todos los JAR de dependencia de una vez.", showSystemSchemas: "Mostrar Schema del sistema", showSystemSchemasHint: "Mostrar el Schema integrado/de metadatos para la conexión actual en la barra lateral y el selector de Schema.", + showDatabaseLinks: "Mostrar enlaces de base de datos", + showDatabaseLinksHint: "Mostrar la entrada de enlaces de base de datos (DB Link) en la barra lateral para esta conexión.", tableLoading: "Carga de tablas", autoLoadAllTables: "Cargar todas las tablas automáticamente", autoLoadAllTablesHint: "En la vista avanzada de la barra lateral, abrir un grupo de Tablas carga todas las páginas para esta conexión, de modo que el filtro por nombre de tabla cubra todas las tablas. Los esquemas grandes pueden tardar más.", diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.ts index 0d74ee1a8b..e5c67b16d8 100644 --- a/apps/desktop/src/i18n/locales/id.ts +++ b/apps/desktop/src/i18n/locales/id.ts @@ -1511,6 +1511,8 @@ export default withEnglishFallback({ doltShowSystemTablesHint: "Tampilkan tabel version-control bawaan Dolt di daftar tabel untuk koneksi ini.", showSystemSchemas: "Tampilkan Skema Sistem", showSystemSchemasHint: "Tampilkan skema bawaan dan metadata di bilah sisi dan pemilih skema untuk koneksi ini.", + showDatabaseLinks: "Tampilkan Tautan Basis Data", + showDatabaseLinksHint: "Tampilkan entri tautan basis data (DB Link) di bilah sisi untuk koneksi ini.", tableLoading: "Pemuatan tabel", autoLoadAllTables: "Muat semua tabel secara otomatis", autoLoadAllTablesHint: "Pada tampilan bilah sisi Lanjutan, membuka grup Tables akan memuat setiap halaman untuk koneksi ini sehingga filter nama tabel mencakup semua tabel. Skema besar mungkin memerlukan waktu lebih lama.", diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts index 8bdd7b4bec..2ad8ab7fc7 100644 --- a/apps/desktop/src/i18n/locales/it.ts +++ b/apps/desktop/src/i18n/locales/it.ts @@ -1407,6 +1407,8 @@ export default withEnglishFallback({ jdbcMissingRuntimeDependencyHint: "Il driver JDBC corrente manca di dipendenze runtime. Installare utilizzando le coordinate Maven in 'Gestione driver', o importare il driver e tutti i JAR delle dipendenze in una volta.", showSystemSchemas: "Mostra Schema di sistema", showSystemSchemasHint: "Mostra lo Schema built-in/di metadati nella barra laterale e nel selettore Schema per la connessione corrente.", + showDatabaseLinks: "Mostra collegamenti database", + showDatabaseLinksHint: "Mostra la voce dei collegamenti al database (DB Link) nella barra laterale per questa connessione.", docsNotesPath: "File delle note", docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathHint: "Dove vengono salvate le note della documentazione. Lascia vuoto per tenerle nella directory dati dell'applicazione, oppure indica un file nel tuo repository per revisionare la documentazione dello schema nelle pull request.", diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts index 4ee2843408..b90a1ca911 100644 --- a/apps/desktop/src/i18n/locales/ja.ts +++ b/apps/desktop/src/i18n/locales/ja.ts @@ -1407,6 +1407,8 @@ export default withEnglishFallback({ jdbcMissingRuntimeDependencyHint: "現在のJDBCドライバーには実行依存関係が不足しています。「ドライバー管理」でMaven座標を使用してインストールするか、ドライバーとすべての依存JARを一度にインポートしてください。", showSystemSchemas: "システムスキーマを表示", showSystemSchemasHint: "現在の接続で、サイドバーとスキーマセレクターに組み込み/メタデータスキーマを表示します。", + showDatabaseLinks: "データベースリンクを表示", + showDatabaseLinksHint: "現在の接続でサイドバーにデータベースリンク(DB Link)のエントリを表示します。", docsNotesPath: "ノートファイル", docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathHint: "ドキュメントのノートの保存先です。空のままにするとアプリのデータディレクトリに保存されます。リポジトリ内のファイルを指定すると、スキーマのドキュメントをプルリクエストでレビューできます。", diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts index 5661063624..c8c6608d90 100644 --- a/apps/desktop/src/i18n/locales/ko.ts +++ b/apps/desktop/src/i18n/locales/ko.ts @@ -1393,6 +1393,8 @@ export default withEnglishFallback({ readOnlyHint: "모든 쓰기 작업 차단 (INSERT, UPDATE, DELETE 등)", showSystemSchemas: "시스템 스키마 표시", showSystemSchemasHint: "이 연결의 사이드바와 스키마 선택기에 내장 및 메타데이터 스키마를 표시합니다.", + showDatabaseLinks: "데이터베이스 링크 표시", + showDatabaseLinksHint: "이 연결의 사이드바에 데이터베이스 링크(DB Link) 항목을 표시합니다.", docsNotesPath: "노트 파일", docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathHint: "문서 노트를 저장할 위치입니다. 비워 두면 앱 데이터 디렉터리에 저장되며, 저장소 내 파일을 지정하면 스키마 문서를 풀 리퀘스트에서 검토할 수 있습니다.", diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts index 62ef5876c3..fbea2cb902 100644 --- a/apps/desktop/src/i18n/locales/pt-BR.ts +++ b/apps/desktop/src/i18n/locales/pt-BR.ts @@ -1408,6 +1408,8 @@ export default withEnglishFallback({ jdbcMissingRuntimeDependencyHint: "O driver JDBC atual está sem dependências de execução. Por favor, instale-o usando as coordenadas Maven no 'Gerenciamento de Drivers' ou importe o driver e todos os JARs de dependência de uma só vez.", showSystemSchemas: "Mostrar Schema do sistema", showSystemSchemasHint: "Exibir Schemas de sistema/metadados integrados na barra lateral e no seletor de Schema para a conexão atual.", + showDatabaseLinks: "Mostrar links de banco de dados", + showDatabaseLinksHint: "Exibir a entrada de links de banco de dados (DB Link) na barra lateral para esta conexão.", docsNotesPath: "Arquivo de notas", docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathHint: "Onde as notas da documentação são gravadas. Deixe vazio para mantê-las no diretório de dados do aplicativo, ou aponte para um arquivo do seu repositório para revisar a documentação do schema em pull requests.", diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts index 68b2c51ed8..024ff6af2b 100644 --- a/apps/desktop/src/i18n/locales/ru.ts +++ b/apps/desktop/src/i18n/locales/ru.ts @@ -1485,6 +1485,8 @@ export default withEnglishFallback({ doltShowSystemTablesHint: "Показывать встроенные таблицы контроля версий Dolt в списках таблиц для этого подключения.", showSystemSchemas: "Показывать системные схемы", showSystemSchemasHint: "Показывать встроенные схемы и схемы метаданных на боковой панели и в выборе схем для этого подключения.", + showDatabaseLinks: "Показывать связи баз данных", + showDatabaseLinksHint: "Показывать раздел связей баз данных (DB Link) на боковой панели для этого подключения.", docsNotesPath: "Файл заметок", docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathHint: "Где хранятся заметки документации. Оставьте пустым, чтобы хранить их в каталоге данных приложения, или укажите файл в вашем репозитории, чтобы просматривать документацию схемы в pull request.", diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.ts index 59ded1f80c..4bbda79727 100644 --- a/apps/desktop/src/i18n/locales/tr.ts +++ b/apps/desktop/src/i18n/locales/tr.ts @@ -1279,6 +1279,8 @@ export default withEnglishFallback({ doltShowSystemTablesHint: "Bu bağlantı için Dolt'un yerleşik sürüm denetimi tablolarını tablo listelerinde göster.", showSystemSchemas: "Sistem Şemalarını Göster", showSystemSchemasHint: "Bu bağlantı için yerleşik ve meta veri şemalarını kenar çubuğunda ve şema seçicilerinde göster.", + showDatabaseLinks: "Veritabanı Bağlantılarını Göster", + showDatabaseLinksHint: "Bu bağlantı için kenar çubuğunda veritabanı bağlantıları (DB Link) girişini göster.", docsNotesPath: "Not dosyası", docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathHint: "Dokümantasyon notlarının saklandığı yer. Uygulama veri dizininde tutmak için boş bırakın veya şema dokümantasyonunu pull request'lerde incelemek için deponuzdaki bir dosyayı gösterin.", diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts index 95d1e646cf..97d2729734 100644 --- a/apps/desktop/src/i18n/locales/zh-CN.ts +++ b/apps/desktop/src/i18n/locales/zh-CN.ts @@ -1513,6 +1513,8 @@ export default withEnglishFallback({ doltShowSystemTablesHint: "在当前连接的表列表中显示 Dolt 内置的版本控制表。", showSystemSchemas: "显示系统 Schema", showSystemSchemasHint: "为当前连接在侧边栏和 Schema 选择器中显示内置/元数据 Schema。", + showDatabaseLinks: "显示数据库链接", + showDatabaseLinksHint: "在侧边栏中显示当前连接的数据库链接(DB Link)入口。", tableLoading: "表加载策略", autoLoadAllTables: "自动加载全部表", autoLoadAllTablesHint: "使用侧边栏高级视图时,展开“表”分组会自动加载该连接的全部分页,使表名筛选覆盖所有表。表很多时可能需要更长时间。", diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts index 70df5352dc..ecc437fa26 100644 --- a/apps/desktop/src/i18n/locales/zh-TW.ts +++ b/apps/desktop/src/i18n/locales/zh-TW.ts @@ -1421,6 +1421,8 @@ export default withEnglishFallback({ doltShowSystemTablesHint: "在目前連線的資料表清單中顯示 Dolt 內建的版本控制資料表。", showSystemSchemas: "顯示系統 Schema", showSystemSchemasHint: "為目前連線在側邊欄和 Schema 選擇器中顯示內建/中繼資料 Schema。", + showDatabaseLinks: "顯示資料庫連結", + showDatabaseLinksHint: "在側邊欄中顯示目前連線的資料庫連結(DB Link)入口。", docsNotesPath: "筆記檔案", docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathHint: "文件筆記的儲存位置。留空則儲存在應用程式資料目錄中;指向存放庫中的檔案後,即可在 Pull Request 中審閱 Schema 文件。", diff --git a/apps/desktop/src/lib/__tests__/sidebar/sidebarNodeOrdering.oracle.spec.ts b/apps/desktop/src/lib/__tests__/sidebar/sidebarNodeOrdering.oracle.spec.ts new file mode 100644 index 0000000000..52d2c12397 --- /dev/null +++ b/apps/desktop/src/lib/__tests__/sidebar/sidebarNodeOrdering.oracle.spec.ts @@ -0,0 +1,27 @@ +import { describe, expect, it } from "vitest"; +import { sortSidebarTreeChildrenForParent } from "@/lib/sidebar/sidebarNodeOrdering"; +import type { TreeNode } from "@/types/database"; + +describe("Oracle sidebar ordering", () => { + it("sorts schema nodes alphabetically and places database links at the bottom", () => { + const children: TreeNode[] = [ + { id: "c1:__oracle_db_links", label: "tree.databaseLinks", type: "oracle-db-links", connectionId: "c1" }, + { id: "c1:ZEBRA:ZEBRA", label: "ZEBRA", type: "schema", connectionId: "c1", database: "ZEBRA", schema: "ZEBRA" }, + { id: "c1:ALPHA:ALPHA", label: "ALPHA", type: "schema", connectionId: "c1", database: "ALPHA", schema: "ALPHA" }, + ]; + + const result = sortSidebarTreeChildrenForParent({ type: "connection" }, children, "oracle"); + expect(result.map((node) => node.id)).toEqual(["c1:ALPHA:ALPHA", "c1:ZEBRA:ZEBRA", "c1:__oracle_db_links"]); + }); + + it("places saved queries at the top, schemas in the middle, and database links at the bottom", () => { + const children: TreeNode[] = [ + { id: "c1:__oracle_db_links", label: "tree.databaseLinks", type: "oracle-db-links", connectionId: "c1" }, + { id: "c1:MY_SCHEMA:MY_SCHEMA", label: "MY_SCHEMA", type: "schema", connectionId: "c1", database: "MY_SCHEMA", schema: "MY_SCHEMA" }, + { id: "c1:__queries", label: "tree.queries", type: "saved-sql-root", connectionId: "c1" }, + ]; + + const result = sortSidebarTreeChildrenForParent({ type: "connection" }, children, "oracle"); + expect(result.map((node) => node.id)).toEqual(["c1:__queries", "c1:MY_SCHEMA:MY_SCHEMA", "c1:__oracle_db_links"]); + }); +}); diff --git a/apps/desktop/src/lib/connection/__tests__/connectionDatabaseInfo.spec.ts b/apps/desktop/src/lib/connection/__tests__/connectionDatabaseInfo.spec.ts index 0e4c373d35..a70b1f7cea 100644 --- a/apps/desktop/src/lib/connection/__tests__/connectionDatabaseInfo.spec.ts +++ b/apps/desktop/src/lib/connection/__tests__/connectionDatabaseInfo.spec.ts @@ -77,6 +77,7 @@ describe("connectionDatabaseInfo", () => { expect(connectionConfigFingerprint({ ...original, note: "Production reporting" })).toBe(connectionConfigFingerprint(original)); expect(connectionConfigFingerprint({ ...original, default_schema: "archive" })).toBe(connectionConfigFingerprint(original)); expect(connectionConfigFingerprint({ ...original, sidebar_auto_load_all_tables: true })).toBe(connectionConfigFingerprint(original)); + expect(connectionConfigFingerprint({ ...original, show_database_links: false })).toBe(connectionConfigFingerprint(original)); }); it("formats only database metadata for rows and copied text", () => { diff --git a/apps/desktop/src/lib/connection/connectionDatabaseInfo.ts b/apps/desktop/src/lib/connection/connectionDatabaseInfo.ts index 7718347811..65a65f75ac 100644 --- a/apps/desktop/src/lib/connection/connectionDatabaseInfo.ts +++ b/apps/desktop/src/lib/connection/connectionDatabaseInfo.ts @@ -94,7 +94,7 @@ function fnv1a(value: string, seed: number): number { } export function connectionConfigFingerprint(config: ConnectionConfig, sourceName = config.name): string { - const { database_info: _databaseInfo, default_schema: _defaultSchema, note: _note, sidebar_auto_load_all_tables: _sidebarAutoLoadAllTables, ...submittedConfig } = config; + const { database_info: _databaseInfo, default_schema: _defaultSchema, note: _note, show_database_links: _showDatabaseLinks, sidebar_auto_load_all_tables: _sidebarAutoLoadAllTables, ...submittedConfig } = config; const serialized = JSON.stringify(stableValue({ config: submittedConfig, sourceName })); const first = fnv1a(serialized, 0x811c9dc5).toString(16).padStart(8, "0"); const second = fnv1a(serialized, 0x9e3779b9).toString(16).padStart(8, "0"); diff --git a/apps/desktop/src/lib/sidebar/sidebarNodeOrdering.ts b/apps/desktop/src/lib/sidebar/sidebarNodeOrdering.ts index 912c1e42c6..cbc1191210 100644 --- a/apps/desktop/src/lib/sidebar/sidebarNodeOrdering.ts +++ b/apps/desktop/src/lib/sidebar/sidebarNodeOrdering.ts @@ -48,6 +48,10 @@ export function sortSidebarTreeChildrenByNameKeepingTableVGroups(parent: Pick, children: readonly TreeNode[], databaseType?: DatabaseType): TreeNode[] { const normalized = children.map((child) => sortRecursive(child, databaseType)); @@ -67,9 +71,9 @@ function orderSidebarTreeChildrenForParent(parent: Pick, child if (parent.type === "connection") { const savedSqlNodes = normalized.filter((child) => child.type === "saved-sql-root"); - const userAdminNodes = normalized.filter((child) => child.type === "user-admin" || child.type === "dameng-users" || child.type === "dameng-roles"); - const regularChildren = normalized.filter((child) => child.type !== "user-admin" && child.type !== "dameng-users" && child.type !== "dameng-roles" && child.type !== "saved-sql-root"); - const withConnectionUtilityOrder = (children: TreeNode[]) => [...savedSqlNodes, ...children, ...userAdminNodes]; + const bottomUtilityNodes = normalized.filter(isBottomConnectionUtilityNode); + const regularChildren = normalized.filter((child) => child.type !== "saved-sql-root" && !isBottomConnectionUtilityNode(child)); + const withConnectionUtilityOrder = (children: TreeNode[]) => [...savedSqlNodes, ...children, ...bottomUtilityNodes]; if ( databaseType === "mongodb" || diff --git a/apps/desktop/src/stores/__tests__/connectionStore.metadataLoading.spec.ts b/apps/desktop/src/stores/__tests__/connectionStore.metadataLoading.spec.ts index 03b7a33701..97cadf5528 100644 --- a/apps/desktop/src/stores/__tests__/connectionStore.metadataLoading.spec.ts +++ b/apps/desktop/src/stores/__tests__/connectionStore.metadataLoading.spec.ts @@ -820,6 +820,38 @@ describe("connectionStore metadata loading", () => { expect(schemaNode?.children?.map((node) => [node.type, node.label, node.schema])).toEqual([["table", "sheet", "DBX_TEST"]]); }); + it("omits oracle-db-links when show_database_links is configured as false", async () => { + vi.resetModules(); + const listDatabases = vi.fn().mockResolvedValue([]); + const listSchemas = vi.fn().mockResolvedValue(["DBX_TEST"]); + + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ + checkConnectionHealth: vi.fn().mockResolvedValue(undefined), + deleteSchemaCachePrefix: vi.fn().mockResolvedValue(undefined), + listDatabases, + listObjects: vi.fn().mockResolvedValue([]), + listSchemas, + listTables: vi.fn().mockResolvedValue([]), + loadSchemaCache: vi.fn().mockResolvedValue(null), + saveSchemaCache: vi.fn().mockResolvedValue(undefined), + saveConnections: vi.fn().mockResolvedValue(undefined), + saveSidebarLayout: vi.fn().mockResolvedValue(undefined), + })); + + const { useConnectionStore } = await import("@/stores/connectionStore"); + const store = useConnectionStore(); + const connection = { ...oracleJdbcConnection(), show_database_links: false }; + const connectionNode: TreeNode = { id: connection.id, label: connection.name, type: "connection", connectionId: connection.id, isExpanded: false, children: [] }; + store.connections = [connection]; + store.connectedIds.add(connection.id); + store.treeNodes = [connectionNode]; + + await store.loadDatabases(connection.id, { force: true }); + + expect(connectionNode.children?.map((node) => [node.type, node.label])).toEqual([["schema", "DBX_TEST"]]); + }); + it.each([ { mode: "simple", names: [] }, { mode: "grouped", names: [] }, diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.ts index 3b14a80ba5..7b6c224349 100644 --- a/apps/desktop/src/stores/connectionStore.ts +++ b/apps/desktop/src/stores/connectionStore.ts @@ -1725,6 +1725,7 @@ export const useConnectionStore = defineStore("connection", () => { docs_notes_path: config.docs_notes_path?.trim() ? config.docs_notes_path.trim() : undefined, transport_layers: Array.isArray(config.transport_layers) ? config.transport_layers : [], show_system_schemas: config.show_system_schemas === true, + show_database_links: config.show_database_links !== false, sidebar_auto_load_all_tables: config.sidebar_auto_load_all_tables === true, connect_timeout_secs: connectTimeoutInherit ? settingsStore.editorSettings.globalConnectTimeoutSecs : config.connect_timeout_secs || 10, connect_timeout_inherit: connectTimeoutInherit, @@ -2182,6 +2183,7 @@ export const useConnectionStore = defineStore("connection", () => { function buildOracleDatabaseLinksNode(connectionId: string, existingConnectionNode?: TreeNode): TreeNode | undefined { const config = getConfig(connectionId); if (!supportsOracleDatabaseLinks(effectiveDatabaseTypeForConnection(config))) return undefined; + if (config?.show_database_links === false) return undefined; const existing = existingConnectionNode?.children?.find((child) => child.type === "oracle-db-links"); return { ...existing, id: `${connectionId}:__oracle_db_links`, label: "tree.databaseLinks", type: "oracle-db-links", connectionId, database: config?.database || "", isExpanded: existing?.isExpanded ?? false, children: existing?.children ?? [] }; } diff --git a/apps/desktop/src/types/database.ts b/apps/desktop/src/types/database.ts index 707a4b5f92..4ad80df760 100644 --- a/apps/desktop/src/types/database.ts +++ b/apps/desktop/src/types/database.ts @@ -105,6 +105,8 @@ export interface ConnectionConfig { visible_database_patterns?: string[]; visible_schemas?: Record; show_system_schemas?: boolean; + /** Whether to show Oracle / OceanBase-Oracle database links node in the sidebar tree. Defaults to true. */ + show_database_links?: boolean; /** Load every page when the sidebar's Tables group is opened for this connection. */ sidebar_auto_load_all_tables?: boolean; attached_databases?: AttachedDatabaseConfig[]; diff --git a/packages/app-tests/sidebarNodeOrdering.test.ts b/packages/app-tests/sidebarNodeOrdering.test.ts index 105bda2f00..f4408c2d67 100644 --- a/packages/app-tests/sidebarNodeOrdering.test.ts +++ b/packages/app-tests/sidebarNodeOrdering.test.ts @@ -103,7 +103,7 @@ test("keeps connection utility nodes in fixed positions", () => { ); }); -test("dameng user/role admin nodes sort after regular children", () => { +test("dameng utility nodes sort after regular children", () => { const parent: Pick = { type: "connection" }; const children: TreeNode[] = [ { id: "conn:__dameng_roles", label: "tree.damengRoles", type: "dameng-roles" }, @@ -118,9 +118,9 @@ test("dameng user/role admin nodes sort after regular children", () => { sorted.map((child) => [child.type, child.label]), [ ["database", "b"], - ["dameng-job-admin", "tree.damengJobAdmin"], ["dameng-roles", "tree.damengRoles"], ["dameng-users", "tree.damengUsers"], + ["dameng-job-admin", "tree.damengJobAdmin"], ], ); });