Changed 'ConfigDescriptionParameterDTO' field serialization 'defaultValue' -> 'default' (#1077)
Related to openhab/openhab-core#2383. Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>pull/1093/head
parent
9ac085ffae
commit
299fc5cd7b
|
@ -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
|
||||
},
|
||||
|
|
|
@ -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') {
|
||||
|
|
|
@ -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 || {})
|
||||
|
|
Loading…
Reference in New Issue