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。

fix(desktop): show and switch special page tabs in empty workspace

二丫讲梵94617a5923f0
diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue
index b0ef033e49..24e360db6e 100644
--- a/apps/desktop/src/App.vue
+++ b/apps/desktop/src/App.vue
@@ -1059,6 +1059,10 @@ function activateOpenSpecialPageFallback() {
}
if (driverStoreTabOpen.value) {
activateMainContentSurface("driverStore");
+ return;
+ }
+ if (pluginCenterTabOpen.value) {
+ activateMainContentSurface("pluginCenter");
}
}
@@ -1072,6 +1076,14 @@ function closeSettingsPage() {
activateMainContentSurface("pluginCenter");
return;
}
+ if (driverStoreTabOpen.value) {
+ activateMainContentSurface("driverStore");
+ return;
+ }
+ if (pluginCenterTabOpen.value) {
+ activateMainContentSurface("pluginCenter");
+ return;
+ }
activateMainContentSurface("query");
}
@@ -1093,7 +1105,17 @@ function openDriverStorePage(target?: "agent" | "jdbc" | "storage" | "runtime" |
function closeDriverStorePage() {
driverStoreTabOpen.value = false;
- activateMainContentSurface("query");
+ // Keep another open special page visible when closing the active one. The
+ // previous implementation always switched to the query surface, which
+ // cleared pluginCenterActive and made an already-open Plugin Center tab
+ // disappear together with Driver Manager.
+ if (pluginCenterTabOpen.value) {
+ activateMainContentSurface("pluginCenter");
+ } else if (settingsPageTabOpen.value) {
+ activateMainContentSurface("settings");
+ } else {
+ activateMainContentSurface("query");
+ }
driverStoreActiveTab.value = "agent";
driverStoreFocus.value = null;
}
@@ -1107,7 +1129,13 @@ function openPluginCenterPage(focus?: PluginCenterFocus | null) {
function closePluginCenterPage() {
pluginCenterTabOpen.value = false;
pluginCenterFocus.value = null;
- activateMainContentSurface("query");
+ if (driverStoreTabOpen.value) {
+ activateMainContentSurface("driverStore");
+ } else if (settingsPageTabOpen.value) {
+ activateMainContentSurface("settings");
+ } else {
+ activateMainContentSurface("query");
+ }
}
function openPluginConnectionDialog(pluginId: string, providerId: string) {
@@ -3712,7 +3740,7 @@ onUnmounted(() => {
@start-resize="startTabBarResize"
@toggle-collapse="toggleTabBarCollapsed"
:active-tab="activeTab ?? undefined"
- :show-tab-navigation="queryStore.tabs.length > 0 || settingsPageTabOpen || driverStoreTabOpen"
+ :show-tab-navigation="queryStore.tabs.length > 0 || settingsPageTabOpen || driverStoreTabOpen || pluginCenterTabOpen"
:active-connection="activeConnection"
:tab-bar-width="tabBarWidth"
:tab-bar-collapsed="tabBarCollapsed"
diff --git a/apps/desktop/src/components/layout/EditorGroupTabBar.vue b/apps/desktop/src/components/layout/EditorGroupTabBar.vue
index f529e77a5a..792ce61902 100644
--- a/apps/desktop/src/components/layout/EditorGroupTabBar.vue
+++ b/apps/desktop/src/components/layout/EditorGroupTabBar.vue
@@ -138,7 +138,15 @@ const suppressNextTabClick = ref(false);
const isClassicLayout = computed(() => settingsStore.editorSettings.appLayout === "classic");
// Special pages append to the focused group's strip only: one instance at a
// time, in the pane the user is working in (v0.6.2 kept them in the single strip).
-const showSpecialPageTabs = computed(() => !!props.specialPageTabs && (props.specialPageTabs.settingsOpen || props.specialPageTabs.driverStoreOpen || props.specialPageTabs.pluginCenterOpen) && queryStore.focusedGroupId === props.groupId);
+const showSpecialPageTabs = computed(() => {
+ if (!props.specialPageTabs || !(props.specialPageTabs.settingsOpen || props.specialPageTabs.driverStoreOpen || props.specialPageTabs.pluginCenterOpen)) return false;
+ // With no regular query tabs there is no focus event to establish the
+ // focused group. Render the special-page tab in the sole (main) group so
+ // opening Plugin Center or Driver Manager by itself still creates a tab.
+ const isFocusedGroup = queryStore.focusedGroupId === props.groupId;
+ const isEmptyWorkspaceMainGroup = queryStore.tabs.length === 0 && props.groupId === queryStore.groups[0]?.id;
+ return isFocusedGroup || isEmptyWorkspaceMainGroup;
+});
const specialPageActive = computed(() => !!(props.specialPageTabs?.settingsActive || props.specialPageTabs?.driverStoreActive || props.specialPageTabs?.pluginCenterActive));
function isTabActive(tab: QueryTab): boolean {
diff --git a/apps/desktop/src/components/layout/__tests__/appContentSurfaces.contract.spec.ts b/apps/desktop/src/components/layout/__tests__/appContentSurfaces.contract.spec.ts
index bd1c5a5d29..6b102c24d0 100644
--- a/apps/desktop/src/components/layout/__tests__/appContentSurfaces.contract.spec.ts
+++ b/apps/desktop/src/components/layout/__tests__/appContentSurfaces.contract.spec.ts
@@ -22,15 +22,17 @@ describe("App main content surface structure", () => {
});
it("keeps navigation independent from the workspace welcome content", () => {
- expect(appSource).toContain(':show-tab-navigation="queryStore.tabs.length > 0 || settingsPageTabOpen || driverStoreTabOpen"');
+ expect(appSource).toContain(':show-tab-navigation="queryStore.tabs.length > 0 || settingsPageTabOpen || driverStoreTabOpen || pluginCenterTabOpen"');
expect(appSource).toContain(':active-tab="activeTab ?? undefined"');
expect(appSource).toMatch(/<template #empty>\s*<WelcomeScreen/);
- expect(appSource).not.toContain('v-if="queryStore.tabs.length > 0 || settingsPageTabOpen || driverStoreTabOpen"');
+ expect(appSource).not.toContain('v-if="queryStore.tabs.length > 0 || settingsPageTabOpen || driverStoreTabOpen || pluginCenterTabOpen"');
});
it("returns to an open special page after the final query tab closes", () => {
expect(appSource).toContain("else if (previousId) activateOpenSpecialPageFallback();");
- expect(appSource).toMatch(/function activateOpenSpecialPageFallback\(\)[\s\S]*?settingsPageTabOpen\.value[\s\S]*?activateMainContentSurface\("settings"\)[\s\S]*?driverStoreTabOpen\.value[\s\S]*?activateMainContentSurface\("driverStore"\)/);
+ expect(appSource).toMatch(
+ /function activateOpenSpecialPageFallback\(\)[\s\S]*?settingsPageTabOpen\.value[\s\S]*?activateMainContentSurface\("settings"\)[\s\S]*?driverStoreTabOpen\.value[\s\S]*?activateMainContentSurface\("driverStore"\)[\s\S]*?pluginCenterTabOpen\.value[\s\S]*?activateMainContentSurface\("pluginCenter"\)/,
+ );
});
it("anchors the drag-back hit test on every pane strip and the special-surfaces bar", () => {