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(sidebar): add shortcut to disconnect connections

lxk9553a3eb7dd7c07
diff --git a/apps/desktop/src/components/sidebar/ConnectionTree.vue b/apps/desktop/src/components/sidebar/ConnectionTree.vue
index 678d28324b..38e1561cee 100644
--- a/apps/desktop/src/components/sidebar/ConnectionTree.vue
+++ b/apps/desktop/src/components/sidebar/ConnectionTree.vue
@@ -30,12 +30,12 @@ import { needsSidebarObjectGroupDiscovery } from "@/lib/sidebar/sidebarSearchDis
import { isSidebarSearchPrunedDatabaseNode, resolveSidebarSearchDatabaseScope } from "@/lib/sidebar/sidebarSearchDatabaseScope";
import { createSidebarSearchExpansionState } from "@/lib/sidebar/sidebarSearchExpansionState";
import { createSidebarSearchLoadingTracker } from "@/lib/sidebar/sidebarSearchLoadingTracker";
-import { isCancelSearchShortcut, isCopySidebarSelectionShortcut, isEditSidebarConnectionShortcut, isPasteSidebarSelectionShortcut, isViewTableDdlShortcut } from "@/lib/editor/keyboardShortcuts";
+import { isCancelSearchShortcut, isCopySidebarSelectionShortcut, isDisconnectSidebarConnectionShortcut, isEditSidebarConnectionShortcut, isPasteSidebarSelectionShortcut, isViewTableDdlShortcut } from "@/lib/editor/keyboardShortcuts";
import { sidebarNodeSupportsDdlView } from "@/lib/sidebar/sidebarTreeDdlShortcut";
import { objectSourceTargetForTreeNode } from "@/lib/sidebar/treeNodeClick";
import { supportsTypeObjectSource } from "@/lib/database/databaseObjectCapabilities";
import { copyToClipboard } from "@/lib/common/clipboard";
-import { connectionPasteTargetGroupId, copySelectedConnectionsToClipboards, selectedConnectionEditTarget } from "@/lib/sidebar/sidebarConnectionSelection";
+import { connectionPasteTargetGroupId, copySelectedConnectionsToClipboards, selectedConnectionDisconnectTargets, selectedConnectionEditTarget } from "@/lib/sidebar/sidebarConnectionSelection";
import { formatSidebarTableCopyText } from "@/lib/sidebar/sidebarTableNameCopy";
import { pruneTreeSelectionToVisibleNodeIds } from "@/lib/sidebar/sidebarTreeSelection";
import { isEditableSidebarTypeSearchTarget, sidebarTypeSearchNextQuery } from "@/lib/sidebar/sidebarTypeSearch";
@@ -2407,6 +2407,13 @@ function onWindowKeydown(event: KeyboardEvent) {
}
return;
}
+ if (sidebarShortcutTargetAllowsAppShortcut(event.target) && isDisconnectConnectionShortcut(event)) {
+ if (requestSelectedConnectionDisconnect()) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ return;
+ }
if (sidebarShortcutTargetAllowsAppShortcut(event.target) && isCopySidebarSelectionShortcut(event, settingsStore.editorSettings.shortcuts)) {
if (copySelectedSidebarNames()) {
event.preventDefault();
@@ -2467,6 +2474,10 @@ function isEditConnectionShortcut(event: KeyboardEvent): boolean {
return isEditSidebarConnectionShortcut(event, settingsStore.editorSettings.shortcuts);
}
+function isDisconnectConnectionShortcut(event: KeyboardEvent): boolean {
+ return isDisconnectSidebarConnectionShortcut(event, settingsStore.editorSettings.shortcuts);
+}
+
function requestSelectedConnectionEdit(): boolean {
const selectedNodeId = store.selectedTreeNodeId;
const currentNode = selectedNodeId ? flatTreeIndex.value.nodeById.get(selectedNodeId) : null;
@@ -2477,6 +2488,26 @@ function requestSelectedConnectionEdit(): boolean {
return true;
}
+function requestSelectedConnectionDisconnect(): boolean {
+ const selectedNodeId = store.selectedTreeNodeId;
+ const currentNode = selectedNodeId ? flatTreeIndex.value.nodeById.get(selectedNodeId) : null;
+ if (!currentNode) return false;
+ const targets = selectedConnectionDisconnectTargets(currentNode, selectedSidebarNodesInVisibleOrder());
+ const connectedTargets = targets.filter((target) => store.connectedIds.has(target.connectionId));
+ if (connectedTargets.length > 0) {
+ const connectionIds = connectedTargets.map((target) => target.connectionId);
+ void disconnectSidebarConnections(connectionIds, (connectionId) => store.disconnect(connectionId)).then((result) => {
+ if (result.succeeded > 0 && result.failed === 0) {
+ toast(connectionIds.length > 1 ? t("connection.disconnectedSelected", { count: connectionIds.length }) : t("connection.disconnected"), 2000);
+ } else if (result.failed > 0) {
+ toast(t("connection.disconnectSelectedPartial", { succeeded: result.succeeded, failed: result.failed }), 5000);
+ }
+ });
+ return true;
+ }
+ return false;
+}
+
function copySelectedSidebarNames(): boolean {
const nodes = selectedSidebarNodesInVisibleOrder();
if (nodes.length === 0) return false;
diff --git a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
index 91d502a8ca..a4d207e2be 100644
--- a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
+++ b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
@@ -145,7 +145,7 @@ import { copyDisplayPathForTreeNode, copyNameForTreeNode, isDirectNavigationTree
import { customTypeCapabilities, supportsTypeObjectSource } from "@/lib/database/databaseObjectCapabilities";
import { mongoCollectionTableTypeFromNode, mongoCreateDatabasePreview, mongoDropIndexFailureCount } from "@/lib/sidebar/mongoCollectionMutation";
import { dataTabOpenModeFromTreeClick, type DataTabOpenMode } from "@/lib/sidebar/dataTabOpenPolicy";
-import { isCopySidebarSelectionShortcut, isEditSidebarConnectionShortcut, isModRShortcut, isPasteSidebarSelectionShortcut } from "@/lib/editor/keyboardShortcuts";
+import { isCopySidebarSelectionShortcut, isDisconnectSidebarConnectionShortcut, isEditSidebarConnectionShortcut, isModRShortcut, isPasteSidebarSelectionShortcut } from "@/lib/editor/keyboardShortcuts";
import { handleSidebarTreeDeleteShortcut } from "@/lib/sidebar/sidebarTreeDeleteShortcut";
import { dataTableDoubleClickAction } from "@/lib/tabs/dataTabActivation";
import { attachedDatabaseNameFromPath, buildCreateDatabaseSql, buildDuckDbAttachDatabaseSql, buildSqliteAttachDatabaseSql, supportsCreateDatabaseCharset, supportsCreateDatabaseLocale, uniqueAttachedDatabaseName } from "@/lib/database/createDatabaseSql";
@@ -1266,6 +1266,12 @@ function onKeydown(event: KeyboardEvent) {
event.stopPropagation();
return;
}
+ if (isDisconnectConnectionShortcut(event)) {
+ if (!requestDisconnectSelectedConnection()) return;
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
if (isSidebarTreeArrowKey(event) && handleSidebarTreeArrowKey(event)) {
event.preventDefault();
event.stopPropagation();
@@ -1334,6 +1340,10 @@ function isEditConnectionShortcut(event: KeyboardEvent): boolean {
return isEditSidebarConnectionShortcut(event, settingsStore.editorSettings.shortcuts);
}
+function isDisconnectConnectionShortcut(event: KeyboardEvent): boolean {
+ return isDisconnectSidebarConnectionShortcut(event, settingsStore.editorSettings.shortcuts);
+}
+
function isCopyTreeSelectionShortcut(event: KeyboardEvent): boolean {
return isCopySidebarSelectionShortcut(event, settingsStore.editorSettings.shortcuts);
}
@@ -1529,6 +1539,18 @@ function requestEditSelectedConnection(): boolean {
return true;
}
+function requestDisconnectSelectedConnection(): boolean {
+ if (canDisconnectConnection()) {
+ void disconnectConnection();
+ return true;
+ }
+ if (canDisconnectConnectionGroup()) {
+ void disconnectConnectionGroup();
+ return true;
+ }
+ return false;
+}
+
function requestDeleteSelectedNode(): boolean {
claimTreeItemDialogOwnership();
ensureDangerDialogRouting();
@@ -5484,6 +5506,8 @@ const shortcutOpenDataInNewTab = computed(() => settingsStore.editorSettings.sho
const shortcutEditConnection = computed(() => settingsStore.editorSettings.shortcuts.editSidebarConnection);
+const shortcutDisconnectConnection = computed(() => settingsStore.editorSettings.shortcuts.disconnectSidebarConnection);
+
const shortcutRename = "F2";
const shortcutRefresh = "F5";
@@ -5624,7 +5648,7 @@ function buildConnectionSidebarMenu(context: SidebarMenuFactoryContext): boolean
if (isConnecting.value) {
items.push({ label: t("connection.cancelConnecting"), action: cancelConnectionAttempt, icon: X });
} else if (canDisconnectConnection()) {
- items.push({ label: connectionDisconnectMenuLabel(), action: disconnectConnection, icon: Unplug });
+ items.push({ label: connectionDisconnectMenuLabel(), action: disconnectConnection, icon: Unplug, shortcut: shortcutDisconnectConnection.value });
// save_password=false 且本次运行期已输入密码:提供"断开并忘记本次密码",
// 清除会话凭据后下次连接需重新输入。
if (canForgetSessionCredential()) {
@@ -5816,6 +5840,7 @@ function buildConnectionSidebarMenu(context: SidebarMenuFactoryContext): boolean
action: disconnectConnectionGroup,
icon: Unplug,
disabled: !canDisconnectConnectionGroup(),
+ shortcut: shortcutDisconnectConnection.value,
});
items.push({ label: "", separator: true });
items.push({
diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.ts
index 6648f3d8c4..ace06167d5 100644
--- a/apps/desktop/src/i18n/locales/az.ts
+++ b/apps/desktop/src/i18n/locales/az.ts
@@ -7991,6 +7991,7 @@ export default withEnglishFallback({
shortcutCopySidebarSelection: "Yan paneldəki seçimi kopyala",
shortcutPasteSidebarSelection: "Yan panelə yerləşdir",
shortcutEditSidebarConnection: "Yan paneldəki əlaqəni redaktə et",
+ shortcutDisconnectSidebarConnection: "Yan paneldəki əlaqəni kəs",
shortcutOpenDataInNewTab: "Məlumatları yeni vərəqdə aç (siçan klikləməsi)",
shortcutViewTableDdl: "Cədvəlin DDL-inə bax",
shortcutSendSelectionToAi: "Seçimi AI-yə göndər",
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 0b315fb77d..7d2d4e8f89 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -8871,6 +8871,7 @@ export default {
shortcutCopySidebarSelection: "Copy sidebar selection",
shortcutPasteSidebarSelection: "Paste into sidebar",
shortcutEditSidebarConnection: "Edit sidebar connection",
+ shortcutDisconnectSidebarConnection: "Disconnect sidebar connection",
shortcutOpenDataInNewTab: "Open data in new tab (mouse click)",
shortcutViewTableDdl: "View table DDL",
shortcutSendSelectionToAi: "Send selection to AI",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index aee55a7244..418f454e0e 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -8205,6 +8205,7 @@ export default withEnglishFallback({
shortcutCopySidebarSelection: "Copiar selección de la barra lateral",
shortcutPasteSidebarSelection: "Pegar en la barra lateral",
shortcutEditSidebarConnection: "Editar conexión de la barra lateral",
+ shortcutDisconnectSidebarConnection: "Desconectar conexión de la barra lateral",
shortcutOpenDataInNewTab: "Abrir datos en una pestaña nueva (clic del ratón)",
shortcutViewTableDdl: "Ver DDL de la tabla",
shortcutSendSelectionToAi: "Enviar selección a IA",
diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.ts
index 6fb55dc335..20383d335d 100644
--- a/apps/desktop/src/i18n/locales/id.ts
+++ b/apps/desktop/src/i18n/locales/id.ts
@@ -8705,6 +8705,7 @@ export default withEnglishFallback({
shortcutCopySidebarSelection: "Salin seleksi bilah sisi",
shortcutPasteSidebarSelection: "Tempel ke bilah sisi",
shortcutEditSidebarConnection: "Edit koneksi bilah sisi",
+ shortcutDisconnectSidebarConnection: "Putuskan koneksi bilah sisi",
shortcutOpenDataInNewTab: "Buka data di tab baru (klik mouse)",
shortcutViewTableDdl: "Lihat DDL tabel",
shortcutSendSelectionToAi: "Kirim seleksi ke AI",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index df99737343..e481c210d1 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -7976,6 +7976,7 @@ export default withEnglishFallback({
shortcutCopySidebarSelection: "Copia selezione barra laterale",
shortcutPasteSidebarSelection: "Incolla nella barra laterale",
shortcutEditSidebarConnection: "Modifica connessione barra laterale",
+ shortcutDisconnectSidebarConnection: "Disconnetti connessione barra laterale",
shortcutOpenDataInNewTab: "Apri dati in una nuova scheda (clic del mouse)",
shortcutViewTableDdl: "Visualizza DDL tabella",
shortcutSendSelectionToAi: "Invia selezione ad AI",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 1618c0438a..bf76b46d16 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -7973,6 +7973,7 @@ export default withEnglishFallback({
shortcutCopySidebarSelection: "サイドバーの選択をコピー",
shortcutPasteSidebarSelection: "サイドバーに貼り付け",
shortcutEditSidebarConnection: "サイドバー接続を編集",
+ shortcutDisconnectSidebarConnection: "サイドバー接続を切断",
shortcutOpenDataInNewTab: "新しいデータタブで開く(マウスクリック)",
shortcutViewTableDdl: "テーブルDDLを表示",
shortcutSendSelectionToAi: "選択範囲をAIに送信",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index 4b8847fdef..3c8ff24ca5 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -7757,6 +7757,7 @@ export default withEnglishFallback({
shortcutCopySidebarSelection: "사이드바 선택 복사",
shortcutPasteSidebarSelection: "사이드바에 붙여넣기",
shortcutEditSidebarConnection: "사이드바 연결 편집",
+ shortcutDisconnectSidebarConnection: "사이드바 연결 끊기",
shortcutOpenDataInNewTab: "새 탭에서 데이터 열기 (마우스 클릭)",
shortcutViewTableDdl: "테이블 DDL 보기",
shortcutSendSelectionToAi: "선택 영역을 AI로 보내기",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index f1ec640bc9..b54d988c15 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -7977,6 +7977,7 @@ export default withEnglishFallback({
shortcutCopySidebarSelection: "Copiar seleção da barra lateral",
shortcutPasteSidebarSelection: "Colar na barra lateral",
shortcutEditSidebarConnection: "Editar conexão da barra lateral",
+ shortcutDisconnectSidebarConnection: "Desconectar conexão da barra lateral",
shortcutOpenDataInNewTab: "Abrir dados em nova aba (clique do mouse)",
shortcutViewTableDdl: "Ver DDL da tabela",
shortcutSendSelectionToAi: "Enviar seleção para IA",
diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts
index caf1e7a5ba..f1cc19c266 100644
--- a/apps/desktop/src/i18n/locales/ru.ts
+++ b/apps/desktop/src/i18n/locales/ru.ts
@@ -9242,6 +9242,7 @@ export default withEnglishFallback({
shortcutCopySidebarSelection: "Копировать выделенное в боковой панели",
shortcutPasteSidebarSelection: "Вставить в боковую панель",
shortcutEditSidebarConnection: "Изменить подключение в боковой панели",
+ shortcutDisconnectSidebarConnection: "Отключить подключение в боковой панели",
shortcutOpenDataInNewTab: "Открыть данные в новой вкладке (клик мышью)",
shortcutViewTableDdl: "Просмотреть DDL таблицы",
shortcutSendSelectionToAi: "Отправить выделенное в AI",
diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.ts
index a3c5141c82..ccc24bde28 100644
--- a/apps/desktop/src/i18n/locales/tr.ts
+++ b/apps/desktop/src/i18n/locales/tr.ts
@@ -7890,6 +7890,7 @@ export default withEnglishFallback({
shortcutCopySidebarSelection: "Kenar çubuğu seçimini kopyala",
shortcutPasteSidebarSelection: "Kenar çubuğuna yapıştır",
shortcutEditSidebarConnection: "Kenar çubuğu bağlantısını düzenle",
+ shortcutDisconnectSidebarConnection: "Kenar çubuğu bağlantısını kes",
shortcutOpenDataInNewTab: "Verileri yeni sekmede aç (fare tıklaması)",
shortcutViewTableDdl: "Tablo DDL'ini görüntüle",
shortcutSendSelectionToAi: "Seçimi yapay zekâya gönder",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index 61f16e7e69..d37382cfcd 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -8837,6 +8837,7 @@ export default withEnglishFallback({
shortcutCopySidebarSelection: "复制侧边栏选中项",
shortcutPasteSidebarSelection: "粘贴到侧边栏",
shortcutEditSidebarConnection: "编辑侧边栏连接",
+ shortcutDisconnectSidebarConnection: "断开侧边栏连接",
shortcutOpenDataInNewTab: "在新数据标签页中打开(鼠标点击)",
shortcutViewTableDdl: "查看表 DDL",
shortcutSendSelectionToAi: "发送选中代码到 AI",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index c6cbdb3353..01318dd770 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -7272,6 +7272,7 @@ export default withEnglishFallback({
shortcutCopySidebarSelection: "複製側邊欄選取項",
shortcutPasteSidebarSelection: "貼到側邊欄",
shortcutEditSidebarConnection: "編輯側邊欄連線",
+ shortcutDisconnectSidebarConnection: "中斷側邊欄連線",
shortcutOpenDataInNewTab: "在新資料分頁中開啟(滑鼠點擊)",
shortcutViewTableDdl: "檢視資料表 DDL",
shortcutSendSelectionToAi: "傳送選取程式碼至 AI",
diff --git a/apps/desktop/src/lib/__tests__/editor/shortcutRegistry.spec.ts b/apps/desktop/src/lib/__tests__/editor/shortcutRegistry.spec.ts
index 6c3772237a..7f38c151b7 100644
--- a/apps/desktop/src/lib/__tests__/editor/shortcutRegistry.spec.ts
+++ b/apps/desktop/src/lib/__tests__/editor/shortcutRegistry.spec.ts
@@ -43,7 +43,7 @@ describe("shortcutRegistry editor actions", () => {
"exPasteSqlInCondition",
"toggleFold",
];
- const sidebarShortcutActionIds: ShortcutActionId[] = ["copySidebarSelection", "pasteSidebarSelection", "editSidebarConnection", "viewTableDdl"];
+ const sidebarShortcutActionIds: ShortcutActionId[] = ["copySidebarSelection", "pasteSidebarSelection", "editSidebarConnection", "disconnectSidebarConnection", "viewTableDdl"];
it("registers pagination navigation as unassigned grid shortcuts", () => {
const paginationActions = [
diff --git a/apps/desktop/src/lib/editor/keyboardShortcuts.ts b/apps/desktop/src/lib/editor/keyboardShortcuts.ts
index fc975a2d83..dd4653b916 100644
--- a/apps/desktop/src/lib/editor/keyboardShortcuts.ts
+++ b/apps/desktop/src/lib/editor/keyboardShortcuts.ts
@@ -321,6 +321,10 @@ export function isEditSidebarConnectionShortcut(event: ShortcutLikeEvent, shortc
return matchesShortcut(event, actionShortcut("editSidebarConnection", shortcuts));
}
+export function isDisconnectSidebarConnectionShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>): boolean {
+ return matchesShortcut(event, actionShortcut("disconnectSidebarConnection", shortcuts));
+}
+
export function isViewTableDdlShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>): boolean {
return matchesShortcut(event, actionShortcut("viewTableDdl", shortcuts));
}
diff --git a/apps/desktop/src/lib/editor/shortcutRegistry.ts b/apps/desktop/src/lib/editor/shortcutRegistry.ts
index 7dbac7f5b8..d28aa0c5ca 100644
--- a/apps/desktop/src/lib/editor/shortcutRegistry.ts
+++ b/apps/desktop/src/lib/editor/shortcutRegistry.ts
@@ -78,6 +78,7 @@ export type ShortcutActionId =
| "copySidebarSelection"
| "pasteSidebarSelection"
| "editSidebarConnection"
+ | "disconnectSidebarConnection"
| "openDataInNewTab"
| "viewTableDdl"
| "sendSelectionToAi"
@@ -614,6 +615,12 @@ export const SHORTCUT_DEFINITIONS: ShortcutDefinition[] = [
scope: "sidebar",
defaultShortcut: "Mod+E",
},
+ {
+ id: "disconnectSidebarConnection",
+ labelKey: "settings.shortcutDisconnectSidebarConnection",
+ scope: "sidebar",
+ defaultShortcut: "Shift+Mod+E",
+ },
{
id: "openDataInNewTab",
labelKey: "settings.shortcutOpenDataInNewTab",
diff --git a/packages/app-tests/keyboardShortcuts.test.ts b/packages/app-tests/keyboardShortcuts.test.ts
index f04dcc92ce..19147269ed 100644
--- a/packages/app-tests/keyboardShortcuts.test.ts
+++ b/packages/app-tests/keyboardShortcuts.test.ts
@@ -8,6 +8,7 @@ import {
isCloseOtherTabsShortcut,
isCloseTabShortcut,
isCopySidebarSelectionShortcut,
+ isDisconnectSidebarConnectionShortcut,
isExecuteSqlShortcut,
isEditSidebarConnectionShortcut,
isFocusSearchShortcut,
@@ -456,11 +457,14 @@ test("matches configurable sidebar shortcuts", () => {
assert.equal(isCopySidebarSelectionShortcut({ key: "c", metaKey: true }), true);
assert.equal(isPasteSidebarSelectionShortcut({ key: "v", ctrlKey: true }), true);
assert.equal(isEditSidebarConnectionShortcut({ key: "e", metaKey: true }), true);
+ assert.equal(isDisconnectSidebarConnectionShortcut({ key: "e", metaKey: true, shiftKey: true }), true);
+ assert.equal(isDisconnectSidebarConnectionShortcut({ key: "e", ctrlKey: true, shiftKey: true }), true);
const shortcuts = {
copySidebarSelection: "Alt+C",
pasteSidebarSelection: "Alt+V",
editSidebarConnection: "Shift+Mod+E",
+ disconnectSidebarConnection: "Alt+D",
} as any;
assert.equal(isCopySidebarSelectionShortcut({ key: "c", metaKey: true }, shortcuts), false);
@@ -468,4 +472,6 @@ test("matches configurable sidebar shortcuts", () => {
assert.equal(isPasteSidebarSelectionShortcut({ key: "v", altKey: true }, shortcuts), true);
assert.equal(isEditSidebarConnectionShortcut({ key: "e", metaKey: true }, shortcuts), false);
assert.equal(isEditSidebarConnectionShortcut({ key: "e", ctrlKey: true, shiftKey: true }, shortcuts), true);
+ assert.equal(isDisconnectSidebarConnectionShortcut({ key: "e", metaKey: true, shiftKey: true }, shortcuts), false);
+ assert.equal(isDisconnectSidebarConnectionShortcut({ key: "d", altKey: true }, shortcuts), true);
});
diff --git a/packages/app-tests/settingsStore.test.ts b/packages/app-tests/settingsStore.test.ts
index 5fe5130f97..b5714d9f0a 100644
--- a/packages/app-tests/settingsStore.test.ts
+++ b/packages/app-tests/settingsStore.test.ts
@@ -505,6 +505,7 @@ test("defaults shortcut settings", () => {
assert.equal(settings.shortcuts.copySidebarSelection, "Mod+C");
assert.equal(settings.shortcuts.pasteSidebarSelection, "Mod+V");
assert.equal(settings.shortcuts.editSidebarConnection, "Mod+E");
+ assert.equal(settings.shortcuts.disconnectSidebarConnection, "Shift+Mod+E");
});
test("keeps saved shortcut overrides", () => {
@@ -518,6 +519,7 @@ test("keeps saved shortcut overrides", () => {
openSettings: "Shift+Mod+P",
zoomInUi: "Alt+Mod+=",
editSidebarConnection: "Alt+E",
+ disconnectSidebarConnection: "Alt+D",
} as any,
});
@@ -530,6 +532,7 @@ test("keeps saved shortcut overrides", () => {
assert.equal(settings.shortcuts.openSettings, "Shift+Mod+P");
assert.equal(settings.shortcuts.zoomInUi, "Alt+Mod+=");
assert.equal(settings.shortcuts.editSidebarConnection, "Alt+E");
+ assert.equal(settings.shortcuts.disconnectSidebarConnection, "Alt+D");
assert.equal(settings.shortcuts.saveSql, "Mod+S");
});