mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 21:47:22 +00:00
config-tools: clean launch scripts before saving
Clean all launch scripts before click "Save" button, the new launch scripts will be created after that. Add a blank line to the warning dialog box. Tracked-On: #7532 Signed-off-by: Conghui <conghui.chen@intel.com>
This commit is contained in:
parent
38905c663f
commit
73f0d2795d
@ -250,19 +250,14 @@ export default {
|
|||||||
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?"
|
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?"
|
||||||
isserivevm = true
|
isserivevm = true
|
||||||
} else {
|
} else {
|
||||||
msg = `Delete this virtual machine? VM${this.activeVMID}\nThe associated launch script will also be deleted if it exists.`
|
msg = `Delete this virtual machine? VM${this.activeVMID}\n\nThe associated launch script will also be deleted if it exists.`
|
||||||
}
|
}
|
||||||
confirm(msg).then((r) => {
|
confirm(msg).then((r) => {
|
||||||
if (r) {
|
if (r) {
|
||||||
if (isserivevm) {
|
if (isserivevm) {
|
||||||
for (let i = postvmlist.length - 1; i >= 0; i--) {
|
for (let i = postvmlist.length - 1; i >= 0; i--) {
|
||||||
let launchScriptsname = this.WorkingFolder + `launch_user_vm_id${postvmlist[i]}.sh`
|
|
||||||
this.removeLaunchScript(launchScriptsname);
|
|
||||||
this.scenario.vm.splice(postvmlist[i], 1);
|
this.scenario.vm.splice(postvmlist[i], 1);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
let launchScriptsname = this.WorkingFolder + `launch_user_vm_id${currentVMIndex}.sh`
|
|
||||||
this.removeLaunchScript(launchScriptsname);
|
|
||||||
}
|
}
|
||||||
this.vmNameChange('', this.scenario.vm[currentVMIndex].name)
|
this.vmNameChange('', this.scenario.vm[currentVMIndex].name)
|
||||||
this.scenario.vm.splice(currentVMIndex, 1);
|
this.scenario.vm.splice(currentVMIndex, 1);
|
||||||
@ -272,13 +267,18 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
removeLaunchScript(filePath) {
|
cleanLaunchScript() {
|
||||||
console.log(filePath)
|
configurator.readDir(this.WorkingFolder, false)
|
||||||
configurator.isFile(filePath)
|
.then((files) => {
|
||||||
.then((isFile) => {
|
if (files.length > 0) {
|
||||||
if (isFile) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
configurator.removeFile(filePath)
|
let arr = files[i].path.split('.')
|
||||||
.catch((err) => alert(`Launch script is not exist: ${filePath}`))
|
let suffix = arr[arr.length - 1]
|
||||||
|
if (suffix == 'sh') {
|
||||||
|
configurator.removeFile(files[i].path)
|
||||||
|
.catch((err) => alert(`${err}`))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -395,10 +395,10 @@ export default {
|
|||||||
}
|
}
|
||||||
console.log("validation ok")
|
console.log("validation ok")
|
||||||
stepDone = 1
|
stepDone = 1
|
||||||
|
this.cleanLaunchScript()
|
||||||
configurator.writeFile(this.WorkingFolder + 'scenario.xml', scenarioXMLData)
|
configurator.writeFile(this.WorkingFolder + 'scenario.xml', scenarioXMLData)
|
||||||
|
.then(()=> {
|
||||||
stepDone = 2
|
stepDone = 2
|
||||||
|
|
||||||
if (needSaveLaunchScript) {
|
if (needSaveLaunchScript) {
|
||||||
let launchScripts = configurator.pythonObject.generateLaunchScript(this.board.content, scenarioXMLData)
|
let launchScripts = configurator.pythonObject.generateLaunchScript(this.board.content, scenarioXMLData)
|
||||||
for (let filename in launchScripts) {
|
for (let filename in launchScripts) {
|
||||||
@ -406,8 +406,11 @@ export default {
|
|||||||
}
|
}
|
||||||
stepDone = 3
|
stepDone = 3
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
alert(`${msg.slice(0,stepDone).join('')} \n All files successfully saved to your working folder ${this.WorkingFolder}`)
|
alert(`${msg.slice(0,stepDone).join('')} \n All files successfully saved to your working folder ${this.WorkingFolder}`)
|
||||||
} catch (err) {
|
})
|
||||||
|
} catch(err) {
|
||||||
console.log("error" + err)
|
console.log("error" + err)
|
||||||
let outmsg = ''
|
let outmsg = ''
|
||||||
for (var i = 0; i < stepDone; i++)
|
for (var i = 0; i < stepDone; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user