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: '连接失败',