config-tools: show confirm info for deleting VMs

Show different confirm windows for Service_VM and other VMs.

Tracked-On: #7413
Signed-off-by: Conghui <conghui.chen@intel.com>
This commit is contained in:
Conghui 2022-05-06 11:04:42 +08:00 committed by acrnsi-robot
parent 02c8043ff9
commit ab51dcdab4
1 changed files with 16 additions and 3 deletions

View File

@ -177,14 +177,27 @@ export default {
}, },
deleteVM() { deleteVM() {
let currentVMIndex = -1; let currentVMIndex = -1;
let vmConfigcurrent = []
let msg=''
this.scenario.vm.map((vmConfig, vmIndex) => { this.scenario.vm.map((vmConfig, vmIndex) => {
if (vmConfig['@id'] === this.activeVMID) { if (vmConfig['@id'] === this.activeVMID) {
currentVMIndex = vmIndex currentVMIndex = vmIndex
vmConfigcurrent = vmConfig
}
})
if (vmConfigcurrent['load_order'] === 'SERVICE_VM') {
msg = "Post-launched VMs require the Service VM. If you proceed, all post-launched VMs and their settings will also be deleted. Are you sure you want to proceed?"
} else {
msg = `Delete this virtual machine VM${this.activeVMID}?`
}
confirm(msg).then((r) => {
if (r) {
console.log("remove VM")
this.scenario.vm.splice(currentVMIndex, 1);
this.updateCurrentFormSchema()
this.updateCurrentFormData()
} }
}) })
this.scenario.vm.splice(currentVMIndex, 1);
this.updateCurrentFormSchema()
this.updateCurrentFormData()
}, },
scenarioConfigFormDataUpdate(vmid, data) { scenarioConfigFormDataUpdate(vmid, data) {
if (vmid === -1) { if (vmid === -1) {