mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-18 11:47:30 +00:00
config_tools: fix vmNameChange event never called issue
fix vmNameChange event never called issue Tracked-On: #6691 Signed-off-by: Weiyi Feng <weiyix.feng@intel.com>
This commit is contained in:
parent
12b6faf375
commit
92bc8034be
@ -304,7 +304,7 @@ export default {
|
|||||||
},
|
},
|
||||||
vmNameChange(newname, oldname) {
|
vmNameChange(newname, oldname) {
|
||||||
let hvdata = this.scenario.hv
|
let hvdata = this.scenario.hv
|
||||||
if (hvdata.FEATURES.hasOwnProperty('IVSHMEM')) {
|
if (hvdata.hasOwnProperty('FEATURES') && hvdata.FEATURES.hasOwnProperty('IVSHMEM')) {
|
||||||
for (let key in hvdata.FEATURES.IVSHMEM.IVSHMEM_REGION) {
|
for (let key in hvdata.FEATURES.IVSHMEM.IVSHMEM_REGION) {
|
||||||
let region = hvdata.FEATURES.IVSHMEM.IVSHMEM_REGION[key]
|
let region = hvdata.FEATURES.IVSHMEM.IVSHMEM_REGION[key]
|
||||||
for (let key1 in region.IVSHMEM_VMS.IVSHMEM_VM) {
|
for (let key1 in region.IVSHMEM_VMS.IVSHMEM_VM) {
|
||||||
@ -382,7 +382,9 @@ export default {
|
|||||||
}
|
}
|
||||||
let errorFlag = false
|
let errorFlag = false
|
||||||
errorFlag = this.confirmVmName()
|
errorFlag = this.confirmVmName()
|
||||||
if (errorFlag) {return}
|
if (errorFlag) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.assignVMID()
|
this.assignVMID()
|
||||||
let msg = [
|
let msg = [
|
||||||
"scenario xml saved\n",
|
"scenario xml saved\n",
|
||||||
@ -414,44 +416,44 @@ export default {
|
|||||||
// begin write down and verify
|
// begin write down and verify
|
||||||
|
|
||||||
configurator.writeFile(this.WorkingFolder + 'scenario.xml', scenarioXMLData)
|
configurator.writeFile(this.WorkingFolder + 'scenario.xml', scenarioXMLData)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
stepDone = 1
|
stepDone = 1
|
||||||
console.log("validate settings...")
|
console.log("validate settings...")
|
||||||
this.errors = configurator.pythonObject.validateScenario(this.board.content, scenarioXMLData)
|
this.errors = configurator.pythonObject.validateScenario(this.board.content, scenarioXMLData)
|
||||||
// noinspection ExceptionCaughtLocallyJS
|
// noinspection ExceptionCaughtLocallyJS
|
||||||
if (this.errors.length !== 0) {
|
if (this.errors.length !== 0) {
|
||||||
throw new Error("validation failed")
|
throw new Error("validation failed")
|
||||||
}
|
|
||||||
console.log("validation ok")
|
|
||||||
stepDone = 2
|
|
||||||
return this.cleanLaunchScript()
|
|
||||||
}).then(() => {
|
|
||||||
if (needSaveLaunchScript) {
|
|
||||||
let launchScripts = configurator.pythonObject.generateLaunchScript(this.board.content, scenarioXMLData)
|
|
||||||
let writeDone = []
|
|
||||||
for (let filename in launchScripts) {
|
|
||||||
writeDone.push(configurator.writeFile(this.WorkingFolder + filename, launchScripts[filename]))
|
|
||||||
}
|
|
||||||
return Promise.all(writeDone)
|
|
||||||
} else {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
})
|
console.log("validation ok")
|
||||||
.then((result) => {
|
stepDone = 2
|
||||||
if (!_.isEmpty(result)) {
|
return this.cleanLaunchScript()
|
||||||
stepDone = 3
|
}).then(() => {
|
||||||
|
if (needSaveLaunchScript) {
|
||||||
|
let launchScripts = configurator.pythonObject.generateLaunchScript(this.board.content, scenarioXMLData)
|
||||||
|
let writeDone = []
|
||||||
|
for (let filename in launchScripts) {
|
||||||
|
writeDone.push(configurator.writeFile(this.WorkingFolder + filename, launchScripts[filename]))
|
||||||
|
}
|
||||||
|
return Promise.all(writeDone)
|
||||||
|
} else {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
alert(`${msg.slice(0, stepDone).join('')} \nAll files successfully saved to your working folder ${this.WorkingFolder}`)
|
|
||||||
})
|
|
||||||
.catch((err)=>{
|
|
||||||
console.log("error" + err)
|
|
||||||
let outmsg = ''
|
|
||||||
for (var i = 0; i < stepDone; i++)
|
|
||||||
outmsg += msg[i]
|
|
||||||
for (i = stepDone; i < totalMsg; i++)
|
|
||||||
outmsg += errmsg[i]
|
|
||||||
alert(`${outmsg} \n Please check your configuration`)
|
|
||||||
})
|
})
|
||||||
|
.then((result) => {
|
||||||
|
if (!_.isEmpty(result)) {
|
||||||
|
stepDone = 3
|
||||||
|
}
|
||||||
|
alert(`${msg.slice(0, stepDone).join('')} \nAll files successfully saved to your working folder ${this.WorkingFolder}`)
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log("error" + err)
|
||||||
|
let outmsg = ''
|
||||||
|
for (var i = 0; i < stepDone; i++)
|
||||||
|
outmsg += msg[i]
|
||||||
|
for (i = stepDone; i < totalMsg; i++)
|
||||||
|
outmsg += errmsg[i]
|
||||||
|
alert(`${outmsg} \n Please check your configuration`)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
vmNameCache: '',
|
||||||
currentFormMode: 'BasicConfigType',
|
currentFormMode: 'BasicConfigType',
|
||||||
formProps: {
|
formProps: {
|
||||||
"inline": false,
|
"inline": false,
|
||||||
@ -123,14 +124,21 @@ export default {
|
|||||||
dataChange({newValue, oldValue}) {
|
dataChange({newValue, oldValue}) {
|
||||||
let newID = newValue.hasOwnProperty('@id') ? newValue['@id'] : -1;
|
let newID = newValue.hasOwnProperty('@id') ? newValue['@id'] : -1;
|
||||||
let oldID = oldValue.hasOwnProperty('@id') ? oldValue['@id'] : -1;
|
let oldID = oldValue.hasOwnProperty('@id') ? oldValue['@id'] : -1;
|
||||||
if (newID === oldID) {
|
|
||||||
if (oldValue.name !== newValue.name) {
|
|
||||||
this.$emit('vmNameChange', newValue.name, oldValue.name)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (newID === oldID) {
|
||||||
|
// skip hv settings
|
||||||
|
if (newID !== -1) {
|
||||||
|
if (this.vmNameCache !== newValue.name) {
|
||||||
|
this.$emit('vmNameChange', newValue.name, this.vmNameCache)
|
||||||
|
this.vmNameCache = newValue.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.$emit('scenarioConfigFormDataUpdate', newID, newValue)
|
this.$emit('scenarioConfigFormDataUpdate', newID, newValue)
|
||||||
|
} else {
|
||||||
|
if (newID !== -1) {
|
||||||
|
this.vmNameCache = newValue.name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// this.$emit('update:scenarioData', this.formData)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +235,7 @@ export default {
|
|||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice{
|
.notice {
|
||||||
padding: 1rem 0;
|
padding: 1rem 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue
Block a user