mirror of https://github.com/apache/cloudstack.git
ui: reset configuration allowed only when value not default (#11728)
This commit is contained in:
parent
cb822feb72
commit
5aced73250
|
|
@ -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'">
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue