From c411dbdfbf24b3690a1a8d1fdf9c58c884a02e39 Mon Sep 17 00:00:00 2001 From: Chuang Ke Date: Wed, 24 Aug 2022 15:22:15 +0800 Subject: [PATCH] [config_tool] Configurator creates duplicate VM name 1.add condition to recalculate maxVMID from saved VM name, so that vm name could be update correctly if there is VM names "service VM" "real-time VM" "VM11", the new VM will be named "VM12" 2. support calculate VM name when changing any VM name. if there is VM names "service VM" "real-time VM" , the new VM will be named "VM2",count from 0. Tracked-On: #8046 Signed-off-by: Chuang-Ke Reviewed-by: Junjie Mao --- .../configurator/packages/configurator/src/pages/Config.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue b/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue index ea8086fc1..a5c1e639a 100644 --- a/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue @@ -232,6 +232,12 @@ export default { let haveService = false; this.scenario.vm.map((vmConfig) => { let vmID = vmConfig['@id']; + if (vmConfig['name'] && (/^VM(\d+)$/).test(vmConfig['name'])) { + let temp = vmConfig['name'].replace(/\D/g, ' ') + if (maxVMID < parseInt(temp)) { + maxVMID = parseInt(temp) + } + } if (vmID > maxVMID) { maxVMID = vmID }