Skip to content

Commit

Permalink
Fix select view dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
karwosts committed Jan 3, 2024
1 parent fe18f70 commit c241977
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 15 additions & 5 deletions src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,15 @@ export class HuiDialogSelectView extends LitElement {
})}
</ha-select>`
: ""}
${this._config
? this._config.views.length > 1
${!this._config || (this._config.views || []).length < 1
? html`<ha-alert alert-type="error"
>${this.hass.localize(
this._config
? "ui.panel.lovelace.editor.select_view.no_views"
: "ui.panel.lovelace.editor.select_view.no_config"
)}</ha-alert
>`
: this._config.views.length > 1
? html`
<mwc-list dialogInitialFocus>
${this._config.views.map(
Expand All @@ -125,16 +132,19 @@ export class HuiDialogSelectView extends LitElement {
)}
</mwc-list>
`
: ""
: html`<div>No config found.</div>`}
: ""}
<mwc-button
slot="secondaryAction"
@click=${this.closeDialog}
dialogInitialFocus
>
${this.hass!.localize("ui.common.cancel")}
</mwc-button>
<mwc-button slot="primaryAction" @click=${this._selectView}>
<mwc-button
slot="primaryAction"
.disabled=${!this._config || (this._config.views || []).length < 1}
@click=${this._selectView}
>
${this._params.actionLabel || this.hass!.localize("ui.common.move")}
</mwc-button>
</ha-dialog>
Expand Down
4 changes: 3 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit c241977

Please sign in to comment.