From 36bb45758b4aa2129e33bbb646d8131a3b69247b Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Thu, 1 Nov 2018 16:09:25 -0500 Subject: [PATCH 1/3] New warning row for non-existent entities --- .../entity-rows/hui-error-entity-row.ts | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/panels/lovelace/entity-rows/hui-error-entity-row.ts diff --git a/src/panels/lovelace/entity-rows/hui-error-entity-row.ts b/src/panels/lovelace/entity-rows/hui-error-entity-row.ts new file mode 100644 index 000000000000..31746974dab3 --- /dev/null +++ b/src/panels/lovelace/entity-rows/hui-error-entity-row.ts @@ -0,0 +1,45 @@ +import { html, LitElement } from "@polymer/lit-element"; +import { TemplateResult } from "lit-html"; + +class HuiErrorEntityRow extends LitElement { + public entity?: string; + + static get properties() { + return { + entity: {}, + }; + } + + protected render(): TemplateResult { + if (!this.entity) { + return html``; + } + + return html` + ${this.renderStyle()} +
+ Entity not available: ${this.entity} +
+ `; + } + + private renderStyle(): TemplateResult { + return html` + + `; + } +} + +declare global { + interface HTMLElementTagNameMap { + "hui-error-entity-row": HuiErrorEntityRow; + } +} + +customElements.define("hui-error-entity-row", HuiErrorEntityRow); From d43cad07b38eae8d2a1a7b94b61d934249d73b44 Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Thu, 1 Nov 2018 20:20:34 -0500 Subject: [PATCH 2/3] Update src/panels/lovelace/entity-rows/hui-error-entity-row.ts --- src/panels/lovelace/entity-rows/hui-error-entity-row.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/panels/lovelace/entity-rows/hui-error-entity-row.ts b/src/panels/lovelace/entity-rows/hui-error-entity-row.ts index 31746974dab3..f4264d104435 100644 --- a/src/panels/lovelace/entity-rows/hui-error-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-error-entity-row.ts @@ -18,7 +18,7 @@ class HuiErrorEntityRow extends LitElement { return html` ${this.renderStyle()}
- Entity not available: ${this.entity} + Entity not available: ${this.entity || ""}
`; } @@ -26,8 +26,8 @@ class HuiErrorEntityRow extends LitElement { private renderStyle(): TemplateResult { return html`