Skip to content

Commit

Permalink
Changed 'ConfigDescriptionParameterDTO' field serialization 'defaultV…
Browse files Browse the repository at this point in the history
…alue' -> 'default' (#1077)

Related to openhab/openhab-core#2383.

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
  • Loading branch information
cweitkamp authored Jun 2, 2021
1 parent 9ac085f commit 299fc5c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {})
Expand Down

0 comments on commit 299fc5c

Please sign in to comment.