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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat: add duplicate connection context menu action
t8y2fd444eb080bc
diff --git a/src/components/sidebar/TreeItem.vue b/src/components/sidebar/TreeItem.vueindex b092b8d041..e2bd2736bc 100644--- a/src/components/sidebar/TreeItem.vue+++ b/src/components/sidebar/TreeItem.vue@@ -54,6 +54,7 @@ import { useToast } from "@/composables/useToast";import { useDatabaseOptions } from "@/composables/useDatabaseOptions";import type { DatabaseType, QueryResult, TreeNode, TreeNodeType } from "@/types/database";import * as api from "@/lib/api";+import { uuid } from "@/lib/utils";import { resolveDefaultDatabase } from "@/lib/defaultDatabase";import {DATABASE_EXPORT_PAGE_SIZE,@@ -361,6 +362,15 @@ function copyName() {navigator.clipboard.writeText(props.node.label);}+async function duplicateConnection() {+ const connId = props.node.connectionId;+ if (!connId) return;+ const config = connectionStore.getConfig(connId);+ if (!config) return;+ const newConfig = { ...config, id: uuid(), name: `${config.name} (Copy)` };+ await connectionStore.addConnection(newConfig);+}+// --- Table Management Operations ---const showDropTableConfirm = ref(false);const showEmptyTableConfirm = ref(false);@@ -1186,6 +1196,9 @@ const isDragging = computed(() => dragState.active && dragState.draggedId === pr<ContextMenuItem @click="editConnection"><Pencil class="w-4 h-4" /> {{ t("contextMenu.editConnection") }}</ContextMenuItem>+ <ContextMenuItem @click="duplicateConnection">+ <CopyPlus class="w-4 h-4" /> {{ t("contextMenu.duplicateConnection") }}+ </ContextMenuItem><ContextMenuSeparator /><ContextMenuItem class="text-destructive" @click="deleteConnection"><Trash2 class="w-4 h-4" /> {{ t("contextMenu.deleteConnection") }}@@ -1317,8 +1330,10 @@ const isDragging = computed(() => dragState.active && dragState.draggedId === pr</ContextMenuItem></template>- <ContextMenuSeparator v-if="hasTypeMenu" />- <ContextMenuItem @click="copyName"> <Copy class="w-4 h-4" /> {{ t("contextMenu.copyName") }} </ContextMenuItem>+ <template v-if="node.type !== 'connection'">+ <ContextMenuSeparator v-if="hasTypeMenu" />+ <ContextMenuItem @click="copyName"> <Copy class="w-4 h-4" /> {{ t("contextMenu.copyName") }} </ContextMenuItem>+ </template></ContextMenuContent></ContextMenu>diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.tsindex cf5d319dd5..0f88db92d9 100644--- a/src/i18n/locales/en.ts+++ b/src/i18n/locales/en.ts@@ -411,6 +411,7 @@ export default {confirmDeleteTitle: "Delete Connection",confirmDeleteMessage: 'Are you sure you want to delete "{name}"? This cannot be undone.',editConnection: "Edit Connection",+ duplicateConnection: "Duplicate Connection",newQuery: "New Query",viewData: "View Data",editStructure: "Edit Structure",diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.tsindex 29929d2f56..58de1588de 100644--- a/src/i18n/locales/zh-CN.ts+++ b/src/i18n/locales/zh-CN.ts@@ -403,6 +403,7 @@ export default {confirmDeleteTitle: "删除连接",confirmDeleteMessage: "确定要删除「{name}」吗?此操作不可撤销。",editConnection: "编辑连接",+ duplicateConnection: "复制连接",newQuery: "新建查询",viewData: "查看数据",editStructure: "编辑表结构",