mirror of
https://github.com/home-assistant/frontend.git
synced 2025-06-23 10:36:35 +00:00
Fix nested group more info (#788)
This commit is contained in:
parent
ea16ebd4f0
commit
7231976af6
@ -66,33 +66,31 @@ class MoreInfoGroup extends Polymer.Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
statesChanged(stateObj, states) {
|
statesChanged(stateObj, states) {
|
||||||
var groupDomainStateObj = false;
|
let groupDomainStateObj = false;
|
||||||
var baseStateObj;
|
|
||||||
var i;
|
|
||||||
var state;
|
|
||||||
var el;
|
|
||||||
|
|
||||||
if (states && states.length > 0) {
|
if (states && states.length > 0) {
|
||||||
baseStateObj = states.find(s => s.state === 'on') || states[0];
|
const baseStateObj = states.find(s => s.state === 'on') || states[0];
|
||||||
|
const groupDomain = window.hassUtil.computeDomain(baseStateObj);
|
||||||
|
|
||||||
|
// Groups need to be filtered out or we'll show content of
|
||||||
|
// first child above the children of the current group
|
||||||
|
if (groupDomain !== 'group') {
|
||||||
groupDomainStateObj = Object.assign({}, baseStateObj, {
|
groupDomainStateObj = Object.assign({}, baseStateObj, {
|
||||||
entity_id: stateObj.entity_id,
|
entity_id: stateObj.entity_id,
|
||||||
attributes: Object.assign({}, baseStateObj.attributes)
|
attributes: Object.assign({}, baseStateObj.attributes)
|
||||||
});
|
});
|
||||||
var groupDomain = window.hassUtil.computeDomain(groupDomainStateObj);
|
|
||||||
|
|
||||||
for (i = 0; i < states.length; i++) {
|
for (let i = 0; i < states.length; i++) {
|
||||||
state = states[i];
|
if (groupDomain !== window.hassUtil.computeDomain(states[i])) {
|
||||||
|
|
||||||
if (groupDomain !== window.hassUtil.computeDomain(state)) {
|
|
||||||
groupDomainStateObj = false;
|
groupDomainStateObj = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!groupDomainStateObj) {
|
if (!groupDomainStateObj) {
|
||||||
el = Polymer.dom(this.$.groupedControlDetails);
|
const el = Polymer.dom(this.$.groupedControlDetails);
|
||||||
if (el.lastChild) {
|
if (el.lastChild) {
|
||||||
el.removeChild(el.lastChild);
|
el.removeChild(el.lastChild);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user