Skip to content

Commit 01d7c6e

Browse files
clean up config values
1 parent 8ad0dc1 commit 01d7c6e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ui/src/views/setting/ConfigurationValue.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,15 @@ export default {
275275
if (configrecord.type === 'WhitespaceSeparatedListWithOptions') {
276276
newValue = newValue.join(' ')
277277
}
278+
279+
// The updateConfiguration API expects a blank string to clean up the configuration value
280+
if (
281+
(['CSV', 'Order', 'WhitespaceSeparatedListWithOptions'].includes(configrecord.type) && Object.keys(newValue).length === 0) ||
282+
(configrecord.type === 'String' && newValue.length === 0)
283+
) {
284+
newValue = ' '
285+
}
286+
278287
const params = {
279288
[this.scopeKey]: this.$route.params?.id,
280289
name: configrecord.name,
@@ -362,6 +371,17 @@ export default {
362371
}
363372
return 0
364373
}
374+
375+
if (configrecord.value?.trim().length === 0) {
376+
if (['CSV', 'Order', 'WhitespaceSeparatedListWithOptions'].includes(configrecord.type)) {
377+
return []
378+
}
379+
380+
if (configrecord.type === 'String') {
381+
return ''
382+
}
383+
}
384+
365385
if (['Order', 'CSV'].includes(configrecord.type)) {
366386
if (configrecord.value && configrecord.value.length > 0) {
367387
return String(configrecord.value).split(',')

0 commit comments

Comments
 (0)