mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-23 09:23:26 +00:00
Feature:支持模式选择搜索
Co-authored-by: staff <staff@qimaos-MacBook-Pro.local>
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -399,6 +399,7 @@ export default withEnglishFallback({
|
||||
selectDatabase: "データベースを選択",
|
||||
searchDatabase: "データベースを検索...",
|
||||
selectSchema: "スキーマを選択",
|
||||
searchSchema: "スキーマを検索...",
|
||||
setDefaultDatabase: "デフォルトに設定",
|
||||
defaultDatabase: "デフォルト",
|
||||
clearDatabase: "データベースをクリア",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -407,6 +407,7 @@ export default withEnglishFallback({
|
||||
selectDatabaseRequired: "请先选择数据库",
|
||||
searchDatabase: "搜索数据库...",
|
||||
selectSchema: "选择模式",
|
||||
searchSchema: "搜索模式...",
|
||||
setDefaultDatabase: "设为默认",
|
||||
defaultDatabase: "默认库",
|
||||
clearDatabase: "清除数据库选择",
|
||||
|
||||
@@ -401,6 +401,7 @@ export default withEnglishFallback({
|
||||
selectDatabaseRequired: "請先選擇資料庫",
|
||||
searchDatabase: "搜尋資料庫……",
|
||||
selectSchema: "選擇 Schema",
|
||||
searchSchema: "搜尋 Schema...",
|
||||
setDefaultDatabase: "設為預設",
|
||||
defaultDatabase: "預設資料庫",
|
||||
clearDatabase: "清除資料庫",
|
||||
|
||||
Reference in New Issue
Block a user