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