From bdf5f6a87c21b15b0a37cf260380ec166a846010 Mon Sep 17 00:00:00 2001 From: Melody Ruch <396921921@qq.com> Date: Sat, 15 Aug 2026 18:56:34 +0800 Subject: [PATCH] fix(nacos): allow overriding target group when copying configs --- .../components/nacos/NacosAdminConsole.vue | 5 +- .../nacos/NacosConfigBatchDialog.vue | 14 ++- .../__tests__/NacosConfigBatchDialog.spec.ts | 22 ++++ apps/desktop/src/i18n/locales/en.ts | 2 + apps/desktop/src/i18n/locales/es.ts | 2 + apps/desktop/src/i18n/locales/it.ts | 2 + apps/desktop/src/i18n/locales/ja.ts | 2 + apps/desktop/src/i18n/locales/ko.ts | 2 + apps/desktop/src/i18n/locales/pt-BR.ts | 2 + apps/desktop/src/i18n/locales/zh-CN.ts | 2 + apps/desktop/src/i18n/locales/zh-TW.ts | 2 + apps/desktop/src/types/nacos.ts | 1 + crates/dbx-core/src/nacos/batch.rs | 112 +++++++++++++++++- crates/dbx-core/src/nacos/types.rs | 2 + 14 files changed, 163 insertions(+), 9 deletions(-) diff --git a/apps/desktop/src/components/nacos/NacosAdminConsole.vue b/apps/desktop/src/components/nacos/NacosAdminConsole.vue index 6b72924ac8..41120f177e 100644 --- a/apps/desktop/src/components/nacos/NacosAdminConsole.vue +++ b/apps/desktop/src/components/nacos/NacosAdminConsole.vue @@ -1244,7 +1244,7 @@ async function exportConfigArchive(scope: NacosConfigSelectionScope) { const batchTransferRequest = shallowRef(null); -async function previewBatch(payload: { scope: NacosConfigSelectionScope; targetConnectionId: string; targetNamespace: string; policy: NacosConflictPolicy }) { +async function previewBatch(payload: { scope: NacosConfigSelectionScope; targetConnectionId: string; targetNamespace: string; targetGroup: string; policy: NacosConflictPolicy }) { batchLoading.value = true; batchError.value = ""; batchPreview.value = null; @@ -1260,6 +1260,7 @@ async function previewBatch(payload: { scope: NacosConfigSelectionScope; targetC targetConnectionId: payload.targetConnectionId, source: buildConfigSelector(payload.scope), targetNamespace: payload.targetNamespace, + targetGroup: payload.targetGroup || undefined, conflictPolicy: payload.policy, }; batchTransferRequest.value = req; @@ -1272,7 +1273,7 @@ async function previewBatch(payload: { scope: NacosConfigSelectionScope; targetC } } -async function applyBatch(payload: { scope: NacosConfigSelectionScope; targetConnectionId: string; targetNamespace: string; policy: NacosConflictPolicy }) { +async function applyBatch(payload: { scope: NacosConfigSelectionScope; targetConnectionId: string; targetNamespace: string; targetGroup: string; policy: NacosConflictPolicy }) { if (batchLoading.value || batchReport.value || !batchPreview.value) return; if (payload.policy === "OVERWRITE" && !window.confirm(t("nacos.overwriteConfirm"))) return; const targetConnectionId = batchMode.value === "import" ? props.connectionId : payload.targetConnectionId; diff --git a/apps/desktop/src/components/nacos/NacosConfigBatchDialog.vue b/apps/desktop/src/components/nacos/NacosConfigBatchDialog.vue index fc86044d94..71e78ce0aa 100644 --- a/apps/desktop/src/components/nacos/NacosConfigBatchDialog.vue +++ b/apps/desktop/src/components/nacos/NacosConfigBatchDialog.vue @@ -37,8 +37,8 @@ const emit = defineEmits<{ chooseFile: []; reset: []; targetConnectionChange: [connectionId: string]; - preview: [payload: { scope: NacosConfigSelectionScope; targetConnectionId: string; targetNamespace: string; policy: NacosConflictPolicy }]; - apply: [payload: { scope: NacosConfigSelectionScope; targetConnectionId: string; targetNamespace: string; policy: NacosConflictPolicy }]; + preview: [payload: { scope: NacosConfigSelectionScope; targetConnectionId: string; targetNamespace: string; targetGroup: string; policy: NacosConflictPolicy }]; + apply: [payload: { scope: NacosConfigSelectionScope; targetConnectionId: string; targetNamespace: string; targetGroup: string; policy: NacosConflictPolicy }]; export: [scope: NacosConfigSelectionScope]; }>(); @@ -46,6 +46,7 @@ const { t } = useI18n(); const scope = ref("selected"); const policy = ref("ABORT"); const targetNamespace = ref(""); +const targetGroup = ref(""); const titleKey = computed(() => `nacos.batch${props.mode[0].toUpperCase()}${props.mode.slice(1)}Title`); const descriptionKey = computed(() => `nacos.batch${props.mode[0].toUpperCase()}${props.mode.slice(1)}Description`); @@ -116,6 +117,7 @@ watch( if (!open) return; scope.value = props.selectedCount ? "selected" : "filtered"; policy.value = "ABORT"; + targetGroup.value = ""; resetTargetNamespace(); }, { immediate: true }, @@ -202,6 +204,10 @@ watch(targetNamespaces, () => { +
+
{{ t("nacos.targetGroup") }}
+ +

{{ t("nacos.copyKeepsSource") }}

@@ -279,11 +285,11 @@ watch(targetNamespaces, () => { {{ t("nacos.exportZip") }}