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。

feat(shortcuts): add global shortcut to disconnect all connections

Terry Yao9d8a5efedfa8
diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue
index 1ade88c5d8..62fe0d83bd 100644
--- a/apps/desktop/src/App.vue
+++ b/apps/desktop/src/App.vue
@@ -117,6 +117,7 @@ import {
isBrowserTaskManagerShortcut,
isCloseOtherTabsShortcut,
isCloseTabShortcut,
+ isDisconnectAllActiveConnectionsShortcut,
isEditTableStructureShortcut,
isExecuteSqlInNewResultTabShortcut,
isExecuteSqlShortcut,
@@ -4300,6 +4301,12 @@ async function handleKeydown(e: KeyboardEvent) {
appTabBarRef.value?.closeOtherActiveTabs();
return;
}
+ if (isDisconnectAllActiveConnectionsShortcut(e, shortcuts)) {
+ e.preventDefault();
+ e.stopPropagation();
+ void appSidebarRef.value?.disconnectAllActiveConnections();
+ return;
+ }
if (isCloseTabShortcut(e, shortcuts)) {
e.preventDefault();
await closeActiveSurface();
diff --git a/apps/desktop/src/components/layout/AppSidebar.vue b/apps/desktop/src/components/layout/AppSidebar.vue
index 95a08815cf..3f783a7165 100644
--- a/apps/desktop/src/components/layout/AppSidebar.vue
+++ b/apps/desktop/src/components/layout/AppSidebar.vue
@@ -122,6 +122,10 @@ function locateTabInSidebar(tab: QueryTab) {
return connectionTreeRef.value?.locateTabInSidebar(tab);
}
+function disconnectAllActiveConnections() {
+ return connectionTreeRef.value?.disconnectAllActiveConnections();
+}
+
function clearConnectionMultiSelection() {
applyConnectionMultiSelection(connectionStore, emptyConnectionMultiSelection());
}
@@ -198,7 +202,7 @@ function confirmCreateSelectedGroup() {
showCreateSelectedGroupDialog.value = false;
}
-defineExpose({ focusSearch, locateTabInSidebar });
+defineExpose({ focusSearch, locateTabInSidebar, disconnectAllActiveConnections });
</script>
<template>
diff --git a/apps/desktop/src/components/sidebar/ConnectionTree.vue b/apps/desktop/src/components/sidebar/ConnectionTree.vue
index 00be120ff3..217289354d 100644
--- a/apps/desktop/src/components/sidebar/ConnectionTree.vue
+++ b/apps/desktop/src/components/sidebar/ConnectionTree.vue
@@ -2521,7 +2521,7 @@ onUnmounted(() => {
if (sidebarTreeContentMeasureFrame) window.cancelAnimationFrame(sidebarTreeContentMeasureFrame);
});
-defineExpose({ focusSearch, createNewGroup, collapseAllTreeNodes, locateTabInSidebar });
+defineExpose({ focusSearch, createNewGroup, collapseAllTreeNodes, locateTabInSidebar, disconnectAllActiveConnections });
</script>
<template>
diff --git a/apps/desktop/src/lib/editor/keyboardShortcuts.ts b/apps/desktop/src/lib/editor/keyboardShortcuts.ts
index bf10637218..c63a7075d5 100644
--- a/apps/desktop/src/lib/editor/keyboardShortcuts.ts
+++ b/apps/desktop/src/lib/editor/keyboardShortcuts.ts
@@ -313,6 +313,10 @@ export function isToggleZenModeShortcut(event: ShortcutLikeEvent, shortcuts?: Pa
return matchesShortcut(event, actionShortcut("toggleZenMode", shortcuts));
}
+export function isDisconnectAllActiveConnectionsShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>): boolean {
+ return matchesShortcut(event, actionShortcut("disconnectAllActiveConnections", shortcuts));
+}
+
export function isCopySidebarSelectionShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>): boolean {
return matchesShortcut(event, actionShortcut("copySidebarSelection", shortcuts));
}
diff --git a/apps/desktop/src/lib/editor/shortcutRegistry.ts b/apps/desktop/src/lib/editor/shortcutRegistry.ts
index da51e48681..259415b6b1 100644
--- a/apps/desktop/src/lib/editor/shortcutRegistry.ts
+++ b/apps/desktop/src/lib/editor/shortcutRegistry.ts
@@ -85,6 +85,7 @@ export type ShortcutActionId =
| "pasteSidebarSelection"
| "editSidebarConnection"
| "disconnectSidebarConnection"
+ | "disconnectAllActiveConnections"
| "openDataInNewTab"
| "viewTableDdl"
| "sendSelectionToAi"
@@ -653,6 +654,12 @@ export const SHORTCUT_DEFINITIONS: ShortcutDefinition[] = [
scope: "global",
defaultShortcut: "Shift+Mod+F12",
},
+ {
+ id: "disconnectAllActiveConnections",
+ labelKey: "sidebar.disconnectAllActiveConnections",
+ scope: "global",
+ defaultShortcut: "",
+ },
{
id: "copySidebarSelection",
labelKey: "settings.shortcutCopySidebarSelection",