Changed 'ConfigDescriptionParameterDTO' field serialization 'defaultValue' -> 'default' (#1077)

Related to openhab/openhab-core#2383.

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
pull/1093/head
Christoph Weitkamp 2021-06-02 12:36:09 +02:00 committed by GitHub
parent 9ac085ffae
commit 299fc5cd7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -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
},

View File

@ -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') {

View File

@ -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 || {})