Review fix

This commit is contained in:
Zack Arnett 2018-10-21 19:05:56 -04:00
parent 772153e58a
commit 56e01e66fb

View File

@ -36,31 +36,21 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement)
protected config?: Config; protected config?: Config;
protected configEntities?: EntityConfig[]; protected configEntities?: EntityConfig[];
// set hass(hass) { set hass(hass) {
// console.log("here"); this._hass = hass;
// this._hass = hass; if (this.shadowRoot && this.shadowRoot.querySelector("ha-card")) {
this.shadowRoot
// console.log(this.shadowRoot); .querySelector("ha-card")!
// console.log( .querySelectorAll("#states > div > *")
// this.shadowRoot && this.shadowRoot.querySelector("ha-card") .forEach((element: any) => {
// ? this.shadowRoot element.hass = hass;
// .querySelector("ha-card")! });
// .querySelectorAll("#states > div > *") }
// : "" }
// );
// if (this.shadowRoot && this.shadowRoot.querySelector("ha-card")) {
// this.shadowRoot
// .querySelector("ha-card")!
// .querySelectorAll("#states > div > *")
// .forEach((element: any) => {
// element.hass = hass;
// });
// }
// }
static get properties(): PropertyDeclarations { static get properties(): PropertyDeclarations {
return { return {
hass: {}, _hass: {},
config: {}, config: {},
}; };
} }
@ -74,8 +64,6 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement)
} }
public setConfig(config: Config) { public setConfig(config: Config) {
console.log(config);
const entities = processConfigEntities(config.entities); const entities = processConfigEntities(config.entities);
for (const entity of entities) { for (const entity of entities) {
if ( if (
@ -100,7 +88,7 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement)
} }
protected render() { protected render() {
if (!this.config || !this.hass) { if (!this.config || !this._hass) {
return html``; return html``;
} }
const { show_header_toggle, title } = this.config; const { show_header_toggle, title } = this.config;
@ -119,7 +107,7 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement)
? html`` ? html``
: html` : html`
<hui-entities-toggle <hui-entities-toggle
.hass="${this.hass}" .hass="${this._hass}"
.entities="${this.configEntities!.map( .entities="${this.configEntities!.map(
(conf) => conf.entity (conf) => conf.entity
)}" )}"
@ -174,7 +162,7 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement)
private renderEntity(entityConf) { private renderEntity(entityConf) {
const element = createRowElement(entityConf); const element = createRowElement(entityConf);
element.hass = this.hass; element.hass = this._hass;
element.entityConf = entityConf; element.entityConf = entityConf;
if ( if (
entityConf.entity && entityConf.entity &&