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(etcd): multi-select tree keys for batch export and safe delete
二丫讲梵fc1f89ddb6fb
diff --git a/apps/desktop/src/components/etcd/EtcdKeyBrowser.vue b/apps/desktop/src/components/etcd/EtcdKeyBrowser.vueindex 2c8b1204e2..321825c5d1 100644--- a/apps/desktop/src/components/etcd/EtcdKeyBrowser.vue+++ b/apps/desktop/src/components/etcd/EtcdKeyBrowser.vue@@ -1,13 +1,14 @@<script setup lang="ts">import { computed, nextTick, onBeforeUnmount, ref, watch } from "vue";-import { Activity, AlertTriangle, ArrowRightLeft, ChevronDown, ChevronLeft, ChevronRight, Download, Eraser, KeyRound, Loader2, Search, Upload, Wrench } from "@lucide/vue";+import { Activity, AlertTriangle, ArrowRightLeft, ChevronDown, ChevronLeft, ChevronRight, Download, Eraser, KeyRound, Loader2, Search, Trash2, Upload, Wrench } from "@lucide/vue";import { useI18n } from "vue-i18n";import KvKeyBrowser from "@/components/kv/KvKeyBrowser.vue";import EtcdAdminConsole from "@/components/etcd/EtcdAdminConsole.vue";import { Badge } from "@/components/ui/badge";import { Button } from "@/components/ui/button";import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";-import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";+import DangerConfirmDialog from "@/components/editor/DangerConfirmDialog.vue";+import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";import { Input } from "@/components/ui/input";import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";import { useToast } from "@/composables/useToast";@@ -64,6 +65,13 @@ interface EtcdWatchPreset {scope: "key" | "prefix";}+interface EtcdMultiSelection {+ key: string;+ keyIdentity?: string | null;+ keyBytes?: api.KvValue | null;+ modRevision?: api.KvInt64 | null;+}+interface TransferRow {id: string;displayKey: string;@@ -110,6 +118,9 @@ const watchKeySuggestions = computed(() => {return [...keyBytesByDisplay.entries()].flatMap(([key, values]) => [...values.values()].map((keyBytes) => ({ key, keyBytes })));});const fileInput = ref<HTMLInputElement>();+const selectedTreeKeys = ref<EtcdMultiSelection[]>([]);+const batchDeleteOpen = ref(false);+const batchDeleting = ref(false);const searchQuery = ref("");const searchPrefix = ref("");@@ -313,6 +324,8 @@ const labels = computed(() => ({leasePickerHint: t("etcd.leasePickerHint"),noLeasePickerHint: t("etcd.noLeasePickerHint"),registryWarning: t("etcd.registryWarning"),+ selectAll: t("etcd.selectAllLoaded"),+ deselectAll: t("etcd.deselectAll"),valueContent: t("etcd.valueContent"),savePreview: t("etcd.savePreview"),keyAlreadyExists: t("etcd.keyAlreadyExists"),@@ -479,6 +492,66 @@ function bundleFromSummaries(entries: api.KvKeySummary[], prefix: string, revisi};}+function updateTreeSelection(selection: EtcdMultiSelection[]) {+ selectedTreeKeys.value = selection;+}++async function exportTreeSelection(format: EtcdExportFormat) {+ const selected = [...selectedTreeKeys.value];+ if (!selected.length) return;+ try {+ const entries = await mapWithConcurrency(selected, TARGET_LOOKUP_CONCURRENCY, async (item) => {+ const result = await api.etcdGet(props.connectionId, item.key, { keyBytes: item.keyBytes ?? undefined });+ if (!result.found || !result.value) throw new Error(t("etcd.notFound"));+ return {+ key: result.key || item.key,+ keyBytes: result.keyBytes ?? item.keyBytes ?? { encoding: "utf8", data: item.key },+ value: result.value,+ ...result.metadata,+ };+ });+ const file = buildEtcdExportFile(entries, "", null, "selection", `dbx-etcd-selection-${Date.now()}`, format);+ const exported = await downloadExport(file);+ if (exported) toast(t("etcd.exported", { count: entries.length }), 2500);+ } catch (error) {+ toast(error instanceof Error ? error.message : String(error), 4000);+ }+}++function selectedTreeKeyDetails(): string {+ return selectedTreeKeys.value.map((item) => item.key).join("\n");+}++async function deleteSelectedTreeKeys() {+ const selected = [...selectedTreeKeys.value];+ if (!selected.length || readOnly.value) return;+ batchDeleting.value = true;+ const completed: EtcdMultiSelection[] = [];+ let deleted = 0;+ let failed = false;+ try {+ for (const item of selected) {+ const result = await api.etcdDelete(props.connectionId, item.key, {+ keyBytes: item.keyBytes ?? undefined,+ expectedModRevision: item.modRevision ?? undefined,+ });+ deleted += result.deleted;+ completed.push(item);+ }+ toast(t("etcd.batchDeleteSuccess", { count: deleted }), 3000);+ } catch (error) {+ failed = true;+ const message = error instanceof Error ? error.message : String(error);+ toast(t("etcd.batchDeletePartial", { count: deleted, error: message }), 5000);+ } finally {+ if (failed) browserRef.value?.clearMultiSelection();+ else browserRef.value?.removeMultiSelection(completed);+ batchDeleteOpen.value = false;+ batchDeleting.value = false;+ if (completed.length || failed) browserRef.value?.refresh();+ }+}+function csvCell(value: string): string {return /[",\r\n]/.test(value) ? `"${value.replaceAll('"', '""')}"` : value;}@@ -970,12 +1043,19 @@ defineExpose({ focusSearch, refresh });<DropdownMenuTrigger as-child><Button size="sm" variant="outline" class="h-8 gap-1.5"><Download class="h-3.5 w-3.5" /> {{ t("etcd.export") }} <ChevronDown class="h-3.5 w-3.5" /></Button></DropdownMenuTrigger>- <DropdownMenuContent align="end" class="w-40">- <DropdownMenuItem @select="void exportAll('json')">JSON(可导入)</DropdownMenuItem>- <DropdownMenuItem @select="void exportAll('csv')">表格(CSV)</DropdownMenuItem>- <DropdownMenuItem @select="void exportAll('markdown')">Markdown</DropdownMenuItem>+ <DropdownMenuContent align="end" class="w-auto whitespace-nowrap">+ <DropdownMenuItem @select="void exportAll('json')">{{ t("etcd.exportAllJson") }}</DropdownMenuItem>+ <DropdownMenuItem @select="void exportAll('csv')">{{ t("etcd.exportAllCsv") }}</DropdownMenuItem>+ <DropdownMenuItem @select="void exportAll('markdown')">{{ t("etcd.exportAllMarkdown") }}</DropdownMenuItem>+ <template v-if="selectedTreeKeys.length">+ <DropdownMenuSeparator />+ <DropdownMenuItem @select="void exportTreeSelection('json')">{{ t("etcd.exportSelectionJson") }}</DropdownMenuItem>+ <DropdownMenuItem @select="void exportTreeSelection('csv')">{{ t("etcd.exportSelectionCsv") }}</DropdownMenuItem>+ <DropdownMenuItem @select="void exportTreeSelection('markdown')">{{ t("etcd.exportSelectionMarkdown") }}</DropdownMenuItem>+ </template></DropdownMenuContent></DropdownMenu>+ <Button size="sm" variant="destructive" class="h-8 gap-1.5" :disabled="readOnly || selectedTreeKeys.length === 0 || batchDeleting" @click="batchDeleteOpen = true"><Trash2 class="h-3.5 w-3.5" />{{ t("etcd.delete") }}</Button><Button size="sm" variant="outline" class="h-8 gap-1.5" :disabled="readOnly" @click="fileInput?.click()"><Upload class="h-3.5 w-3.5" /> {{ t("etcd.import") }}</Button><Button size="sm" variant="outline" class="h-8 gap-1.5" :disabled="etcdConnections.length < 2" @click="openSync"><ArrowRightLeft class="h-3.5 w-3.5" /> {{ t("etcd.sync") }}</Button><input ref="fileInput" type="file" accept="application/json,.json" class="hidden" @change="onImportFile" />@@ -995,10 +1075,12 @@ defineExpose({ focusSearch, refresh });:safe-write="true":allow-binary-edit="true":read-only="readOnly"+ :enable-multi-select="true":on-watch-key="openWatchForKey":lease-options="leaseOptions":on-lease-options-requested="refreshLeaseOptions"@refresh-requested="refreshTtlCapability"+ @selection-change="updateTreeSelection"/><div v-if="mode === 'search'" class="flex min-h-0 flex-1 flex-col">@@ -1253,5 +1335,15 @@ defineExpose({ focusSearch, refresh });</DialogFooter></DialogContent></Dialog>+ <DangerConfirmDialog+ v-model:open="batchDeleteOpen"+ :title="t('etcd.batchDeleteTitle')"+ :message="t('etcd.batchDeleteConfirm', { count: selectedTreeKeys.length })"+ :details="selectedTreeKeyDetails()"+ :confirm-label="t('etcd.batchDelete')"+ :loading="batchDeleting"+ :close-on-confirm="false"+ @confirm="deleteSelectedTreeKeys"+ /></div></template>diff --git a/apps/desktop/src/components/etcd/__tests__/EtcdKeyBrowser.spec.ts b/apps/desktop/src/components/etcd/__tests__/EtcdKeyBrowser.spec.tsindex 4f290b9d26..668752226f 100644--- a/apps/desktop/src/components/etcd/__tests__/EtcdKeyBrowser.spec.ts+++ b/apps/desktop/src/components/etcd/__tests__/EtcdKeyBrowser.spec.ts@@ -47,7 +47,7 @@ vi.mock("@/components/kv/KvKeyBrowser.vue", () => ({supportsTtl: { type: Boolean, default: false },ttlCapabilityKnown: { type: Boolean, default: true },},- emits: ["refreshRequested"],+ emits: ["refreshRequested", "selectionChange"],setup(props, { emit, expose }) {backend.capturedKvBrowserApi = props.api;expose({@@ -60,18 +60,88 @@ vi.mock("@/components/kv/KvKeyBrowser.vue", () => ({emit("refreshRequested");return true;},+ selectAllMultiSelection: () => undefined,+ clearMultiSelection: () => emit("selectionChange", []),+ removeMultiSelection: (selection: unknown[]) => {+ if (selection.length) emit("selectionChange", []);+ },});return () =>- h(- "button",- {- id: "kv-browser-stub",- "data-supports-ttl": String(props.supportsTtl),- "data-capability-known": String(props.ttlCapabilityKnown),- onClick: () => emit("refreshRequested"),- },- "refresh",- );+ h("div", [+ h(+ "button",+ {+ id: "kv-browser-stub",+ "data-supports-ttl": String(props.supportsTtl),+ "data-capability-known": String(props.ttlCapabilityKnown),+ onClick: () => emit("refreshRequested"),+ },+ "refresh",+ ),+ h(+ "button",+ {+ id: "emit-tree-selection",+ onClick: () =>+ emit("selectionChange", [+ {+ key: "[base64:/w==]",+ keyIdentity: "ff",+ keyBytes: { encoding: "base64", data: "/w==" },+ modRevision: "7",+ },+ ]),+ },+ "select",+ ),+ ]);+ },+ }),+}));++vi.mock("@/components/editor/DangerConfirmDialog.vue", () => ({+ default: defineComponent({+ name: "DangerConfirmDialogStub",+ props: {+ open: { type: Boolean, default: false },+ },+ emits: ["confirm", "update:open"],+ setup(props, { emit }) {+ return () => (props.open ? h("button", { id: "confirm-batch-delete", onClick: () => emit("confirm") }, "confirm") : null);+ },+ }),+}));++vi.mock("@/components/ui/dropdown-menu", () => ({+ DropdownMenu: defineComponent({+ name: "DropdownMenuStub",+ setup(_, { slots }) {+ return () => h("div", slots.default?.());+ },+ }),+ DropdownMenuTrigger: defineComponent({+ name: "DropdownMenuTriggerStub",+ setup(_, { slots }) {+ return () => h("div", slots.default?.());+ },+ }),+ DropdownMenuContent: defineComponent({+ name: "DropdownMenuContentStub",+ setup(_, { slots }) {+ return () => h("div", slots.default?.());+ },+ }),+ DropdownMenuItem: defineComponent({+ name: "DropdownMenuItemStub",+ emits: ["select"],+ setup(_, { emit, slots }) {+ return () => h("button", { type: "button", onClick: () => emit("select") }, slots.default?.());+ },+ }),+ DropdownMenuSeparator: defineComponent({+ name: "DropdownMenuSeparatorStub",+ setup() {+ return () => h("hr");},}),}));@@ -318,3 +388,72 @@ describe("EtcdKeyBrowser byte-identity routing", () => {root.remove();});});++describe("EtcdKeyBrowser tree batch operations", () => {+ it("requires confirmation before deleting selected keys with their raw bytes and selection-time revision", async () => {+ backend.etcdDelete.mockResolvedValue({ deleted: 1 });++ await mountBrowser();+ root!.querySelector<HTMLButtonElement>("#emit-tree-selection")!.click();+ await flushUi();++ const batchDelete = [...root!.querySelectorAll("button")].find((button) => button.textContent?.includes("etcd.delete"));+ expect(root!.querySelector("#confirm-batch-delete")).toBeNull();+ expect(backend.etcdDelete).not.toHaveBeenCalled();++ batchDelete!.click();+ await flushUi();+ expect(root!.querySelector("#confirm-batch-delete")).toBeTruthy();+ expect(backend.etcdDelete).not.toHaveBeenCalled();++ root!.querySelector<HTMLButtonElement>("#confirm-batch-delete")!.click();+ await flushUi();++ expect(backend.etcdDelete).toHaveBeenCalledWith("etcd-1", "[base64:/w==]", {+ keyBytes: { encoding: "base64", data: "/w==" },+ expectedModRevision: "7",+ });+ });++ it("shows selected exports only after selecting keys and exports with raw key bytes", async () => {+ backend.etcdGet.mockResolvedValue({+ found: true,+ key: "[base64:/w==]",+ keyBytes: { encoding: "base64", data: "/w==" },+ value: { encoding: "utf8", data: "value" },+ metadata: { modRevision: "7" },+ });++ await mountBrowser();+ const selectedExports = () => [...root!.querySelectorAll("button")].filter((button) => button.textContent?.includes("etcd.exportSelection"));+ expect(selectedExports()).toHaveLength(0);++ root!.querySelector<HTMLButtonElement>("#emit-tree-selection")!.click();+ await flushUi();++ expect(selectedExports()).toHaveLength(3);+ selectedExports()[0]!.click();+ await flushUi();++ expect(backend.etcdGet).toHaveBeenCalledWith("etcd-1", "[base64:/w==]", {+ keyBytes: { encoding: "base64", data: "/w==" },+ });+ });++ it("clears the stale selection and refreshes after a batch delete fails", async () => {+ backend.etcdDelete.mockRejectedValue(new Error("ETCD_CAS_CONFLICT"));++ await mountBrowser();+ root!.querySelector<HTMLButtonElement>("#emit-tree-selection")!.click();+ await flushUi();++ const batchDelete = [...root!.querySelectorAll("button")].find((button) => button.textContent?.includes("etcd.delete"));+ batchDelete!.click();+ await flushUi();+ root!.querySelector<HTMLButtonElement>("#confirm-batch-delete")!.click();+ await flushUi();++ const selectedExports = [...root!.querySelectorAll("button")].filter((button) => button.textContent?.includes("etcd.exportSelection"));+ expect(selectedExports).toHaveLength(0);+ });+});diff --git a/apps/desktop/src/components/kv/KvKeyBrowser.vue b/apps/desktop/src/components/kv/KvKeyBrowser.vueindex 0f3be4e649..e96164d56a 100644--- a/apps/desktop/src/components/kv/KvKeyBrowser.vue+++ b/apps/desktop/src/components/kv/KvKeyBrowser.vue@@ -4,7 +4,7 @@ import { useI18n } from "vue-i18n";import { Pane, Splitpanes } from "splitpanes";import "splitpanes/dist/splitpanes.css";import { useConnectionStore } from "@/stores/connectionStore";-import { Activity, ChevronDown, ChevronRight, Clock3, Copy, Download, FolderClosed, FolderOpen, KeyRound, Loader2, Pencil, Plus, RefreshCw, Search, Trash2 } from "@lucide/vue";+import { Activity, Check, ChevronDown, ChevronRight, Clock3, Copy, Download, FolderClosed, FolderOpen, KeyRound, Loader2, Pencil, Plus, RefreshCw, Search, Trash2 } from "@lucide/vue";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import { Badge } from "@/components/ui/badge";@@ -102,6 +102,8 @@ interface KvKeyBrowserLabels {leasePickerHint?: string;noLeasePickerHint?: string;registryWarning?: string;+ selectAll?: string;+ deselectAll?: string;}interface KvCreateModeOption {@@ -126,6 +128,10 @@ interface KvKeyRoute {keyBytes?: KvValue | null;}+interface KvMultiSelection extends KvKeyRoute {+ modRevision?: KvInt64 | null;+}+type BrowserTreeNode = KvKeyTreeNode | LazyKvKeyTreeNode;type BrowserTreeRow = { type: "node"; node: BrowserTreeNode; depth: number } | LazyKvKeyTreeRow;type KvExpiryMode = "permanent" | "ttl" | "lease";@@ -160,6 +166,7 @@ const props = withDefaults(safeWrite?: boolean;allowBinaryEdit?: boolean;readOnly?: boolean;+ enableMultiSelect?: boolean;onWatchKey?: (route: KvKeyRoute) => void;leaseOptions?: Array<{ id: KvInt64; ttl: number; grantedTtl?: number }>;onLeaseOptionsRequested?: () => void;@@ -176,10 +183,15 @@ const props = withDefaults(safeWrite: false,allowBinaryEdit: false,readOnly: false,+ enableMultiSelect: false,leaseOptions: () => [],},);+const emit = defineEmits<{+ selectionChange: [selection: KvMultiSelection[]];+}>();+const { t } = useI18n();const { toast } = useToast();const connectionStore = useConnectionStore();@@ -228,6 +240,7 @@ const showHistoryDiff = ref(false);const restoring = ref(false);const selectedCreateMode = ref<KvCreateMode>("persistent");const selectedPrettyValue = ref<string | null>(null);+const multiSelectedKeys = ref<Map<string, KvMultiSelection>>(new Map());const lazyTreeState = reactive(createLazyKvKeyTreeState());const pageSize = 200;const metadataRefreshIntervalMs = 1000;@@ -257,6 +270,13 @@ function routeIdentity(route: KvKeyRoute): string {return route.keyIdentity ?? route.key;}+function multiSelectionFromSummary(summary: KvKeySummary): KvMultiSelection {+ return {+ ...routeFromSummary(summary),+ modRevision: summary.modRevision == null ? null : String(summary.modRevision),+ };+}+function routeFromKey(input: string | KvKeyRoute): KvKeyRoute {return typeof input === "string" ? { key: input } : input;}@@ -368,6 +388,7 @@ function closeKeySuggestions() {function onPrefixInput(event: Event) {const value = (event.target as HTMLInputElement).value;+ clearMultiSelection();keySuggestionOpen.value = Boolean(value.trim());keySuggestionIndex.value = -1;}@@ -381,6 +402,7 @@ function moveKeySuggestion(delta: number) {function acceptKeySuggestion(index: number) {const suggestion = keySuggestions.value[index];if (!suggestion) return;+ clearMultiSelection();prefix.value = suggestion.key;closeKeySuggestions();void loadKeys(true);@@ -809,6 +831,61 @@ function onRowClick(node: BrowserTreeNode) {}}+function collectNodeMultiSelection(node: BrowserTreeNode): KvMultiSelection[] {+ if (node.kind === "lazy") return [{ key: node.key }];++ const selected: KvMultiSelection[] = [];+ const collect = (candidate: KvKeyTreeNode) => {+ if (candidate.kind === "leaf" || candidate.key) {+ selected.push({+ key: kvKeyTreeNodePath(candidate),+ keyIdentity: candidate.keyIdentity,+ keyBytes: candidate.keyBytes,+ modRevision: candidate.modRevision == null ? null : String(candidate.modRevision),+ });+ }+ if (candidate.kind === "group") candidate.children.forEach(collect);+ };+ collect(node);+ return selected;+}++function emitMultiSelection(next: Map<string, KvMultiSelection>) {+ multiSelectedKeys.value = next;+ emit("selectionChange", [...next.values()]);+}++function setNodeMultiSelection(node: BrowserTreeNode, selected: boolean) {+ const next = new Map(multiSelectedKeys.value);+ for (const route of collectNodeMultiSelection(node)) {+ const identity = routeIdentity(route);+ if (selected) next.set(identity, route);+ else next.delete(identity);+ }+ emitMultiSelection(next);+}++function nodeMultiSelectionState(node: BrowserTreeNode): { selected: boolean; indeterminate: boolean } {+ const candidates = collectNodeMultiSelection(node);+ if (!candidates.length) return { selected: false, indeterminate: false };+ const selectedCount = candidates.filter((route) => multiSelectedKeys.value.has(routeIdentity(route))).length;+ return { selected: selectedCount === candidates.length, indeterminate: selectedCount > 0 && selectedCount < candidates.length };+}++function selectAllMultiSelection() {+ emitMultiSelection(new Map(keys.value.map((key) => [summaryIdentity(key), multiSelectionFromSummary(key)])));+}++function clearMultiSelection() {+ if (multiSelectedKeys.value.size) emitMultiSelection(new Map());+}++function removeMultiSelection(selection: KvMultiSelection[]) {+ const next = new Map(multiSelectedKeys.value);+ selection.forEach((route) => next.delete(routeIdentity(route)));+ emitMultiSelection(next);+}+function onRowDoubleClick(node: BrowserTreeNode) {if (!nodeIsExpandable(node)) {void loadSelectedKey(routeFromNode(node)).then(() => openEditDialog());@@ -1329,6 +1406,7 @@ watch(async () => {stopKeyListRefresh();clearSelectedKey();+ clearMultiSelection();try {await connectionStore.ensureConnected(props.connectionId);} catch {@@ -1386,6 +1464,7 @@ onMounted(() => {onBeforeUnmount(() => {clearSelectedKey();+ clearMultiSelection();stopKeyListRefresh();});defineExpose({@@ -1394,6 +1473,10 @@ defineExpose({selectKey: selectKeyFromNavigation,openCreate: (parentPath?: string) => openCreateDialog(parentPath),selection: () => ({ key: selectedKey.value, value: selectedValue.value }),+ multiSelection: () => [...multiSelectedKeys.value.values()],+ selectAllMultiSelection,+ clearMultiSelection,+ removeMultiSelection,});</script>@@ -1435,6 +1518,10 @@ defineExpose({</button></div></div>+ <div v-if="enableMultiSelect && multiSelectedKeys.size" class="flex shrink-0 items-center gap-1.5">+ <Button size="sm" variant="outline" class="h-7 px-2 text-xs" @click="selectAllMultiSelection()">{{ labels.selectAll || "Select all" }}</Button>+ <Button size="sm" variant="outline" class="h-7 px-2 text-xs" @click="clearMultiSelection()">{{ labels.deselectAll || "Clear" }}</Button>+ </div><Button size="sm" variant="outline" class="h-8 gap-1.5" :disabled="loading" @click="loadKeys(true, { preserveSelection: true })"><Loader2 v-if="loading" class="h-3.5 w-3.5 animate-spin" /><RefreshCw v-else class="h-3.5 w-3.5" />@@ -1459,28 +1546,43 @@ defineExpose({<div v-else class="h-full overflow-auto py-1 text-sm"><template v-for="row in visibleRows" :key="row.type === 'node' ? row.node.id : row.id"><CustomContextMenu v-if="row.type === 'node'" :items="nodeContextMenuItems(row.node)" v-slot="{ onContextMenu }">- <button- type="button"- class="flex h-8 w-full items-center gap-1.5 px-2 text-left transition-colors hover:bg-accent"+ <div+ class="flex h-8 w-full items-center gap-1.5 pr-2 text-left transition-colors hover:bg-accent":class="rowIsSelected(row.node) ? 'bg-primary/10 font-medium text-foreground shadow-[inset_3px_0_0_hsl(var(--primary))]' : ''":style="{ paddingLeft: `${8 + row.depth * 18}px` }"- @click="onRowClick(row.node)"- @dblclick.stop.prevent="onRowDoubleClick(row.node)"@contextmenu="(event) => onRowContextMenu(event, row.node, onContextMenu)">- <template v-if="nodeIsExpandable(row.node)">- <Loader2 v-if="nodeIsLoading(row.node)" class="h-3.5 w-3.5 shrink-0 animate-spin" />- <ChevronDown v-else-if="nodeIsExpanded(row.node)" class="h-3.5 w-3.5 shrink-0" />- <ChevronRight v-else class="h-3.5 w-3.5 shrink-0" />- <FolderOpen v-if="nodeIsExpanded(row.node)" class="h-4 w-4 shrink-0 text-sky-500" />- <FolderClosed v-else class="h-4 w-4 shrink-0 text-sky-500" />- </template>- <template v-else>- <span class="w-3.5 shrink-0" />- <KeyRound class="h-4 w-4 shrink-0 text-sky-500" />- </template>- <span class="truncate">{{ row.node.label }}</span>- </button>+ <button+ v-if="enableMultiSelect"+ type="button"+ role="checkbox"+ class="flex h-5 w-5 shrink-0 items-center justify-center text-foreground"+ :aria-label="`${row.node.label}`"+ :aria-checked="nodeMultiSelectionState(row.node).indeterminate ? 'mixed' : nodeMultiSelectionState(row.node).selected"+ @click.stop+ @click="setNodeMultiSelection(row.node, !nodeMultiSelectionState(row.node).selected)"+ >+ <span v-if="nodeMultiSelectionState(row.node).selected" class="flex h-3.5 w-3.5 items-center justify-center rounded-[2px] bg-primary text-primary-foreground">+ <Check class="h-2.5 w-2.5 stroke-[3]" />+ </span>+ <span v-else-if="nodeMultiSelectionState(row.node).indeterminate" class="h-3.5 w-3.5 rounded-[2px] bg-primary" />+ <span v-else class="h-3.5 w-3.5 rounded-[2px] border border-muted-foreground/50" />+ </button>+ <button type="button" class="flex min-w-0 flex-1 items-center gap-1.5 text-left" @click="onRowClick(row.node)" @dblclick.stop.prevent="onRowDoubleClick(row.node)">+ <template v-if="nodeIsExpandable(row.node)">+ <Loader2 v-if="nodeIsLoading(row.node)" class="h-3.5 w-3.5 shrink-0 animate-spin" />+ <ChevronDown v-else-if="nodeIsExpanded(row.node)" class="h-3.5 w-3.5 shrink-0" />+ <ChevronRight v-else class="h-3.5 w-3.5 shrink-0" />+ <FolderOpen v-if="nodeIsExpanded(row.node)" class="h-4 w-4 shrink-0 text-sky-500" />+ <FolderClosed v-else class="h-4 w-4 shrink-0 text-sky-500" />+ </template>+ <template v-else>+ <span class="w-3.5 shrink-0" />+ <KeyRound class="h-4 w-4 shrink-0 text-sky-500" />+ </template>+ <span class="truncate">{{ row.node.label }}</span>+ </button>+ </div></CustomContextMenu><div v-else class="px-2 py-1" :style="{ paddingLeft: `${8 + row.depth * 18}px` }"><Button size="sm" variant="outline" class="h-7 w-full gap-1.5" :disabled="row.loading || loadingMore" @click="loadMoreLazyChildren(row.parentKey)">diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.tsindex 6b6303c08f..930dbc4d6b 100644--- a/apps/desktop/src/i18n/locales/en.ts+++ b/apps/desktop/src/i18n/locales/en.ts@@ -3264,6 +3264,15 @@ export default {clone: "Clone",copyKey: "Copy key",export: "Export",+ exportAll: "Export all",+ exportSelection: "Export selection",+ batchExport: "Batch export",+ exportAllJson: "Export all (JSON, importable)",+ exportAllCsv: "Export all (CSV)",+ exportAllMarkdown: "Export all (Markdown)",+ exportSelectionJson: "Export selection (JSON)",+ exportSelectionCsv: "Export selection (CSV)",+ exportSelectionMarkdown: "Export selection (Markdown)",import: "Import",sync: "Sync",history: "History",@@ -3279,6 +3288,13 @@ export default {exportResults: "Export results",clearSearchResults: "Clear results",exported: "Exported {count} keys",+ selectAllLoaded: "Select all",+ deselectAll: "Clear",+ batchDelete: "Batch delete",+ batchDeleteTitle: "Delete selected etcd keys",+ batchDeleteConfirm: "Delete {count} selected keys? This action cannot be undone.",+ batchDeleteSuccess: "Deleted {count} keys",+ batchDeletePartial: "Deleted {count} keys before the batch stopped: {error}",importPreview: "Import preview",syncPreview: "Sync preview",targetConnection: "Select target etcd connection",diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.tsindex b164610ca4..0bd04768f0 100644--- a/apps/desktop/src/i18n/locales/es.ts+++ b/apps/desktop/src/i18n/locales/es.ts@@ -3126,6 +3126,22 @@ export default withEnglishFallback({exportResults: "Exportar resultados",clearSearchResults: "Limpiar resultados",exported: "Se exportaron {count} claves",+ exportAll: "Exportar todo",+ exportSelection: "Exportar selección",+ batchExport: "Exportación por lotes",+ exportAllJson: "Exportar todo (JSON, importable)",+ exportAllCsv: "Exportar todo (CSV)",+ exportAllMarkdown: "Exportar todo (Markdown)",+ exportSelectionJson: "Exportar selección (JSON)",+ exportSelectionCsv: "Exportar selección (CSV)",+ exportSelectionMarkdown: "Exportar selección (Markdown)",+ selectAllLoaded: "Seleccionar todo",+ deselectAll: "Limpiar",+ batchDelete: "Eliminación por lotes",+ batchDeleteTitle: "Eliminar claves etcd seleccionadas",+ batchDeleteConfirm: "¿Eliminar las {count} claves seleccionadas? Esta acción no se puede deshacer.",+ batchDeleteSuccess: "Se eliminaron {count} claves",+ batchDeletePartial: "Se eliminaron {count} claves antes de detener el lote: {error}",importPreview: "Vista previa de importación",syncPreview: "Vista previa de sincronización",targetConnection: "Selecciona la conexión etcd de destino",diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.tsindex f9fd9dc7d2..215e02c7cd 100644--- a/apps/desktop/src/i18n/locales/it.ts+++ b/apps/desktop/src/i18n/locales/it.ts@@ -3124,6 +3124,22 @@ export default withEnglishFallback({exportResults: "Esporta risultati",clearSearchResults: "Cancella risultati",exported: "Esportate {count} chiavi",+ exportAll: "Esporta tutto",+ exportSelection: "Esporta selezione",+ batchExport: "Esportazione in batch",+ exportAllJson: "Esporta tutto (JSON, importabile)",+ exportAllCsv: "Esporta tutto (CSV)",+ exportAllMarkdown: "Esporta tutto (Markdown)",+ exportSelectionJson: "Esporta selezione (JSON)",+ exportSelectionCsv: "Esporta selezione (CSV)",+ exportSelectionMarkdown: "Esporta selezione (Markdown)",+ selectAllLoaded: "Seleziona tutto",+ deselectAll: "Cancella",+ batchDelete: "Eliminazione in batch",+ batchDeleteTitle: "Elimina le chiavi etcd selezionate",+ batchDeleteConfirm: "Eliminare le {count} chiavi selezionate? Questa azione non può essere annullata.",+ batchDeleteSuccess: "Eliminate {count} chiavi",+ batchDeletePartial: "Eliminate {count} chiavi prima dell'arresto del batch: {error}",importPreview: "Anteprima importazione",syncPreview: "Anteprima sincronizzazione",targetConnection: "Seleziona la connessione etcd di destinazione",diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.tsindex 78ef94ade3..c337333822 100644--- a/apps/desktop/src/i18n/locales/ja.ts+++ b/apps/desktop/src/i18n/locales/ja.ts@@ -3190,6 +3190,22 @@ export default withEnglishFallback({exportResults: "結果をエクスポート",clearSearchResults: "検索結果をクリア",exported: "{count} 件のキーをエクスポートしました",+ exportAll: "すべてエクスポート",+ exportSelection: "選択項目をエクスポート",+ batchExport: "一括エクスポート",+ exportAllJson: "すべてエクスポート(JSON、インポート可能)",+ exportAllCsv: "すべてエクスポート(CSV)",+ exportAllMarkdown: "すべてエクスポート(Markdown)",+ exportSelectionJson: "選択項目をエクスポート(JSON)",+ exportSelectionCsv: "選択項目をエクスポート(CSV)",+ exportSelectionMarkdown: "選択項目をエクスポート(Markdown)",+ selectAllLoaded: "すべて選択",+ deselectAll: "クリア",+ batchDelete: "一括削除",+ batchDeleteTitle: "選択した etcd キーを削除",+ batchDeleteConfirm: "選択した {count} 件のキーを削除しますか?この操作は元に戻せません。",+ batchDeleteSuccess: "{count} 件のキーを削除しました",+ batchDeletePartial: "バッチ停止前に {count} 件のキーを削除しました: {error}",importPreview: "インポートのプレビュー",syncPreview: "同期のプレビュー",targetConnection: "対象の etcd 接続を選択",diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.tsindex bd41e1655b..7abc9a7336 100644--- a/apps/desktop/src/i18n/locales/ko.ts+++ b/apps/desktop/src/i18n/locales/ko.ts@@ -3027,6 +3027,22 @@ export default withEnglishFallback({searchProgress: "{scanned}개 키 스캔, {matched}개 일치",exportResults: "결과 내보내기",exported: "키 {count}개 내보냄",+ exportAll: "전체 내보내기",+ exportSelection: "선택 항목 내보내기",+ batchExport: "일괄 내보내기",+ exportAllJson: "전체 내보내기 (JSON, 가져오기 가능)",+ exportAllCsv: "전체 내보내기 (CSV)",+ exportAllMarkdown: "전체 내보내기 (Markdown)",+ exportSelectionJson: "선택 항목 내보내기 (JSON)",+ exportSelectionCsv: "선택 항목 내보내기 (CSV)",+ exportSelectionMarkdown: "선택 항목 내보내기 (Markdown)",+ selectAllLoaded: "전체 선택",+ deselectAll: "비우기",+ batchDelete: "일괄 삭제",+ batchDeleteTitle: "선택한 etcd 키 삭제",+ batchDeleteConfirm: "선택한 키 {count}개를 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",+ batchDeleteSuccess: "키 {count}개를 삭제했습니다",+ batchDeletePartial: "일괄 작업이 중지되기 전에 키 {count}개를 삭제했습니다: {error}",importPreview: "가져오기 미리보기",syncPreview: "동기화 미리보기",targetConnection: "대상 etcd 연결 선택",diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.tsindex 53ae48468b..2d3af6e3ff 100644--- a/apps/desktop/src/i18n/locales/pt-BR.ts+++ b/apps/desktop/src/i18n/locales/pt-BR.ts@@ -3126,6 +3126,22 @@ export default withEnglishFallback({exportResults: "Exportar resultados",clearSearchResults: "Limpar resultados",exported: "{count} chaves exportadas",+ exportAll: "Exportar tudo",+ exportSelection: "Exportar seleção",+ batchExport: "Exportação em lote",+ exportAllJson: "Exportar tudo (JSON, importável)",+ exportAllCsv: "Exportar tudo (CSV)",+ exportAllMarkdown: "Exportar tudo (Markdown)",+ exportSelectionJson: "Exportar seleção (JSON)",+ exportSelectionCsv: "Exportar seleção (CSV)",+ exportSelectionMarkdown: "Exportar seleção (Markdown)",+ selectAllLoaded: "Selecionar tudo",+ deselectAll: "Limpar",+ batchDelete: "Exclusão em lote",+ batchDeleteTitle: "Excluir chaves etcd selecionadas",+ batchDeleteConfirm: "Excluir as {count} chaves selecionadas? Esta ação não pode ser desfeita.",+ batchDeleteSuccess: "{count} chaves excluídas",+ batchDeletePartial: "{count} chaves foram excluídas antes de o lote parar: {error}",importPreview: "Prévia da importação",syncPreview: "Prévia da sincronização",targetConnection: "Selecione a conexão etcd de destino",diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.tsindex 88cf4860c6..fe7c44f49a 100644--- a/apps/desktop/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/src/i18n/locales/zh-CN.ts@@ -3262,6 +3262,15 @@ export default withEnglishFallback({clone: "克隆",copyKey: "复制 Key",export: "导出",+ exportAll: "导出全部",+ exportSelection: "导出选择",+ batchExport: "批量导出",+ exportAllJson: "导出全部(JSON,可导入)",+ exportAllCsv: "导出全部(CSV)",+ exportAllMarkdown: "导出全部(Markdown)",+ exportSelectionJson: "导出选择(JSON)",+ exportSelectionCsv: "导出选择(CSV)",+ exportSelectionMarkdown: "导出选择(Markdown)",import: "导入",sync: "同步",history: "历史版本",@@ -3277,6 +3286,13 @@ export default withEnglishFallback({exportResults: "导出结果",clearSearchResults: "清空结果",exported: "已导出 {count} 个 Key",+ selectAllLoaded: "全选",+ deselectAll: "清空",+ batchDelete: "批量删除",+ batchDeleteTitle: "删除选中的 etcd Key",+ batchDeleteConfirm: "确定要删除选中的 {count} 个 Key 吗?此操作无法撤销。",+ batchDeleteSuccess: "已删除 {count} 个 Key",+ batchDeletePartial: "已删除 {count} 个 Key,批量操作已停止:{error}",importPreview: "导入预览",syncPreview: "同步预览",targetConnection: "选择目标 etcd 连接",diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.tsindex 480592da6c..14c1e82001 100644--- a/apps/desktop/src/i18n/locales/zh-TW.ts+++ b/apps/desktop/src/i18n/locales/zh-TW.ts@@ -5557,6 +5557,22 @@ export default withEnglishFallback({exportResults: "匯出結果",clearSearchResults: "清空結果",exported: "已匯出 {count} 個 Key",+ exportAll: "全部匯出",+ exportSelection: "匯出選取項目",+ batchExport: "批次匯出",+ exportAllJson: "全部匯出(JSON,可匯入)",+ exportAllCsv: "全部匯出(CSV)",+ exportAllMarkdown: "全部匯出(Markdown)",+ exportSelectionJson: "匯出選取項目(JSON)",+ exportSelectionCsv: "匯出選取項目(CSV)",+ exportSelectionMarkdown: "匯出選取項目(Markdown)",+ selectAllLoaded: "全選",+ deselectAll: "清空",+ batchDelete: "批次刪除",+ batchDeleteTitle: "刪除選取的 etcd Key",+ batchDeleteConfirm: "確定要刪除選取的 {count} 個 Key 嗎?此操作無法復原。",+ batchDeleteSuccess: "已刪除 {count} 個 Key",+ batchDeletePartial: "批次停止前已刪除 {count} 個 Key:{error}",importPreview: "匯入預覽",syncPreview: "同步預覽",targetConnection: "選擇目標 etcd 連線",