From 260cbb36d0f131bfaa17bab4bc2670bd4f9b0992 Mon Sep 17 00:00:00 2001 From: Jokul Date: Sat, 11 Jul 2026 00:30:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=B3=E9=94=AE=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=20+=20=E7=A7=BB=E9=99=A4=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=8D=A1=E7=89=87=E5=B7=A6=E9=94=AE=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复删除确认弹窗使用正确的 i18n key (connection.deleteConfirm) - 删除按钮使用 common.delete 而非不存在的 connection.delete - 新增 switchTo i18n key (5 种语言) - ConnectionCard 移除 @click 左键事件 - 右键菜单新增「切换到」选项 (已连接但非活跃时显示) --- .../src/components/ConnectionCard.vue | 13 ----------- .../src/components/ConnectionList.vue | 23 +++++++++++++++---- src/renderer/src/i18n/locales/de.ts | 1 + src/renderer/src/i18n/locales/en.ts | 1 + src/renderer/src/i18n/locales/ja.ts | 1 + src/renderer/src/i18n/locales/ko.ts | 1 + src/renderer/src/i18n/locales/zh-CN.ts | 1 + 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/renderer/src/components/ConnectionCard.vue b/src/renderer/src/components/ConnectionCard.vue index ac23b80..2a1df8d 100644 --- a/src/renderer/src/components/ConnectionCard.vue +++ b/src/renderer/src/components/ConnectionCard.vue @@ -15,18 +15,6 @@ const statusColor = computed(() => { const assignedColor = computed(() => props.connection.color || '') -function handleClick() { - if (isConn.value) { - if (isActive.value) { - connStore.disconnect() - } else { - connStore.switchTo(props.connection.id) - } - } else { - connStore.connect(props.connection) - } -} - function onDragStart(e: DragEvent) { if (e.dataTransfer) { e.dataTransfer.setData('text/plain', props.connection.id) @@ -45,7 +33,6 @@ function onDragStart(e: DragEvent) { 'border-left': assignedColor ? `3px solid ${assignedColor}` : undefined, }" draggable="true" - @click="handleClick" @dragstart="onDragStart" >
diff --git a/src/renderer/src/components/ConnectionList.vue b/src/renderer/src/components/ConnectionList.vue index 7572e2d..4ba17f4 100644 --- a/src/renderer/src/components/ConnectionList.vue +++ b/src/renderer/src/components/ConnectionList.vue @@ -19,6 +19,9 @@ const ctxMenu = ref<{ visible: boolean; x: number; y: number; conn: ConnectionCo const ctxIsConnected = computed(() => ctxMenu.value.conn ? connStore.isConnectedById(ctxMenu.value.conn.id) : false, ) +const ctxIsActive = computed(() => + ctxMenu.value.conn ? connStore.activeId === ctxMenu.value.conn.id : false, +) function onContextMenu(e: MouseEvent, conn: ConnectionConfig) { ctxMenu.value = { visible: true, x: e.clientX, y: e.clientY, conn } @@ -38,6 +41,11 @@ function ctxDisconnect() { closeCtxMenu() } +function ctxSwitch() { + if (ctxMenu.value.conn) connStore.switchTo(ctxMenu.value.conn.id) + closeCtxMenu() +} + function ctxEdit() { if (ctxMenu.value.conn) emit('edit', ctxMenu.value.conn) closeCtxMenu() @@ -65,11 +73,11 @@ async function ctxDelete() { if (!conn) return try { await ElMessageBox.confirm( - `${t('connection.delete')}: ${conn.name}?`, + t('connection.deleteConfirm'), t('common.confirm'), { type: 'warning', - confirmButtonText: t('connection.delete'), + confirmButtonText: t('common.delete'), cancelButtonText: t('common.cancel'), }, ) @@ -210,9 +218,14 @@ async function handleImport() { - +
diff --git a/src/renderer/src/i18n/locales/de.ts b/src/renderer/src/i18n/locales/de.ts index 4c2b59f..09e333b 100644 --- a/src/renderer/src/i18n/locales/de.ts +++ b/src/renderer/src/i18n/locales/de.ts @@ -55,6 +55,7 @@ export default { selectFile: 'Datei auswählen', connect: 'Verbinden', disconnect: 'Trennen', + switchTo: 'Wechseln zu', deleteConfirm: 'Diese Verbindung löschen?', testSuccess: 'Erfolgreich verbunden', testFailed: 'Verbindung fehlgeschlagen', diff --git a/src/renderer/src/i18n/locales/en.ts b/src/renderer/src/i18n/locales/en.ts index e56090f..75f3bf7 100644 --- a/src/renderer/src/i18n/locales/en.ts +++ b/src/renderer/src/i18n/locales/en.ts @@ -55,6 +55,7 @@ export default { selectFile: 'Select File', connect: 'Connect', disconnect: 'Disconnect', + switchTo: 'Switch to', deleteConfirm: 'Delete this connection?', testSuccess: 'Connected successfully', testFailed: 'Connection failed', diff --git a/src/renderer/src/i18n/locales/ja.ts b/src/renderer/src/i18n/locales/ja.ts index 0228f91..9bf508a 100644 --- a/src/renderer/src/i18n/locales/ja.ts +++ b/src/renderer/src/i18n/locales/ja.ts @@ -55,6 +55,7 @@ export default { selectFile: 'ファイルを選択', connect: '接続', disconnect: '切断', + switchTo: '切り替え', deleteConfirm: 'この接続を削除しますか?', testSuccess: '接続に成功しました', testFailed: '接続に失敗しました', diff --git a/src/renderer/src/i18n/locales/ko.ts b/src/renderer/src/i18n/locales/ko.ts index d3af9f3..f3d4cd5 100644 --- a/src/renderer/src/i18n/locales/ko.ts +++ b/src/renderer/src/i18n/locales/ko.ts @@ -55,6 +55,7 @@ export default { selectFile: '파일 선택', connect: '연결', disconnect: '연결 해제', + switchTo: '전환', deleteConfirm: '이 연결을 삭제하시겠습니까?', testSuccess: '연결 성공', testFailed: '연결 실패', diff --git a/src/renderer/src/i18n/locales/zh-CN.ts b/src/renderer/src/i18n/locales/zh-CN.ts index 6e3a1f6..66c6069 100644 --- a/src/renderer/src/i18n/locales/zh-CN.ts +++ b/src/renderer/src/i18n/locales/zh-CN.ts @@ -55,6 +55,7 @@ export default { selectFile: '选择文件', connect: '连接', disconnect: '断开', + switchTo: '切换到', deleteConfirm: '删除此连接?', testSuccess: '连接成功', testFailed: '连接失败',