From a691e87f0c18fed1235aacecb767a4c7a62abd1b Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 11 Mar 2021 13:17:23 +0530 Subject: [PATCH] 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 --- ui/src/components/view/DetailSettings.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ui/src/components/view/DetailSettings.vue b/ui/src/components/view/DetailSettings.vue index eaa446cddcf..2817e1c2b5b 100644 --- a/ui/src/components/view/DetailSettings.vue +++ b/ui/src/components/view/DetailSettings.vue @@ -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 () {