mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix pick dashboard row (#14708)
This commit is contained in:
parent
348c3c9787
commit
467957005d
@ -13,7 +13,7 @@ class HaPickDashboardRow extends LitElement {
|
|||||||
|
|
||||||
@property() public narrow!: boolean;
|
@property() public narrow!: boolean;
|
||||||
|
|
||||||
@state() private _dashboards: LovelaceDashboard[] = [];
|
@state() private _dashboards?: LovelaceDashboard[];
|
||||||
|
|
||||||
protected firstUpdated(changedProps: PropertyValues) {
|
protected firstUpdated(changedProps: PropertyValues) {
|
||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
@ -29,30 +29,37 @@ class HaPickDashboardRow extends LitElement {
|
|||||||
<span slot="description">
|
<span slot="description">
|
||||||
${this.hass.localize("ui.panel.profile.dashboard.description")}
|
${this.hass.localize("ui.panel.profile.dashboard.description")}
|
||||||
</span>
|
</span>
|
||||||
<ha-select
|
${this._dashboards
|
||||||
.label=${this.hass.localize(
|
? html`<ha-select
|
||||||
"ui.panel.profile.dashboard.dropdown_label"
|
.label=${this.hass.localize(
|
||||||
)}
|
"ui.panel.profile.dashboard.dropdown_label"
|
||||||
.disabled=${!this._dashboards.length}
|
)}
|
||||||
.value=${this.hass.defaultPanel}
|
.disabled=${!this._dashboards?.length}
|
||||||
@selected=${this._dashboardChanged}
|
.value=${this.hass.defaultPanel}
|
||||||
>
|
@selected=${this._dashboardChanged}
|
||||||
<mwc-list-item value="lovelace">
|
>
|
||||||
${this.hass.localize(
|
<mwc-list-item value="lovelace">
|
||||||
"ui.panel.profile.dashboard.default_dashboard_label"
|
${this.hass.localize(
|
||||||
)}
|
"ui.panel.profile.dashboard.default_dashboard_label"
|
||||||
</mwc-list-item>
|
)}
|
||||||
${this._dashboards.map((dashboard) => {
|
|
||||||
if (!this.hass.user!.is_admin && dashboard.require_admin) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return html`
|
|
||||||
<mwc-list-item .value=${dashboard.url_path}>
|
|
||||||
${dashboard.title}
|
|
||||||
</mwc-list-item>
|
</mwc-list-item>
|
||||||
`;
|
${this._dashboards.map((dashboard) => {
|
||||||
})}
|
if (!this.hass.user!.is_admin && dashboard.require_admin) {
|
||||||
</ha-select>
|
return "";
|
||||||
|
}
|
||||||
|
return html`
|
||||||
|
<mwc-list-item .value=${dashboard.url_path}>
|
||||||
|
${dashboard.title}
|
||||||
|
</mwc-list-item>
|
||||||
|
`;
|
||||||
|
})}
|
||||||
|
</ha-select>`
|
||||||
|
: html`<ha-select
|
||||||
|
.label=${this.hass.localize(
|
||||||
|
"ui.panel.profile.dashboard.dropdown_label"
|
||||||
|
)}
|
||||||
|
disabled
|
||||||
|
></ha-select>`}
|
||||||
</ha-settings-row>
|
</ha-settings-row>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user