Skip to content

Commit a691e87

Browse files
authored
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>
1 parent 8aa765a commit a691e87

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ui/src/components/view/DetailSettings.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ export default {
176176
})
177177
this.disableSettings = (this.$route.meta.name === 'vm' && this.resource.state !== 'Stopped')
178178
},
179+
filterOrReadOnlyDetails () {
180+
for (var i = 0; i < this.details.length; i++) {
181+
if (!this.allowEditOfDetail(this.details[i].name)) {
182+
this.details.splice(i, 1)
183+
}
184+
}
185+
},
179186
allowEditOfDetail (name) {
180187
if (this.resource.readonlyuidetails) {
181188
if (this.resource.readonlyuidetails.split(',').map(item => item.trim()).includes(name)) {
@@ -257,13 +264,16 @@ export default {
257264
}
258265
this.error = false
259266
this.details.push({ name: this.newKey, value: this.newValue })
267+
this.filterOrReadOnlyDetails()
260268
this.runApi()
261269
},
262270
updateDetail (index) {
271+
this.filterOrReadOnlyDetails()
263272
this.runApi()
264273
},
265274
deleteDetail (index) {
266275
this.details.splice(index, 1)
276+
this.filterOrReadOnlyDetails()
267277
this.runApi()
268278
},
269279
onShowAddDetail () {

0 commit comments

Comments
 (0)