mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Don't assume position of items in array (#7927)
This commit is contained in:
parent
9d289bfa34
commit
9988227d93
@ -128,11 +128,19 @@ class ZwaveNodeProtection extends LocalizeMixin(PolymerElement) {
|
|||||||
if (this.protection.length === 0) {
|
if (this.protection.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let options = [];
|
||||||
|
let value_id = -1;
|
||||||
|
let selected = -1;
|
||||||
|
this.protection.forEach(function (item) {
|
||||||
|
if (item.key === "options") options = item.value;
|
||||||
|
else if (item.key === "value_id") value_id = item.value;
|
||||||
|
else if (item.key === "selected") selected = item.value;
|
||||||
|
});
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
protectionNode: true,
|
protectionNode: true,
|
||||||
_protectionOptions: this.protection[0].value,
|
_protectionOptions: options,
|
||||||
_loadedProtectionValue: this.protection[1].value,
|
_loadedProtectionValue: selected,
|
||||||
_protectionValueID: this.protection[2].value,
|
_protectionValueID: value_id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user