Skip to content

Commit c5e34e6

Browse files
committed
ui: improve related global config popup
Consider child configs in the list for related configs and show an alert that there may be other dependent configs. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 4ce5291 commit c5e34e6

2 files changed

Lines changed: 32 additions & 11 deletions

File tree

ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3942,6 +3942,7 @@
39423942
"message.recover.vm": "Please confirm that you would like to recover this Instance.",
39433943
"message.reinstall.vm": "NOTE: Proceed with caution. This will cause the Instance to be reinstalled from the Template; data on the root disk will be lost. Extra data volumes, if any, will not be touched.",
39443944
"message.related.settings.changed": "'%x' has been changed. Would you like to review or update any related settings below?",
3945+
"message.related.settings.may.not.be.exhaustive": "This list of related settings may not be exhaustive. Please check the documentation for other settings that may need to be updated.",
39453946
"message.release.ip.failed": "Failed to release IP",
39463947
"message.releasing.dedicated.cluster": "Releasing dedicated Cluster...",
39473948
"message.releasing.dedicated.host": "Releasing dedicated host...",

ui/src/views/setting/ConfigurationValue.vue

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@
199199
:width="'60vw'"
200200
@cancel="closeRelatedModal">
201201
<p>{{ $t('message.related.settings.changed').replace('%x', relatedSourceConfigName) }}</p>
202+
<a-alert
203+
type="info"
204+
showIcon
205+
style="margin-bottom: 12px"
206+
:message="$t('message.related.settings.may.not.be.exhaustive')" />
202207
<a-table
203208
size="small"
204209
:showHeader="false"
@@ -396,22 +401,37 @@ export default {
396401
},
397402
fetchRelatedConfigurations (configrecord) {
398403
const prefix = this.getRelatedConfigPrefix(configrecord)
399-
if (!prefix) {
400-
return
401-
}
402-
this.relatedLoading = true
403-
const params = {
404+
const scopeParams = {
404405
[this.scopeKey]: this.$route.params?.id,
405-
keyword: prefix,
406406
pagesize: -1,
407407
listAll: true
408408
}
409-
if (this.scopeKey === 'domainid' && !params[this.scopeKey]) {
410-
params[this.scopeKey] = this.resource?.id
409+
if (this.scopeKey === 'domainid' && !scopeParams[this.scopeKey]) {
410+
scopeParams[this.scopeKey] = this.resource?.id
411+
}
412+
const requests = []
413+
if (prefix) {
414+
requests.push(
415+
getAPI('listConfigurations', { ...scopeParams, keyword: prefix }).then(json => {
416+
const list = json?.listconfigurationsresponse?.configuration || []
417+
return list.filter(c => c.name.startsWith(prefix + '.'))
418+
})
419+
)
411420
}
412-
getAPI('listConfigurations', params).then(json => {
413-
const list = json?.listconfigurationsresponse?.configuration || []
414-
this.relatedConfigs = list.filter(c => c.name !== configrecord.name && c.name.startsWith(prefix + '.'))
421+
requests.push(
422+
getAPI('listConfigurations', { ...scopeParams, parent: configrecord.name }).then(json => {
423+
return json?.listconfigurationsresponse?.configuration || []
424+
})
425+
)
426+
this.relatedLoading = true
427+
Promise.all(requests).then(results => {
428+
const merged = new Map()
429+
results.flat().forEach(c => {
430+
if (c.name !== configrecord.name) {
431+
merged.set(c.name, c)
432+
}
433+
})
434+
this.relatedConfigs = Array.from(merged.values())
415435
if (this.relatedConfigs.length > 0) {
416436
this.relatedSourceConfigName = configrecord.name
417437
this.relatedModalVisible = true

0 commit comments

Comments
 (0)