This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 5aced732504 ui: reset configuration allowed only when value not 
default (#11728)
5aced732504 is described below

commit 5aced7325046a3c80a997370176a56bd346859d9
Author: Abhishek Kumar <[email protected]>
AuthorDate: Tue Jan 27 21:18:18 2026 +0530

    ui: reset configuration allowed only when value not default (#11728)
---
 ui/src/components/view/ListView.vue             |  2 +-
 ui/src/components/view/SettingsTab.vue          | 10 +++++++++-
 ui/src/views/setting/ConfigurationHierarchy.vue |  5 ++++-
 ui/src/views/setting/ConfigurationTab.vue       | 13 +++++++++++--
 ui/src/views/setting/ConfigurationTable.vue     |  8 +++++++-
 ui/src/views/setting/ConfigurationValue.vue     | 14 +++++++++-----
 6 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/ui/src/components/view/ListView.vue 
b/ui/src/components/view/ListView.vue
index 375fddcb55c..bf26145c135 100644
--- a/ui/src/components/view/ListView.vue
+++ b/ui/src/components/view/ListView.vue
@@ -966,7 +966,7 @@
           @onClick="$resetConfigurationValueConfirm(item, resetConfig)"
           v-if="editableValueKey !== record.key"
           icon="reload-outlined"
-          :disabled="!('updateConfiguration' in $store.getters.apis)"
+          :disabled="!('resetConfiguration' in $store.getters.apis) || 
record.value === record.defaultvalue"
         />
       </template>
       <template v-if="column.key === 'gpuDeviceActions'">
diff --git a/ui/src/components/view/SettingsTab.vue 
b/ui/src/components/view/SettingsTab.vue
index ab75bef8394..0e0ee33f280 100644
--- a/ui/src/components/view/SettingsTab.vue
+++ b/ui/src/components/view/SettingsTab.vue
@@ -26,7 +26,8 @@
       <ConfigurationTable
         :columns="columns"
         :config="items"
-        :resource="resource" />
+        :resource="resource"
+        @refresh-config="handleConfigRefresh" />
     </a-col>
   </div>
 </template>
@@ -140,6 +141,13 @@ export default {
     handleSearch (value) {
       this.filter = value
       this.fetchData()
+    },
+    handleConfigRefresh (name, updatedRecord) {
+      if (!name || !updatedRecord) return
+      const index = this.items.findIndex(item => item.name === name)
+      if (index !== -1) {
+        this.items.splice(index, 1, updatedRecord)
+      }
     }
   }
 }
diff --git a/ui/src/views/setting/ConfigurationHierarchy.vue 
b/ui/src/views/setting/ConfigurationHierarchy.vue
index 80b464e657c..815a048bc25 100644
--- a/ui/src/views/setting/ConfigurationHierarchy.vue
+++ b/ui/src/views/setting/ConfigurationHierarchy.vue
@@ -34,7 +34,7 @@
         <span :style="record.parent ? 'padding-left: 50px; display:block' : 
'padding-left: 25px; display:block'">{{ record.description }}</span>
       </template>
       <template v-if="column.key === 'value'">
-        <ConfigurationValue :configrecord="record" />
+        <ConfigurationValue :configrecord="record" 
@refresh="handleConfigRefresh" />
       </template>
     </template>
   </a-table>
@@ -83,6 +83,9 @@ export default {
         return 'light-row'
       }
       return 'dark-row'
+    },
+    handleConfigRefresh (name, updatedRecord) {
+      this.$emit('refresh-config', name, updatedRecord)
     }
   }
 }
diff --git a/ui/src/views/setting/ConfigurationTab.vue 
b/ui/src/views/setting/ConfigurationTab.vue
index 75905cbd174..65b256c94c9 100644
--- a/ui/src/views/setting/ConfigurationTab.vue
+++ b/ui/src/views/setting/ConfigurationTab.vue
@@ -58,7 +58,8 @@
                   :count="count"
                   :page="page"
                   :pagesize="pagesize"
-                  @change-page="changePage" />
+                  @change-page="changePage"
+                  @refresh-config="handleConfigRefresh" />
             </a-tab-pane>
             <a-tab-pane
               v-for="(group) in groups"
@@ -74,7 +75,8 @@
                   :tab="subgroup.name" >
                   <ConfigurationHierarchy
                     :columns="columns"
-                    :config="config" />
+                    :config="config"
+                    @refresh-config="handleConfigRefresh" />
                 </a-tab-pane>
               </a-tabs>
             </a-tab-pane>
@@ -322,6 +324,13 @@ export default {
           '#' + this.$route.path
         )
       }
+    },
+    handleConfigRefresh (name, updatedRecord) {
+      if (!name || !updatedRecord) return
+      const index = this.config.findIndex(item => item.name === name)
+      if (index !== -1) {
+        this.config.splice(index, 1, updatedRecord)
+      }
     }
   }
 }
diff --git a/ui/src/views/setting/ConfigurationTable.vue 
b/ui/src/views/setting/ConfigurationTable.vue
index da05b9342a0..7edc1b1aad6 100644
--- a/ui/src/views/setting/ConfigurationTable.vue
+++ b/ui/src/views/setting/ConfigurationTable.vue
@@ -32,7 +32,10 @@
           <b> {{record.displaytext }} </b> {{ ' (' + record.name + ')' }} 
<br/> {{ record.description }}
         </template>
         <template v-if="column.key === 'value'">
-          <ConfigurationValue :configrecord="record" :resource="resource" />
+          <ConfigurationValue
+            :configrecord="record"
+            :resource="resource"
+            @refresh="handleConfigRefresh" />
         </template>
       </template>
     </a-table>
@@ -113,6 +116,9 @@ export default {
         return 'config-light-row'
       }
       return 'config-dark-row'
+    },
+    handleConfigRefresh (name, updatedRecord) {
+      this.$emit('refresh-config', name, updatedRecord)
     }
   }
 }
diff --git a/ui/src/views/setting/ConfigurationValue.vue 
b/ui/src/views/setting/ConfigurationValue.vue
index 662e5ef142e..531d4e0ea61 100644
--- a/ui/src/views/setting/ConfigurationValue.vue
+++ b/ui/src/views/setting/ConfigurationValue.vue
@@ -187,7 +187,7 @@
           @onClick="$resetConfigurationValueConfirm(configrecord, 
resetConfigurationValue)"
           v-if="editableValueKey === null"
           icon="reload-outlined"
-          :disabled="(!('resetConfiguration' in $store.getters.apis) || 
configDisabled || valueLoading)" />
+          :disabled="(!('resetConfiguration' in $store.getters.apis) || 
configDisabled || valueLoading || configrecord.value === 
configrecord.defaultvalue)" />
       </span>
     </a-list-item>
   </a-list>
@@ -273,6 +273,7 @@ export default {
       this.editableValueKey = null
     },
     updateConfigurationValue (configrecord) {
+      let configRecordEntry = this.configrecord
       this.valueLoading = true
       this.editableValueKey = null
       var newValue = this.editableValue
@@ -294,7 +295,8 @@ export default {
         params[this.scopeKey] = this.resource?.id
       }
       postAPI('updateConfiguration', params).then(json => {
-        this.editableValue = 
this.getEditableValue(json.updateconfigurationresponse.configuration)
+        configRecordEntry = json.updateconfigurationresponse.configuration
+        this.editableValue = this.getEditableValue(configRecordEntry)
         this.actualValue = this.editableValue
         this.$emit('change-config', { value: newValue })
         this.$store.dispatch('RefreshFeatures')
@@ -318,10 +320,11 @@ export default {
         })
       }).finally(() => {
         this.valueLoading = false
-        this.$emit('refresh')
+        this.$emit('refresh', configrecord.name, configRecordEntry)
       })
     },
     resetConfigurationValue (configrecord) {
+      let configRecordEntry = this.configrecord
       this.valueLoading = true
       this.editableValueKey = null
       const params = {
@@ -332,7 +335,8 @@ export default {
         params[this.scopeKey] = this.resource?.id
       }
       postAPI('resetConfiguration', params).then(json => {
-        this.editableValue = 
this.getEditableValue(json.resetconfigurationresponse.configuration)
+        configRecordEntry = json.resetconfigurationresponse.configuration
+        this.editableValue = this.getEditableValue(configRecordEntry)
         this.actualValue = this.editableValue
         var newValue = this.editableValue
         if (configrecord.type === 'Range') {
@@ -360,7 +364,7 @@ export default {
         })
       }).finally(() => {
         this.valueLoading = false
-        this.$emit('refresh')
+        this.$emit('refresh', configrecord.name, configRecordEntry)
       })
     },
     getEditableValue (configrecord) {

Reply via email to