feat(oracle): place database links at sidebar bottom with display toggle

This commit is contained in:
lxk955 authored and GitHub committed 2026-10-04 22:27:09 +08:00
1 parent 1bd9b821d3
commit dee12449d9
21 files changed
+109 -6

No files matched your search

@@ -88,6 +88,7 @@ import { MQ_PINNED_VERSION_OPTIONS, pinnedVersionToSelection, selectionToPinnedV
import { mongodbAuthFailureHint, mongoConnectionUsesOidc, mongoUrlParam, mongoUrlParamIsTrue, normalizeMongoTlsFormState, setMongoUrlParam, setMongoUrlParamBoolean } from "@/lib/mongo/mongoConnectionOptions"; import { mongodbAuthFailureHint, mongoConnectionUsesOidc, mongoUrlParam, mongoUrlParamIsTrue, normalizeMongoTlsFormState, setMongoUrlParam, setMongoUrlParamBoolean } from "@/lib/mongo/mongoConnectionOptions";
import { isMongoLegacyDriverProfile } from "@/lib/mongo/mongoCapabilities"; import { isMongoLegacyDriverProfile } from "@/lib/mongo/mongoCapabilities";
import { mysqlCleartextPasswordAuthEnabled, setMysqlCleartextPasswordAuthEnabled } from "@/lib/database/mysqlConnectionOptions"; import { mysqlCleartextPasswordAuthEnabled, setMysqlCleartextPasswordAuthEnabled } from "@/lib/database/mysqlConnectionOptions";
import { supportsOracleDatabaseLinks } from "@/lib/database/oracleDatabaseLinks";
import { applyDamengSslUrlParams, damengSslFormConfig } from "@/lib/database/damengSslOptions"; 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 { 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"; import { doltSystemTablesVisible, isDoltDriverProfile, setDoltSystemTablesVisible } from "@/lib/database/doltProfile";
@@ -448,6 +449,7 @@ const defaultForm = (): ConnectionForm => ({
docs_notes_path: undefined, docs_notes_path: undefined,
read_only: false, read_only: false,
show_system_schemas: false, show_system_schemas: false,
show_database_links: true,
sidebar_auto_load_all_tables: false, sidebar_auto_load_all_tables: false,
is_production: false, is_production: false,
production_databases: [], production_databases: [],
@@ -3139,6 +3141,7 @@ watch(
docs_notes_path: config.docs_notes_path, docs_notes_path: config.docs_notes_path,
read_only: config.read_only || false, read_only: config.read_only || false,
show_system_schemas: config.show_system_schemas || 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, sidebar_auto_load_all_tables: config.sidebar_auto_load_all_tables === true,
is_production: config.is_production || false, is_production: config.is_production || false,
production_databases: config.production_databases || [], 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; 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_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.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.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; if (config.agent_java_options && config.agent_java_options.length === 0) config.agent_java_options = undefined;
@@ -10271,6 +10275,13 @@ function openExternalUrl(url: string) {
<span class="text-xs text-muted-foreground">{{ t("connection.showSystemSchemasHint") }}</span> <span class="text-xs text-muted-foreground">{{ t("connection.showSystemSchemasHint") }}</span>
</label> </label>
</div> </div>
<div v-if="supportsOracleDatabaseLinks(form.db_type)" class="grid grid-cols-4 items-center gap-4">
<Label :class="connectionLabelSmallClass">{{ t("connection.showDatabaseLinks") }}</Label>
<label class="col-span-3 flex items-center gap-2 cursor-pointer">
<input type="checkbox" v-model="form.show_database_links" class="mr-0" />
<span class="text-xs text-muted-foreground">{{ t("connection.showDatabaseLinksHint") }}</span>
</label>
</div>
<div v-if="supportsAutomaticTableLoading" class="grid grid-cols-4 items-start gap-4"> <div v-if="supportsAutomaticTableLoading" class="grid grid-cols-4 items-start gap-4">
<Label :class="connectionLabelSmallPaddedClass">{{ t("connection.tableLoading") }}</Label> <Label :class="connectionLabelSmallPaddedClass">{{ t("connection.tableLoading") }}</Label>
<div class="col-span-3 grid gap-1.5"> <div class="col-span-3 grid gap-1.5">
+2
View File
@@ -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.", 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", 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.", 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ı", docsNotesPath: "Qeydlər faylı",
docsNotesPathPlaceholder: "docs/dbx-docs.json", 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.", 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.",
+2
View File
@@ -1574,6 +1574,8 @@ export default {
doltShowSystemTablesHint: "Show Dolt's built-in version-control tables in table lists for this connection.", doltShowSystemTablesHint: "Show Dolt's built-in version-control tables in table lists for this connection.",
showSystemSchemas: "Show System Schemas", showSystemSchemas: "Show System Schemas",
showSystemSchemasHint: "Show built-in and metadata schemas in the sidebar and schema pickers for this connection.", 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", tableLoading: "Table loading",
autoLoadAllTables: "Load all tables automatically", 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.", 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.",
+2
View File
@@ -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.", 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", 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.", 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", tableLoading: "Carga de tablas",
autoLoadAllTables: "Cargar todas las tablas automáticamente", 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.", 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.",
+2
View File
@@ -1511,6 +1511,8 @@ export default withEnglishFallback({
doltShowSystemTablesHint: "Tampilkan tabel version-control bawaan Dolt di daftar tabel untuk koneksi ini.", doltShowSystemTablesHint: "Tampilkan tabel version-control bawaan Dolt di daftar tabel untuk koneksi ini.",
showSystemSchemas: "Tampilkan Skema Sistem", showSystemSchemas: "Tampilkan Skema Sistem",
showSystemSchemasHint: "Tampilkan skema bawaan dan metadata di bilah sisi dan pemilih skema untuk koneksi ini.", 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", tableLoading: "Pemuatan tabel",
autoLoadAllTables: "Muat semua tabel secara otomatis", 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.", 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.",
+2
View File
@@ -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.", 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", showSystemSchemas: "Mostra Schema di sistema",
showSystemSchemasHint: "Mostra lo Schema built-in/di metadati nella barra laterale e nel selettore Schema per la connessione corrente.", 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", docsNotesPath: "File delle note",
docsNotesPathPlaceholder: "docs/dbx-docs.json", 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.", 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.",
+2
View File
@@ -1407,6 +1407,8 @@ export default withEnglishFallback({
jdbcMissingRuntimeDependencyHint: "現在のJDBCドライバーには実行依存関係が不足しています。「ドライバー管理」でMaven座標を使用してインストールするか、ドライバーとすべての依存JARを一度にインポートしてください。", jdbcMissingRuntimeDependencyHint: "現在のJDBCドライバーには実行依存関係が不足しています。「ドライバー管理」でMaven座標を使用してインストールするか、ドライバーとすべての依存JARを一度にインポートしてください。",
showSystemSchemas: "システムスキーマを表示", showSystemSchemas: "システムスキーマを表示",
showSystemSchemasHint: "現在の接続で、サイドバーとスキーマセレクターに組み込み/メタデータスキーマを表示します。", showSystemSchemasHint: "現在の接続で、サイドバーとスキーマセレクターに組み込み/メタデータスキーマを表示します。",
showDatabaseLinks: "データベースリンクを表示",
showDatabaseLinksHint: "現在の接続でサイドバーにデータベースリンク(DB Link)のエントリを表示します。",
docsNotesPath: "ノートファイル", docsNotesPath: "ノートファイル",
docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathPlaceholder: "docs/dbx-docs.json",
docsNotesPathHint: "ドキュメントのノートの保存先です。空のままにするとアプリのデータディレクトリに保存されます。リポジトリ内のファイルを指定すると、スキーマのドキュメントをプルリクエストでレビューできます。", docsNotesPathHint: "ドキュメントのノートの保存先です。空のままにするとアプリのデータディレクトリに保存されます。リポジトリ内のファイルを指定すると、スキーマのドキュメントをプルリクエストでレビューできます。",
+2
View File
@@ -1393,6 +1393,8 @@ export default withEnglishFallback({
readOnlyHint: "모든 쓰기 작업 차단 (INSERT, UPDATE, DELETE 등)", readOnlyHint: "모든 쓰기 작업 차단 (INSERT, UPDATE, DELETE 등)",
showSystemSchemas: "시스템 스키마 표시", showSystemSchemas: "시스템 스키마 표시",
showSystemSchemasHint: "이 연결의 사이드바와 스키마 선택기에 내장 및 메타데이터 스키마를 표시합니다.", showSystemSchemasHint: "이 연결의 사이드바와 스키마 선택기에 내장 및 메타데이터 스키마를 표시합니다.",
showDatabaseLinks: "데이터베이스 링크 표시",
showDatabaseLinksHint: "이 연결의 사이드바에 데이터베이스 링크(DB Link) 항목을 표시합니다.",
docsNotesPath: "노트 파일", docsNotesPath: "노트 파일",
docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathPlaceholder: "docs/dbx-docs.json",
docsNotesPathHint: "문서 노트를 저장할 위치입니다. 비워 두면 앱 데이터 디렉터리에 저장되며, 저장소 내 파일을 지정하면 스키마 문서를 풀 리퀘스트에서 검토할 수 있습니다.", docsNotesPathHint: "문서 노트를 저장할 위치입니다. 비워 두면 앱 데이터 디렉터리에 저장되며, 저장소 내 파일을 지정하면 스키마 문서를 풀 리퀘스트에서 검토할 수 있습니다.",
+2
View File
@@ -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.", 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", 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.", 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", docsNotesPath: "Arquivo de notas",
docsNotesPathPlaceholder: "docs/dbx-docs.json", 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.", 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.",
+2
View File
@@ -1485,6 +1485,8 @@ export default withEnglishFallback({
doltShowSystemTablesHint: "Показывать встроенные таблицы контроля версий Dolt в списках таблиц для этого подключения.", doltShowSystemTablesHint: "Показывать встроенные таблицы контроля версий Dolt в списках таблиц для этого подключения.",
showSystemSchemas: "Показывать системные схемы", showSystemSchemas: "Показывать системные схемы",
showSystemSchemasHint: "Показывать встроенные схемы и схемы метаданных на боковой панели и в выборе схем для этого подключения.", showSystemSchemasHint: "Показывать встроенные схемы и схемы метаданных на боковой панели и в выборе схем для этого подключения.",
showDatabaseLinks: "Показывать связи баз данных",
showDatabaseLinksHint: "Показывать раздел связей баз данных (DB Link) на боковой панели для этого подключения.",
docsNotesPath: "Файл заметок", docsNotesPath: "Файл заметок",
docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathPlaceholder: "docs/dbx-docs.json",
docsNotesPathHint: "Где хранятся заметки документации. Оставьте пустым, чтобы хранить их в каталоге данных приложения, или укажите файл в вашем репозитории, чтобы просматривать документацию схемы в pull request.", docsNotesPathHint: "Где хранятся заметки документации. Оставьте пустым, чтобы хранить их в каталоге данных приложения, или укажите файл в вашем репозитории, чтобы просматривать документацию схемы в pull request.",
+2
View File
@@ -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.", 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", 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.", 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ı", docsNotesPath: "Not dosyası",
docsNotesPathPlaceholder: "docs/dbx-docs.json", 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.", 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.",
+2
View File
@@ -1513,6 +1513,8 @@ export default withEnglishFallback({
doltShowSystemTablesHint: "在当前连接的表列表中显示 Dolt 内置的版本控制表。", doltShowSystemTablesHint: "在当前连接的表列表中显示 Dolt 内置的版本控制表。",
showSystemSchemas: "显示系统 Schema", showSystemSchemas: "显示系统 Schema",
showSystemSchemasHint: "为当前连接在侧边栏和 Schema 选择器中显示内置/元数据 Schema。", showSystemSchemasHint: "为当前连接在侧边栏和 Schema 选择器中显示内置/元数据 Schema。",
showDatabaseLinks: "显示数据库链接",
showDatabaseLinksHint: "在侧边栏中显示当前连接的数据库链接(DB Link)入口。",
tableLoading: "表加载策略", tableLoading: "表加载策略",
autoLoadAllTables: "自动加载全部表", autoLoadAllTables: "自动加载全部表",
autoLoadAllTablesHint: "使用侧边栏高级视图时,展开“表”分组会自动加载该连接的全部分页,使表名筛选覆盖所有表。表很多时可能需要更长时间。", autoLoadAllTablesHint: "使用侧边栏高级视图时,展开“表”分组会自动加载该连接的全部分页,使表名筛选覆盖所有表。表很多时可能需要更长时间。",
+2
View File
@@ -1421,6 +1421,8 @@ export default withEnglishFallback({
doltShowSystemTablesHint: "在目前連線的資料表清單中顯示 Dolt 內建的版本控制資料表。", doltShowSystemTablesHint: "在目前連線的資料表清單中顯示 Dolt 內建的版本控制資料表。",
showSystemSchemas: "顯示系統 Schema", showSystemSchemas: "顯示系統 Schema",
showSystemSchemasHint: "為目前連線在側邊欄和 Schema 選擇器中顯示內建/中繼資料 Schema。", showSystemSchemasHint: "為目前連線在側邊欄和 Schema 選擇器中顯示內建/中繼資料 Schema。",
showDatabaseLinks: "顯示資料庫連結",
showDatabaseLinksHint: "在側邊欄中顯示目前連線的資料庫連結(DB Link)入口。",
docsNotesPath: "筆記檔案", docsNotesPath: "筆記檔案",
docsNotesPathPlaceholder: "docs/dbx-docs.json", docsNotesPathPlaceholder: "docs/dbx-docs.json",
docsNotesPathHint: "文件筆記的儲存位置。留空則儲存在應用程式資料目錄中;指向存放庫中的檔案後,即可在 Pull Request 中審閱 Schema 文件。", docsNotesPathHint: "文件筆記的儲存位置。留空則儲存在應用程式資料目錄中;指向存放庫中的檔案後,即可在 Pull Request 中審閱 Schema 文件。",
@@ -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"]);
});
});
@@ -77,6 +77,7 @@ describe("connectionDatabaseInfo", () => {
expect(connectionConfigFingerprint({ ...original, note: "Production reporting" })).toBe(connectionConfigFingerprint(original)); expect(connectionConfigFingerprint({ ...original, note: "Production reporting" })).toBe(connectionConfigFingerprint(original));
expect(connectionConfigFingerprint({ ...original, default_schema: "archive" })).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, 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", () => { it("formats only database metadata for rows and copied text", () => {
@@ -94,7 +94,7 @@ function fnv1a(value: string, seed: number): number {
} }
export function connectionConfigFingerprint(config: ConnectionConfig, sourceName = config.name): string { 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 serialized = JSON.stringify(stableValue({ config: submittedConfig, sourceName }));
const first = fnv1a(serialized, 0x811c9dc5).toString(16).padStart(8, "0"); const first = fnv1a(serialized, 0x811c9dc5).toString(16).padStart(8, "0");
const second = fnv1a(serialized, 0x9e3779b9).toString(16).padStart(8, "0"); const second = fnv1a(serialized, 0x9e3779b9).toString(16).padStart(8, "0");
@@ -48,6 +48,10 @@ export function sortSidebarTreeChildrenByNameKeepingTableVGroups(parent: Pick<Tr
return sortSidebarTreeChildrenForParent(parent, [...groups, ...orderedFlat], databaseType); return sortSidebarTreeChildrenForParent(parent, [...groups, ...orderedFlat], databaseType);
} }
function isBottomConnectionUtilityNode(child: TreeNode): boolean {
return child.type === "oracle-db-links" || child.type === "user-admin" || child.type === "xugu-user-admin" || child.type === "dameng-users" || child.type === "dameng-roles" || child.type === "dameng-job-admin" || child.type === "group-tablespaces";
}
function orderSidebarTreeChildrenForParent(parent: Pick<TreeNode, "type">, children: readonly TreeNode[], databaseType?: DatabaseType): TreeNode[] { function orderSidebarTreeChildrenForParent(parent: Pick<TreeNode, "type">, children: readonly TreeNode[], databaseType?: DatabaseType): TreeNode[] {
const normalized = children.map((child) => sortRecursive(child, databaseType)); const normalized = children.map((child) => sortRecursive(child, databaseType));
@@ -67,9 +71,9 @@ function orderSidebarTreeChildrenForParent(parent: Pick<TreeNode, "type">, child
if (parent.type === "connection") { if (parent.type === "connection") {
const savedSqlNodes = normalized.filter((child) => child.type === "saved-sql-root"); 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 bottomUtilityNodes = normalized.filter(isBottomConnectionUtilityNode);
const regularChildren = normalized.filter((child) => child.type !== "user-admin" && child.type !== "dameng-users" && child.type !== "dameng-roles" && child.type !== "saved-sql-root"); const regularChildren = normalized.filter((child) => child.type !== "saved-sql-root" && !isBottomConnectionUtilityNode(child));
const withConnectionUtilityOrder = (children: TreeNode[]) => [...savedSqlNodes, ...children, ...userAdminNodes]; const withConnectionUtilityOrder = (children: TreeNode[]) => [...savedSqlNodes, ...children, ...bottomUtilityNodes];
if ( if (
databaseType === "mongodb" || databaseType === "mongodb" ||
@@ -820,6 +820,38 @@ describe("connectionStore metadata loading", () => {
expect(schemaNode?.children?.map((node) => [node.type, node.label, node.schema])).toEqual([["table", "sheet", "DBX_TEST"]]); 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([ it.each([
{ mode: "simple", names: [] }, { mode: "simple", names: [] },
{ mode: "grouped", names: [] }, { mode: "grouped", names: [] },
@@ -1725,6 +1725,7 @@ export const useConnectionStore = defineStore("connection", () => {
docs_notes_path: config.docs_notes_path?.trim() ? config.docs_notes_path.trim() : undefined, docs_notes_path: config.docs_notes_path?.trim() ? config.docs_notes_path.trim() : undefined,
transport_layers: Array.isArray(config.transport_layers) ? config.transport_layers : [], transport_layers: Array.isArray(config.transport_layers) ? config.transport_layers : [],
show_system_schemas: config.show_system_schemas === true, 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, 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_secs: connectTimeoutInherit ? settingsStore.editorSettings.globalConnectTimeoutSecs : config.connect_timeout_secs || 10,
connect_timeout_inherit: connectTimeoutInherit, connect_timeout_inherit: connectTimeoutInherit,
@@ -2182,6 +2183,7 @@ export const useConnectionStore = defineStore("connection", () => {
function buildOracleDatabaseLinksNode(connectionId: string, existingConnectionNode?: TreeNode): TreeNode | undefined { function buildOracleDatabaseLinksNode(connectionId: string, existingConnectionNode?: TreeNode): TreeNode | undefined {
const config = getConfig(connectionId); const config = getConfig(connectionId);
if (!supportsOracleDatabaseLinks(effectiveDatabaseTypeForConnection(config))) return undefined; 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"); 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 ?? [] }; 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 ?? [] };
} }
+2
View File
@@ -105,6 +105,8 @@ export interface ConnectionConfig {
visible_database_patterns?: string[]; visible_database_patterns?: string[];
visible_schemas?: Record<string, string[]>; visible_schemas?: Record<string, string[]>;
show_system_schemas?: boolean; 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. */ /** Load every page when the sidebar's Tables group is opened for this connection. */
sidebar_auto_load_all_tables?: boolean; sidebar_auto_load_all_tables?: boolean;
attached_databases?: AttachedDatabaseConfig[]; attached_databases?: AttachedDatabaseConfig[];
+2 -2
View File
@@ -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<TreeNode, "type"> = { type: "connection" }; const parent: Pick<TreeNode, "type"> = { type: "connection" };
const children: TreeNode[] = [ const children: TreeNode[] = [
{ id: "conn:__dameng_roles", label: "tree.damengRoles", type: "dameng-roles" }, { 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]), sorted.map((child) => [child.type, child.label]),
[ [
["database", "b"], ["database", "b"],
["dameng-job-admin", "tree.damengJobAdmin"],
["dameng-roles", "tree.damengRoles"], ["dameng-roles", "tree.damengRoles"],
["dameng-users", "tree.damengUsers"], ["dameng-users", "tree.damengUsers"],
["dameng-job-admin", "tree.damengJobAdmin"],
], ],
); );
}); });