From 03fc00c33c967709222de9679918be471ab90077 Mon Sep 17 00:00:00 2001 From: lxk955 <164191365+lxk955@users.noreply.github.com> Date: Fri, 2 Oct 2026 23:47:55 +0800 Subject: [PATCH] feat(search): open database search as a tab --- apps/desktop/src/App.vue | 1 + .../src/components/layout/ContentArea.vue | 23 + .../src/components/layout/TabModeIcon.vue | 3 +- .../src/components/layout/querySurfaces.ts | 2 + .../search/DatabaseSearchDialog.vue | 394 ++------------- .../components/search/DatabaseSearchPanel.vue | 468 ++++++++++++++++++ .../__tests__/DatabaseSearchPanel.spec.ts | 250 ++++++++++ .../composables/useSidebarTreeToolRuntime.ts | 6 +- apps/desktop/src/i18n/locales/az.ts | 1 + apps/desktop/src/i18n/locales/en.ts | 1 + apps/desktop/src/i18n/locales/es.ts | 1 + apps/desktop/src/i18n/locales/id.ts | 1 + apps/desktop/src/i18n/locales/it.ts | 1 + apps/desktop/src/i18n/locales/ja.ts | 1 + apps/desktop/src/i18n/locales/ko.ts | 1 + apps/desktop/src/i18n/locales/pt-BR.ts | 1 + apps/desktop/src/i18n/locales/ru.ts | 1 + apps/desktop/src/i18n/locales/tr.ts | 1 + apps/desktop/src/i18n/locales/zh-CN.ts | 1 + apps/desktop/src/i18n/locales/zh-TW.ts | 1 + .../__tests__/app/openTabsPersistence.spec.ts | 47 ++ .../__tests__/tabs/tabPresentation.spec.ts | 13 + .../src/lib/app/openTabsPersistence.ts | 2 + .../src/lib/tabs/contentSurfaceEvents.ts | 1 + apps/desktop/src/lib/tabs/tabPresentation.ts | 6 + .../queryStore.databaseSearch.spec.ts | 129 +++++ apps/desktop/src/stores/queryStore.ts | 39 ++ apps/desktop/src/types/database.ts | 33 +- 28 files changed, 1062 insertions(+), 367 deletions(-) create mode 100644 apps/desktop/src/components/search/DatabaseSearchPanel.vue create mode 100644 apps/desktop/src/components/search/__tests__/DatabaseSearchPanel.spec.ts create mode 100644 apps/desktop/src/stores/__tests__/queryStore.databaseSearch.spec.ts diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue index fc7f076c5b..179b6a2dea 100644 --- a/apps/desktop/src/App.vue +++ b/apps/desktop/src/App.vue @@ -4521,6 +4521,7 @@ onUnmounted(() => { }); } " + @open-database-search-target="(_tabId: string, target: any) => openDatabaseSearchTarget(target)" @object-schema-change="(tabId: string, schema: string | undefined) => queryStore.updateSchema(tabId, schema)" @object-browser-viewport-change="(tabId: string, viewport: any) => queryStore.updateObjectBrowserViewport(tabId, viewport)" @object-browser-search-change="(tabId: string, query: string) => queryStore.updateObjectBrowserSearch(tabId, query)" diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vue index 29bddbbb0a..2d95d886ca 100644 --- a/apps/desktop/src/components/layout/ContentArea.vue +++ b/apps/desktop/src/components/layout/ContentArea.vue @@ -123,6 +123,7 @@ const NacosAdminConsole = defineAsyncComponent(() => import("@/components/nacos/ const NacosAccessControlConsole = defineAsyncComponent(() => import("@/components/nacos/NacosAccessControlConsole.vue")); const NacosDashboard = defineAsyncComponent(() => import("@/components/nacos/NacosDashboard.vue")); const DoltVersionControl = defineAsyncComponent(() => import("@/components/dolt/DoltVersionControl.vue")); +const DatabaseSearchPanel = defineAsyncComponent(() => import("@/components/search/DatabaseSearchPanel.vue")); const DatabaseBrowser = defineAsyncComponent(() => import("@/components/objects/DatabaseBrowser.vue")); const ObjectBrowser = defineAsyncComponent(() => import("@/components/objects/ObjectBrowser.vue")); const TableStructureEditor = defineAsyncComponent(() => import("@/components/structure/TableStructureEditor.vue")); @@ -361,6 +362,7 @@ const etcdDashboardRef = ref<{ refresh?: () => boolean }>(); const zookeeperKeyBrowserRef = ref(); const consulOverviewRef = ref<{ refresh?: () => boolean }>(); const consulWorkspaceRef = ref(); +const databaseSearchPanelRef = ref<{ focusSearch: () => boolean }>(); const databaseBrowserRef = ref(); const objectBrowserRef = ref(); const pluginFilesystemTabRef = ref<{ refresh: () => Promise }>(); @@ -1258,6 +1260,7 @@ function focusSearch(target: Element | null = null): boolean { if (props.activeTab.mode === "zookeeper") return zookeeperKeyBrowserRef.value?.focusSearch() ?? false; if (props.activeTab.mode === "consul") return consulWorkspaceRef.value?.focusSearch() ?? false; if (props.activeTab.mode === "databases") return databaseBrowserRef.value?.focusSearch() ?? false; + if (props.activeTab.mode === "database-search") return databaseSearchPanelRef.value?.focusSearch() ?? false; if (props.activeTab.mode === "objects") return objectBrowserRef.value?.focusSearch(target) ?? false; if (props.activeTab.mode === "structure") return tableStructureEditorRef.value?.focusSearch() ?? false; if (props.activeTab.mode === "query") { @@ -3171,6 +3174,26 @@ defineExpose({ /> + +