From c241977f1ef74140daf68cf92edce56bb028cc48 Mon Sep 17 00:00:00 2001 From: karwosts Date: Wed, 3 Jan 2024 10:58:07 -0800 Subject: [PATCH 1/2] Fix select view dialog --- .../select-view/hui-dialog-select-view.ts | 20 ++++++++++++++----- src/translations/en.json | 4 +++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts b/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts index 6a9c8eb04fdc..14691e929e81 100644 --- a/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts +++ b/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts @@ -104,8 +104,15 @@ export class HuiDialogSelectView extends LitElement { })} ` : ""} - ${this._config - ? this._config.views.length > 1 + ${!this._config || (this._config.views || []).length < 1 + ? html`${this.hass.localize( + this._config + ? "ui.panel.lovelace.editor.select_view.no_views" + : "ui.panel.lovelace.editor.select_view.no_config" + )}` + : this._config.views.length > 1 ? html` ${this._config.views.map( @@ -125,8 +132,7 @@ export class HuiDialogSelectView extends LitElement { )} ` - : "" - : html`
No config found.
`} + : ""} ${this.hass!.localize("ui.common.cancel")} - + ${this._params.actionLabel || this.hass!.localize("ui.common.move")} diff --git a/src/translations/en.json b/src/translations/en.json index be18b476ad29..0779e27820c7 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -5017,7 +5017,9 @@ "select_view": { "header": "Choose a view", "dashboard_label": "Dashboard", - "views_label": "View" + "views_label": "View", + "no_config": "No config found.", + "no_views": "No views in this dashboard." }, "suggest_card": { "header": "We created a suggestion for you", From a9649b2b2d832d076917479a95fb9a78adb11427 Mon Sep 17 00:00:00 2001 From: karwosts Date: Wed, 3 Jan 2024 11:10:17 -0800 Subject: [PATCH 2/2] add import --- src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts b/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts index 14691e929e81..5f3e073f3a4f 100644 --- a/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts +++ b/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts @@ -8,6 +8,7 @@ import { stopPropagation } from "../../../../common/dom/stop_propagation"; import { createCloseHeading } from "../../../../components/ha-dialog"; import "../../../../components/ha-icon"; import "../../../../components/ha-select"; +import "../../../../components/ha-alert"; import { fetchConfig, LovelaceConfig,