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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(plugin): defer restored tabs until manual refresh
t8y27b7d21f54fe0
diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vueindex c180fe73d0..36ec0a082f 100644--- a/apps/desktop/src/components/layout/ContentArea.vue+++ b/apps/desktop/src/components/layout/ContentArea.vue@@ -208,6 +208,10 @@ type SearchableBrowserHandle = {executeCommand?: (command: string) => Promise<boolean>;};+type PluginTabHandle = {+ refresh?: () => Promise<void> | void;+};+type ElasticsearchJsonResponsePanelHandle = {focusSearch: () => boolean;};@@ -323,6 +327,8 @@ const consulOverviewRef = ref<{ refresh?: () => boolean }>();const consulWorkspaceRef = ref<SearchableBrowserHandle>();const databaseBrowserRef = ref<SearchableBrowserHandle>();const objectBrowserRef = ref<SearchableBrowserHandle>();+const pluginWorkbenchRef = ref<PluginTabHandle>();+const pluginFilesystemRef = ref<PluginTabHandle>();const activeTableMeta = computed(() => props.activeTab.tableMeta);const activeDataTabTableMeta = computed(() => tableMetaForDataTab(props.activeTab));const activeResultExecutionTarget = computed(() => queryStore.activeResultExecutionTarget(props.activeTab.id));@@ -961,6 +967,12 @@ function refreshData(): boolean {if (props.activeTab.mode === "consul-overview") return consulOverviewRef.value?.refresh?.() ?? false;if (props.activeTab.mode === "consul") return consulWorkspaceRef.value?.refresh?.() ?? false;if (props.activeTab.mode === "databases") return databaseBrowserRef.value?.refresh?.() ?? false;+ if (props.activeTab.mode === "plugin-workbench" || props.activeTab.mode === "plugin-filesystem") {+ const pluginTab = props.activeTab.mode === "plugin-workbench" ? pluginWorkbenchRef.value : pluginFilesystemRef.value;+ if (!pluginTab?.refresh) return false;+ void pluginTab.refresh();+ return true;+ }// Restored data tabs intentionally omit row data, so refresh must work before DataGrid mounts.if (canReloadUnavailableDataTab(props.activeTab)) {reloadUnavailableDataTab();@@ -1186,6 +1198,7 @@ function handleModRTarget(target: Element): boolean {if (target.closest("[data-cell-detail-editor-root]")) return dataGridRef.value?.openCellDetailSearch() ?? false;if (target.closest("[data-grid-root], [data-elasticsearch-json-response-root]")) return refreshData();if (canReloadUnavailableDataTab(props.activeTab)) return refreshData();+ if (props.activeTab.mode === "plugin-workbench" || props.activeTab.mode === "plugin-filesystem") return refreshData();return false;}@@ -2527,13 +2540,14 @@ defineExpose({</template><template v-else-if="activeTab.mode === 'plugin-workbench' && activeTab.pluginWorkbench">- <div class="flex-1 min-h-0">- <PluginWorkbenchTab :key="activeTab.id" :plugin-id="activeTab.pluginWorkbench.pluginId" :contribution-id="activeTab.pluginWorkbench.contributionId" :context="activeTab.pluginWorkbench.context" />+ <div class="min-w-0 flex-1 min-h-0">+ <PluginWorkbenchTab ref="pluginWorkbenchRef" :key="activeTab.id" :plugin-id="activeTab.pluginWorkbench.pluginId" :contribution-id="activeTab.pluginWorkbench.contributionId" :connection-id="activeTab.connectionId || undefined" :context="activeTab.pluginWorkbench.context" /></div></template><template v-else-if="activeTab.mode === 'plugin-filesystem' && activeTab.pluginFilesystem">- <div class="flex h-full min-h-0 flex-col">+ <div class="flex h-full min-h-0 min-w-0 flex-col"><PluginFilesystemTab+ ref="pluginFilesystemRef":key="activeTab.id":plugin-id="activeTab.pluginFilesystem.pluginId":provider-id="activeTab.pluginFilesystem.providerId"diff --git a/apps/desktop/src/components/plugins/PluginFileManager.vue b/apps/desktop/src/components/plugins/PluginFileManager.vueindex 9efd22f48d..1a922ff739 100644--- a/apps/desktop/src/components/plugins/PluginFileManager.vue+++ b/apps/desktop/src/components/plugins/PluginFileManager.vue@@ -161,6 +161,8 @@ watch(() => [props.pluginId, props.provider.id, props.connectionId, props.initialUri, rootUri.value] as const,() => void load(props.initialUri || rootUri.value),);++defineExpose({ refresh: () => load(currentUri.value) });</script><template>diff --git a/apps/desktop/src/components/plugins/PluginFilesystemTab.vue b/apps/desktop/src/components/plugins/PluginFilesystemTab.vueindex 864e5b4c9b..7367b57e60 100644--- a/apps/desktop/src/components/plugins/PluginFilesystemTab.vue+++ b/apps/desktop/src/components/plugins/PluginFilesystemTab.vue@@ -2,10 +2,12 @@import { computed, onMounted, ref, watch } from "vue";import { AlertTriangle, Loader2 } from "@lucide/vue";import PluginFileManager from "@/components/plugins/PluginFileManager.vue";+import PluginRefreshState from "@/components/plugins/PluginRefreshState.vue";import * as api from "@/lib/backend/api";import { createFrontendPluginRegistry } from "@/lib/plugins/frontendPlugin";import type { InstalledPlugin } from "@/types/database";import { useI18n } from "vue-i18n";+import { useConnectionStore } from "@/stores/connectionStore";const props = defineProps<{pluginId: string;@@ -16,10 +18,12 @@ const props = defineProps<{}>();const { t, locale: appLocale } = useI18n();+const connectionStore = useConnectionStore();const plugins = ref<InstalledPlugin[]>([]);const loading = ref(true);const error = ref("");+const deferred = ref(false);let loadGeneration = 0;const entry = computed(() =>createFrontendPluginRegistry(plugins.value, appLocale.value)@@ -27,6 +31,7 @@ const entry = computed(() =>.find((candidate) => candidate.plugin.manifest.id === props.pluginId && candidate.contribution.id === props.providerId),);const provider = computed(() => (entry.value ? { ...entry.value.contribution, root_uri: props.rootUri || entry.value.contribution.root_uri } : undefined));+const fileManagerRef = ref<InstanceType<typeof PluginFileManager>>();async function load() {const generation = ++loadGeneration;@@ -45,20 +50,49 @@ async function load() {}}-onMounted(() => void load());-watch(- () => [props.pluginId, props.providerId],- () => void load(),-);+async function refresh() {+ deferred.value = false;+ loading.value = true;+ error.value = "";+ try {+ if (props.connectionId) await connectionStore.ensureConnected(props.connectionId);+ if (fileManagerRef.value?.refresh) {+ loading.value = false;+ return await fileManagerRef.value.refresh();+ }+ await load();+ } catch (cause) {+ loading.value = false;+ error.value = cause instanceof Error ? cause.message : String(cause);+ }+}++function start() {+ deferred.value = !!props.connectionId && !connectionStore.connectedIds.has(props.connectionId);+ if (deferred.value) {+ loading.value = false;+ error.value = "";+ return;+ }+ void load();+}++onMounted(start);+watch(() => [props.pluginId, props.providerId, props.connectionId], start);++defineExpose({+ refresh,+});</script><template><div class="flex size-full min-h-0">- <div v-if="loading" class="m-auto flex items-center text-sm text-muted-foreground"><Loader2 class="mr-2 size-4 animate-spin" />{{ t("pluginPlatform.loadingFilesystem") }}</div>+ <PluginRefreshState v-if="deferred" @refresh="void refresh()" />+ <div v-else-if="loading" class="m-auto flex items-center text-sm text-muted-foreground"><Loader2 class="mr-2 size-4 animate-spin" />{{ t("pluginPlatform.loadingFilesystem") }}</div><div v-else-if="error || !provider" class="m-auto flex max-w-lg items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/5 p-4 text-sm text-destructive"><AlertTriangle class="mt-0.5 size-4 shrink-0" /><span>{{ error || t("pluginPlatform.filesystemUnavailableFallback") }}</span></div>- <PluginFileManager v-else class="min-h-0 flex-1" :plugin-id="pluginId" :provider="provider" :connection-id="connectionId" :initial-uri="initialUri" />+ <PluginFileManager v-else ref="fileManagerRef" class="min-h-0 flex-1" :plugin-id="pluginId" :provider="provider" :connection-id="connectionId" :initial-uri="initialUri" /></div></template>diff --git a/apps/desktop/src/components/plugins/PluginRefreshState.vue b/apps/desktop/src/components/plugins/PluginRefreshState.vuenew file mode 100644index 0000000000..436ceb10ce--- /dev/null+++ b/apps/desktop/src/components/plugins/PluginRefreshState.vue@@ -0,0 +1,28 @@+<script setup lang="ts">+import { Inbox, RefreshCcw } from "@lucide/vue";+import { Button } from "@/components/ui/button";+import { useI18n } from "vue-i18n";+import { formatShortcut } from "@/lib/editor/shortcutRegistry";++const emit = defineEmits<{ refresh: [] }>();+const { t } = useI18n();+const modRKeys = formatShortcut("Mod+R")+ .split("+")+ .map((key) => (key === "Cmd" ? "⌘" : key));+</script>++<template>+ <div class="flex size-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground">+ <Inbox class="h-8 w-8 opacity-60" />+ <div>{{ t("pluginPlatform.reloadRequired") }}</div>+ <div class="inline-flex items-center gap-1 text-xs text-muted-foreground/70">+ <span>{{ t("pluginPlatform.reloadHintPrefix") }}</span>+ <kbd v-for="key in modRKeys" :key="key" class="min-w-5 rounded border border-border/60 bg-muted/50 px-1.5 py-0.5 text-center font-mono text-[12px] leading-none text-muted-foreground shadow-xs">{{ key }}</kbd>+ <span>{{ t("pluginPlatform.reloadHintSuffix") }}</span>+ </div>+ <Button variant="outline" size="sm" class="h-7 gap-1.5" @click="emit('refresh')">+ <RefreshCcw class="h-3.5 w-3.5" />+ {{ t("pluginPlatform.refresh") }}+ </Button>+ </div>+</template>diff --git a/apps/desktop/src/components/plugins/PluginWorkbenchTab.vue b/apps/desktop/src/components/plugins/PluginWorkbenchTab.vueindex 1356258ca5..782dec619e 100644--- a/apps/desktop/src/components/plugins/PluginWorkbenchTab.vue+++ b/apps/desktop/src/components/plugins/PluginWorkbenchTab.vue@@ -2,25 +2,31 @@import { computed, onMounted, ref, watch } from "vue";import { AlertTriangle, Loader2 } from "@lucide/vue";import PluginWorkbenchHost from "@/components/plugins/PluginWorkbenchHost.vue";+import PluginRefreshState from "@/components/plugins/PluginRefreshState.vue";import * as api from "@/lib/backend/api";import { createFrontendPluginRegistry } from "@/lib/plugins/frontendPlugin";import type { PluginWorkbenchContext } from "@/lib/plugins/pluginHostBridge";import type { InstalledPlugin } from "@/types/database";import { useQueryStore } from "@/stores/queryStore";import { useI18n } from "vue-i18n";+import { useConnectionStore } from "@/stores/connectionStore";const props = defineProps<{pluginId: string;contributionId: string;+ connectionId?: string;context?: PluginWorkbenchContext;}>();const { t, locale: appLocale } = useI18n();+const connectionStore = useConnectionStore();const queryStore = useQueryStore();const plugins = ref<InstalledPlugin[]>([]);const loading = ref(true);const error = ref("");+const deferred = ref(false);let loadGeneration = 0;+const resolvedConnectionId = computed(() => props.connectionId || (typeof props.context?.connectionId === "string" ? props.context.connectionId : undefined));const entry = computed(() => createFrontendPluginRegistry(plugins.value, appLocale.value).findWorkbench(props.pluginId, props.contributionId));async function load() {@@ -40,6 +46,30 @@ async function load() {}}+async function refresh() {+ deferred.value = false;+ loading.value = true;+ error.value = "";+ try {+ if (resolvedConnectionId.value) await connectionStore.ensureConnected(resolvedConnectionId.value);+ await load();+ } catch (cause) {+ loading.value = false;+ error.value = cause instanceof Error ? cause.message : String(cause);+ }+}++function start() {+ const connectionId = resolvedConnectionId.value;+ deferred.value = !!connectionId && !connectionStore.connectedIds.has(connectionId);+ if (deferred.value) {+ loading.value = false;+ error.value = "";+ return;+ }+ void load();+}+function openWorkbench(pluginId: string, contributionId: string, context?: PluginWorkbenchContext) {const target = createFrontendPluginRegistry(plugins.value, appLocale.value).findWorkbench(pluginId, contributionId);queryStore.openPluginWorkbench(pluginId, contributionId, { title: target?.contribution.label || contributionId, context });@@ -58,16 +88,16 @@ function openFilesystem(pluginId: string, providerId: string, context?: PluginWo});}-onMounted(() => void load());-watch(- () => [props.pluginId, props.contributionId],- () => void load(),-);+onMounted(start);+watch(() => [props.pluginId, props.contributionId, props.connectionId, props.context?.connectionId], start);++defineExpose({ refresh });</script><template><div class="flex size-full min-h-0">- <div v-if="loading" class="m-auto flex items-center text-sm text-muted-foreground"><Loader2 class="mr-2 size-4 animate-spin" />{{ t("pluginPlatform.loadingWorkbench") }}</div>+ <PluginRefreshState v-if="deferred" @refresh="void refresh()" />+ <div v-else-if="loading" class="m-auto flex items-center text-sm text-muted-foreground"><Loader2 class="mr-2 size-4 animate-spin" />{{ t("pluginPlatform.loadingWorkbench") }}</div><div v-else-if="error || !entry" class="m-auto flex max-w-lg items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/5 p-4 text-sm text-destructive"><AlertTriangle class="mt-0.5 size-4 shrink-0" /><span>{{ error || t("pluginPlatform.workbenchUnavailableFallback") }}</span>diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.tsindex ee075b2e89..b501f61066 100644--- a/apps/desktop/src/i18n/locales/en.ts+++ b/apps/desktop/src/i18n/locales/en.ts@@ -254,6 +254,9 @@ export default {parentDirectory: "Parent directory",filesystemUri: "Filesystem URI",refresh: "Refresh",+ reloadRequired: "The plugin page needs to be reloaded.",+ reloadHintPrefix: "Press ",+ reloadHintSuffix: " or click the refresh button below to reload.",loadingFiles: "Loading files",emptyDirectory: "This directory is empty.",loadMore: "Load more",diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.tsindex ce2c1a50de..3e17222311 100644--- a/apps/desktop/src/i18n/locales/es.ts+++ b/apps/desktop/src/i18n/locales/es.ts@@ -247,6 +247,9 @@ export default withEnglishFallback({parentDirectory: "Directorio superior",filesystemUri: "URI del sistema de archivos",refresh: "Actualizar",+ reloadRequired: "La página del plugin debe recargarse.",+ reloadHintPrefix: "Pulsa ",+ reloadHintSuffix: " o haz clic en el botón de actualización para recargar.",loadingFiles: "Cargando archivos",emptyDirectory: "Este directorio está vacío.",loadMore: "Cargar más",diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.tsindex 020b0cfa28..37c7071990 100644--- a/apps/desktop/src/i18n/locales/it.ts+++ b/apps/desktop/src/i18n/locales/it.ts@@ -246,6 +246,9 @@ export default withEnglishFallback({parentDirectory: "Directory superiore",filesystemUri: "URI del file system",refresh: "Aggiorna",+ reloadRequired: "La pagina del plugin deve essere ricaricata.",+ reloadHintPrefix: "Premi ",+ reloadHintSuffix: " oppure fai clic sul pulsante di aggiornamento per ricaricare.",loadingFiles: "Caricamento file",emptyDirectory: "Questa directory è vuota.",loadMore: "Carica altro",diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.tsindex e5a1f0cd8b..688ef40503 100644--- a/apps/desktop/src/i18n/locales/ja.ts+++ b/apps/desktop/src/i18n/locales/ja.ts@@ -247,6 +247,9 @@ export default withEnglishFallback({parentDirectory: "親ディレクトリ",filesystemUri: "ファイルシステム URI",refresh: "更新",+ reloadRequired: "プラグインページを再読み込みする必要があります。",+ reloadHintPrefix: "",+ reloadHintSuffix: " を押すか、下の更新ボタンをクリックして再読み込みします。",loadingFiles: "ファイルを読み込み中",emptyDirectory: "このディレクトリは空です。",loadMore: "さらに読み込む",diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.tsindex 5451a36424..6c64320bc4 100644--- a/apps/desktop/src/i18n/locales/ko.ts+++ b/apps/desktop/src/i18n/locales/ko.ts@@ -255,6 +255,9 @@ export default withEnglishFallback({parentDirectory: "상위 디렉터리",filesystemUri: "파일 시스템 URI",refresh: "새로 고침",+ reloadRequired: "플러그인 페이지를 다시 로드해야 합니다.",+ reloadHintPrefix: "",+ reloadHintSuffix: " 키를 누르거나 아래 새로 고침 버튼을 클릭하세요.",loadingFiles: "파일 로드 중",emptyDirectory: "이 디렉터리는 비어 있습니다.",loadMore: "더 불러오기",diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.tsindex d7cce92adc..adbb455997 100644--- a/apps/desktop/src/i18n/locales/pt-BR.ts+++ b/apps/desktop/src/i18n/locales/pt-BR.ts@@ -247,6 +247,9 @@ export default withEnglishFallback({parentDirectory: "Diretório superior",filesystemUri: "URI do sistema de arquivos",refresh: "Atualizar",+ reloadRequired: "A página do plugin precisa ser recarregada.",+ reloadHintPrefix: "Pressione ",+ reloadHintSuffix: " ou clique no botão de atualização abaixo para recarregar.",loadingFiles: "Carregando arquivos",emptyDirectory: "Este diretório está vazio.",loadMore: "Carregar mais",diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.tsindex 04a8373cdc..388c06f33e 100644--- a/apps/desktop/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/src/i18n/locales/zh-CN.ts@@ -170,6 +170,9 @@ export default withEnglishFallback({parentDirectory: "上级目录",filesystemUri: "文件系统 URI",refresh: "刷新",+ reloadRequired: "插件页面需要重新加载。",+ reloadHintPrefix: "按 ",+ reloadHintSuffix: " 或点击下方刷新按钮重新加载。",loadingFiles: "正在加载文件",emptyDirectory: "此目录为空。",loadMore: "加载更多",diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.tsindex abd30a7888..5e38df5c03 100644--- a/apps/desktop/src/i18n/locales/zh-TW.ts+++ b/apps/desktop/src/i18n/locales/zh-TW.ts@@ -247,6 +247,9 @@ export default withEnglishFallback({parentDirectory: "上層目錄",filesystemUri: "檔案系統 URI",refresh: "重新整理",+ reloadRequired: "外掛頁面需要重新載入。",+ reloadHintPrefix: "按下 ",+ reloadHintSuffix: " 或點擊下方重新整理按鈕重新載入。",loadingFiles: "正在載入檔案",emptyDirectory: "此目錄為空。",loadMore: "載入更多",