Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

Feature:支持模式选择搜索

zipg5e8af8df2ea0
diff --git a/apps/desktop/src/components/layout/EditorToolbar.vue b/apps/desktop/src/components/layout/EditorToolbar.vue
index 5e8c3282cd..3ee3d38c2b 100644
--- a/apps/desktop/src/components/layout/EditorToolbar.vue
+++ b/apps/desktop/src/components/layout/EditorToolbar.vue
@@ -3,7 +3,6 @@ import { computed, ref, watch, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
import { Play, Loader2, Square, Database, Check, Table2, AlignLeft, GitBranch, Save, FolderOpen, Layers, X, Shield, Upload } from "@lucide/vue";
import { Button } from "@/components/ui/button";
-import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { SearchableSelect } from "@/components/ui/searchable-select";
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
import TruncatedTextTooltip from "@/components/ui/TruncatedTextTooltip.vue";
@@ -312,27 +311,30 @@ function connectionById(connectionId: string): ConnectionConfig | undefined {
</Button>
</div>
<div v-if="showSchemaSelector" class="flex items-center gap-1">
- <Layers class="h-3.5 w-3.5 shrink-0" />
- <Select
+ <SearchableSelect
:model-value="activeSchemaValue"
- @update:model-value="(v: any) => emit('changeSchema', v || undefined)"
+ :options="activeSchemaOptions.length ? activeSchemaOptions : activeSchemaValue ? [activeSchemaValue] : []"
+ :placeholder="t('editor.selectSchema')"
+ :search-placeholder="t('editor.searchSchema')"
+ :empty-text="t('grid.noSearchResults')"
+ :loading-text="t('common.loading')"
+ :loading="!!activeConnection && isLoadingSchemas(activeConnection.id, schemaDatabaseKey)"
+ trigger-class="gap-1.5"
+ @update:model-value="(schema) => emit('changeSchema', schema || undefined)"
@update:open="
(open: boolean) => {
if (open && activeConnection) loadSchemaOptions(activeConnection.id, schemaDatabaseKey).catch(() => {});
}
"
>
- <SelectTrigger class="h-6 w-auto max-w-56 border-0 bg-transparent px-1 text-xs shadow-none focus:ring-0">
- <SelectValue :placeholder="activeConnection && isLoadingSchemas(activeConnection.id, schemaDatabaseKey) ? t('common.loading') : t('editor.selectSchema')">
- {{ activeSchemaValue || t("editor.selectSchema") }}
- </SelectValue>
- </SelectTrigger>
- <SelectContent position="popper">
- <SelectItem v-for="schema in activeSchemaOptions" :key="schema" :value="schema">
- {{ schema }}
- </SelectItem>
- </SelectContent>
- </Select>
+ <template #trigger-label="{ label, loading }">
+ <Layers class="h-3.5 w-3.5 shrink-0" />
+ <span class="truncate">{{ loading ? t("common.loading") : label }}</span>
+ </template>
+ <template #option-label="{ label }">
+ <TruncatedTextTooltip :text="label" class="min-w-0 flex-1" side="left" :side-offset="8" />
+ </template>
+ </SearchableSelect>
</div>
</div>
<div v-if="activeTab.mode === 'data' && activeTab.tableMeta" class="ml-2 inline-flex shrink-0 items-center gap-1 rounded border border-border bg-muted/30 px-2 py-0.5 font-medium text-muted-foreground tabular-nums">
diff --git a/apps/desktop/src/components/objects/ObjectBrowser.vue b/apps/desktop/src/components/objects/ObjectBrowser.vue
index e83753b668..ec5995564b 100644
--- a/apps/desktop/src/components/objects/ObjectBrowser.vue
+++ b/apps/desktop/src/components/objects/ObjectBrowser.vue
@@ -41,7 +41,7 @@ import {
import { useI18n } from "vue-i18n";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
-import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
+import { SearchableSelect } from "@/components/ui/searchable-select";
import CustomContextMenu, { type ContextMenuItem } from "@/components/ui/CustomContextMenu.vue";
import DangerConfirmDialog from "@/components/editor/DangerConfirmDialog.vue";
import ProcedureExecutionDialog from "@/components/objects/ProcedureExecutionDialog.vue";
@@ -1540,14 +1540,21 @@ function getObjectBrowserMenuItems(item: ObjectBrowserRow): ContextMenuItem[] {
</button>
</div>
</div>
- <Select v-if="needsSchema" :model-value="selectedSchema" :disabled="loadingSchemas" @update:model-value="onSchemaChange">
- <SelectTrigger class="h-7 w-36 text-xs">
- <SelectValue :placeholder="loadingSchemas ? t('objects.loadingSchemas') : t('objects.schema')" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem v-for="schema in schemas" :key="schema" :value="schema">{{ schema }}</SelectItem>
- </SelectContent>
- </Select>
+ <SearchableSelect
+ v-if="needsSchema"
+ :model-value="selectedSchema || ''"
+ :options="schemas"
+ :placeholder="t('objects.schema')"
+ :search-placeholder="t('editor.searchSchema')"
+ :empty-text="t('grid.noSearchResults')"
+ :loading-text="t('objects.loadingSchemas')"
+ :loading="loadingSchemas"
+ :disabled="loadingSchemas"
+ trigger-variant="outline"
+ trigger-class="h-7 w-36 max-w-36 px-2 text-xs font-normal"
+ content-class="w-56"
+ @update:model-value="onSchemaChange"
+ />
<Button variant="ghost" size="icon" class="h-7 w-7" :disabled="loadingObjects" @click="reload">
<RefreshCw class="h-3.5 w-3.5" :class="{ 'animate-spin': loadingObjects }" />
</Button>
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 83d39e1458..95b40e5afa 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -404,6 +404,7 @@ export default {
selectDatabaseRequired: "Select a database first",
searchDatabase: "Search databases...",
selectSchema: "Select schema",
+ searchSchema: "Search schemas...",
setDefaultDatabase: "Set Default",
defaultDatabase: "Default",
clearDatabase: "Clear database",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index db50a400c6..72a1bd5f65 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -401,6 +401,7 @@ export default withEnglishFallback({
selectDatabaseRequired: "Selecciona una base de datos primero",
searchDatabase: "Buscar bases de datos...",
selectSchema: "Seleccionar esquema",
+ searchSchema: "Buscar esquemas...",
setDefaultDatabase: "Establecer como predeterminada",
defaultDatabase: "Predeterminada",
clearDatabase: "Limpiar base de datos",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index ad76ea7596..341040abbd 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -405,6 +405,7 @@ export default withEnglishFallback({
selectDatabaseRequired: "Seleziona prima un database",
searchDatabase: "Cerca database...",
selectSchema: "Seleziona schema",
+ searchSchema: "Cerca schemi...",
setDefaultDatabase: "Imposta Predefinito",
defaultDatabase: "Predefinito",
clearDatabase: "Cancella database",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 4091d7b50a..19c8a5e5e0 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -399,6 +399,7 @@ export default withEnglishFallback({
selectDatabase: "データベースを選択",
searchDatabase: "データベースを検索...",
selectSchema: "スキーマを選択",
+ searchSchema: "スキーマを検索...",
setDefaultDatabase: "デフォルトに設定",
defaultDatabase: "デフォルト",
clearDatabase: "データベースをクリア",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index d9c503aadd..faec4df69c 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -413,6 +413,7 @@ export default withEnglishFallback({
selectDatabaseRequired: "Selecione um banco de dados primeiro",
searchDatabase: "Pesquisar bancos de dados...",
selectSchema: "Selecionar schema",
+ searchSchema: "Pesquisar schemas...",
setDefaultDatabase: "Definir Padrão",
defaultDatabase: "Padrão",
clearDatabase: "Limpar banco de dados",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index 768984acd8..94bac0984c 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -407,6 +407,7 @@ export default withEnglishFallback({
selectDatabaseRequired: "请先选择数据库",
searchDatabase: "搜索数据库...",
selectSchema: "选择模式",
+ searchSchema: "搜索模式...",
setDefaultDatabase: "设为默认",
defaultDatabase: "默认库",
clearDatabase: "清除数据库选择",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 7a5295b8d4..23272542db 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -401,6 +401,7 @@ export default withEnglishFallback({
selectDatabaseRequired: "請先選擇資料庫",
searchDatabase: "搜尋資料庫……",
selectSchema: "選擇 Schema",
+ searchSchema: "搜尋 Schema...",
setDefaultDatabase: "設為預設",
defaultDatabase: "預設資料庫",
clearDatabase: "清除資料庫",