mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-20 00:17:44 +00:00
feat(shortcuts): add global shortcut to disconnect all connections
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -2521,7 +2521,7 @@ onUnmounted(() => {
|
||||
if (sidebarTreeContentMeasureFrame) window.cancelAnimationFrame(sidebarTreeContentMeasureFrame);
|
||||
});
|
||||
|
||||
defineExpose({ focusSearch, createNewGroup, collapseAllTreeNodes, locateTabInSidebar });
|
||||
defineExpose({ focusSearch, createNewGroup, collapseAllTreeNodes, locateTabInSidebar, disconnectAllActiveConnections });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user