Move energy to Dashboards (#11386)

This commit is contained in:
Zack Barett 2022-01-21 15:30:24 -06:00 committed by GitHub
parent 05d7e85aa3
commit e51a819bfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 18 deletions

View File

@ -73,7 +73,7 @@ class HaConfigEnergy extends LitElement {
.narrow=${this.narrow}
.backPath=${this._searchParms.has("historyBack")
? undefined
: "/config"}
: "/config/lovelace/dashboards"}
.header=${this.hass.localize("ui.panel.config.energy.caption")}
>
<ha-alert>

View File

@ -6,7 +6,6 @@ import {
mdiDevices,
mdiHomeAssistant,
mdiInformation,
mdiLightningBolt,
mdiMapMarkerRadius,
mdiMathLog,
mdiNfcVariant,
@ -82,13 +81,6 @@ export const configSections: { [name: string]: PageNavigation[] } = {
iconColor: "#B1345C",
component: "lovelace",
},
{
path: "/config/energy",
translationKey: "energy",
iconPath: mdiLightningBolt,
iconColor: "#F1C447",
component: "energy",
},
{
path: "/config/tags",
translationKey: "tags",
@ -200,15 +192,6 @@ export const configSections: { [name: string]: PageNavigation[] } = {
iconColor: "#616161",
},
],
energy: [
{
component: "energy",
path: "/config/energy",
translationKey: "ui.panel.config.energy.caption",
iconPath: mdiLightningBolt,
iconColor: "#F1C447",
},
],
lovelace: [
{
component: "lovelace",

View File

@ -194,6 +194,12 @@ export class HaConfigLovelaceDashboards extends LitElement {
mode: defaultMode,
filename: defaultMode === "yaml" ? "ui-lovelace.yaml" : "",
},
{
icon: "hass:lightning-bolt",
title: this.hass.localize(`ui.panel.config.dashboard.energy.title`),
url_path: "energy",
filename: "",
},
...dashboards.map((dashboard) => ({
filename: "",
...dashboard,
@ -255,6 +261,11 @@ export class HaConfigLovelaceDashboards extends LitElement {
private _editDashboard(ev: CustomEvent) {
const urlPath = (ev.detail as RowClickedEvent).id;
if (urlPath === "energy") {
navigate("/config/energy");
return;
}
const dashboard = this._dashboards.find((res) => res.url_path === urlPath);
this._openDialog(dashboard, urlPath);
}