From 299fc5cd7b9ce11de5d90ea655edb24366662f3a Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Wed, 2 Jun 2021 12:36:09 +0200 Subject: [PATCH] Changed 'ConfigDescriptionParameterDTO' field serialization 'defaultValue' -> 'default' (#1077) Related to openhab/openhab-core#2383. Signed-off-by: Christoph Weitkamp --- .../org.openhab.ui/web/src/components/config/config-sheet.vue | 2 +- .../web/src/components/item/metadata/item-metadata-widget.vue | 4 ++-- .../org.openhab.ui/web/src/components/widgets/widget-mixin.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/config/config-sheet.vue b/bundles/org.openhab.ui/web/src/components/config/config-sheet.vue index 99e4be801e..c03fcd8e27 100644 --- a/bundles/org.openhab.ui/web/src/components/config/config-sheet.vue +++ b/bundles/org.openhab.ui/web/src/components/config/config-sheet.vue @@ -85,7 +85,7 @@ export default { configurationWithDefaults () { let conf = Object.assign({}, this.configuration) this.parameters.forEach((p) => { - if (conf[p.name] === undefined && p.defaultValue !== undefined) conf[p.name] = p.defaultValue + if (conf[p.name] === undefined && p.default !== undefined) conf[p.name] = p.default }) return conf }, diff --git a/bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-widget.vue b/bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-widget.vue index 0627dc04ae..c591d25eb8 100644 --- a/bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-widget.vue +++ b/bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-widget.vue @@ -186,12 +186,12 @@ export default { // for the default system-suggested widget, take the default config and put it as default value for (const key in this.defaultComponent.config) { const parameter = desc.parameters.find((p) => p.name === key) - if (parameter) parameter.defaultValue = this.defaultComponent.config[key] + if (parameter) parameter.default = this.defaultComponent.config[key] } } else { // for user-specified widgets, set a default value for the 'item' parameter only const itemParameter = desc.parameters.find((p) => p.name === 'item') - if (itemParameter) itemParameter.defaultValue = this.item.name + if (itemParameter) itemParameter.default = this.item.name } if (!desc.parameterGroups.length || desc.parameterGroups[desc.parameterGroups.length - 1].name !== 'visibility') { diff --git a/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js b/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js index 7374033901..3928fe6a63 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js @@ -58,8 +58,8 @@ export default { if (this.context.component.props && this.context.component.props.parameters) { let defaultValues = {} this.context.component.props.parameters.forEach((p) => { - if (p.defaultValue !== undefined) { - defaultValues[p.name] = p.defaultValue + if (p.default !== undefined) { + defaultValues[p.name] = p.default } }) return Object.assign({}, defaultValues, this.context.props || {})