mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 02:06:42 +00:00
Lovelace: entity-filter: hide card when entities[] empty (#1373)
* Implements https://github.com/home-assistant/ui-schema/issues/48 Fixed lint * Updates based on review Reset display on new config Fixed reset as setConfig was not being called Fixed lint
This commit is contained in:
parent
76256699e0
commit
e410274684
@ -79,10 +79,16 @@ class HuiEntitiesCard extends PolymerElement {
|
|||||||
|
|
||||||
_updateCardConfig(element) {
|
_updateCardConfig(element) {
|
||||||
if (!element || element.tagName === 'HUI-ERROR-CARD' || !this.hass) return;
|
if (!element || element.tagName === 'HUI-ERROR-CARD' || !this.hass) return;
|
||||||
|
const entitiesList = this._getEntities(this.hass, this._config.filter);
|
||||||
|
if (entitiesList.length === 0) {
|
||||||
|
this.style.display = (this._config.show_empty === false) ? 'none' : 'block';
|
||||||
|
} else {
|
||||||
|
this.style.display = 'block';
|
||||||
|
}
|
||||||
element.setConfig(Object.assign(
|
element.setConfig(Object.assign(
|
||||||
{},
|
{},
|
||||||
element._filterRawConfig,
|
element._filterRawConfig,
|
||||||
{ entities: this._getEntities(this.hass, this._config.filter) }
|
{ entities: entitiesList }
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user