ui: fix update vm details wrt backend changes (#4670)

PR #4629 made changes in updateVirtualMachine behaviour wrt readonly details.
This change updates UI wrt new behaviour.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2021-03-11 13:17:23 +05:30 committed by GitHub
parent 8aa765ac39
commit a691e87f0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -176,6 +176,13 @@ export default {
})
this.disableSettings = (this.$route.meta.name === 'vm' && this.resource.state !== 'Stopped')
},
filterOrReadOnlyDetails () {
for (var i = 0; i < this.details.length; i++) {
if (!this.allowEditOfDetail(this.details[i].name)) {
this.details.splice(i, 1)
}
}
},
allowEditOfDetail (name) {
if (this.resource.readonlyuidetails) {
if (this.resource.readonlyuidetails.split(',').map(item => item.trim()).includes(name)) {
@ -257,13 +264,16 @@ export default {
}
this.error = false
this.details.push({ name: this.newKey, value: this.newValue })
this.filterOrReadOnlyDetails()
this.runApi()
},
updateDetail (index) {
this.filterOrReadOnlyDetails()
this.runApi()
},
deleteDetail (index) {
this.details.splice(index, 1)
this.filterOrReadOnlyDetails()
this.runApi()
},
onShowAddDetail () {