parent
63a32c816b
commit
fd444eb080
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -403,6 +403,7 @@ export default {
|
|||
confirmDeleteTitle: "删除连接",
|
||||
confirmDeleteMessage: "确定要删除「{name}」吗?此操作不可撤销。",
|
||||
editConnection: "编辑连接",
|
||||
duplicateConnection: "复制连接",
|
||||
newQuery: "新建查询",
|
||||
viewData: "查看数据",
|
||||
editStructure: "编辑表结构",
|
||||
|
|
|
|||
Loading…
Reference in New Issue