Add navigation to dashboard & resources to lovelace editor + icons (#8156)

This commit is contained in:
Philip Allgaier 2021-01-27 12:37:28 +01:00 committed by GitHub
parent 8d0608610f
commit 5f003ccbe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 2 deletions

View File

@ -3,8 +3,11 @@ import "@material/mwc-list/mwc-list-item";
import type { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item";
import {
mdiClose,
mdiCodeBraces,
mdiCog,
mdiDotsVertical,
mdiFileMultiple,
mdiFormatListBulletedTriangle,
mdiHelp,
mdiHelpCircle,
mdiMicrophone,
@ -12,6 +15,7 @@ import {
mdiPlus,
mdiRefresh,
mdiShape,
mdiViewDashboard,
} from "@mdi/js";
import "@polymer/app-layout/app-header/app-header";
import "@polymer/app-layout/app-scroll-effects/effects/waterfall";
@ -169,17 +173,54 @@ class HUIRoot extends LitElement {
? ""
: html`
<mwc-list-item
graphic="icon"
aria-label=${this.hass!.localize(
"ui.panel.lovelace.unused_entities.title"
)}
@request-selected="${this._handleUnusedEntities}"
>
<ha-svg-icon
slot="graphic"
.path=${mdiFormatListBulletedTriangle}
>
</ha-svg-icon>
${this.hass!.localize(
"ui.panel.lovelace.unused_entities.title"
)}
</mwc-list-item>
`}
<mwc-list-item @request-selected="${this._handleRawEditor}">
<mwc-list-item
graphic="icon"
@request-selected="${this._handleManageDashboards}"
>
<ha-svg-icon
slot="graphic"
.path=${mdiViewDashboard}
></ha-svg-icon>
${this.hass!.localize(
"ui.panel.lovelace.editor.menu.manage_dashboards"
)}
</mwc-list-item>
<mwc-list-item
graphic="icon"
@request-selected="${this._handleManageResources}"
>
<ha-svg-icon
slot="graphic"
.path=${mdiFileMultiple}
></ha-svg-icon>
${this.hass!.localize(
"ui.panel.lovelace.editor.menu.manage_resources"
)}
</mwc-list-item>
<mwc-list-item
graphic="icon"
@request-selected="${this._handleRawEditor}"
>
<ha-svg-icon
slot="graphic"
.path=${mdiCodeBraces}
></ha-svg-icon>
${this.hass!.localize(
"ui.panel.lovelace.editor.menu.raw_editor"
)}
@ -626,6 +667,22 @@ class HUIRoot extends LitElement {
this.lovelace!.enableFullEditMode();
}
private _handleManageDashboards(
ev: CustomEvent<RequestSelectedDetail>
): void {
if (!shouldHandleRequestSelectedEvent(ev)) {
return;
}
navigate(this, "/config/lovelace/dashboards");
}
private _handleManageResources(ev: CustomEvent<RequestSelectedDetail>): void {
if (!shouldHandleRequestSelectedEvent(ev)) {
return;
}
navigate(this, "/config/lovelace/resources");
}
private _handleUnusedEntities(ev: CustomEvent<RequestSelectedDetail>): void {
if (!shouldHandleRequestSelectedEvent(ev)) {
return;

View File

@ -2567,7 +2567,9 @@
"header": "Edit UI",
"menu": {
"open": "Open Lovelace UI menu",
"raw_editor": "Raw configuration editor"
"raw_editor": "Raw configuration editor",
"manage_dashboards": "Manage dashboards",
"manage_resources": "Manage resources"
},
"common": {
"edit": "Edit",