mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Add shortcut from energy dashboard to energy settings (#18596)
This commit is contained in:
parent
860ab7a3ba
commit
5ebe1e0369
@ -7,8 +7,10 @@ import {
|
||||
html,
|
||||
nothing,
|
||||
} from "lit";
|
||||
import { mdiPencil } from "@mdi/js";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import "../../components/ha-menu-button";
|
||||
import "../../components/ha-list-item";
|
||||
import "../../components/ha-top-app-bar-fixed";
|
||||
import { LovelaceConfig } from "../../data/lovelace/config/types";
|
||||
import { haStyle } from "../../resources/styles";
|
||||
@ -16,6 +18,7 @@ import { HomeAssistant } from "../../types";
|
||||
import "../lovelace/components/hui-energy-period-selector";
|
||||
import { Lovelace } from "../lovelace/types";
|
||||
import "../lovelace/views/hui-view";
|
||||
import { navigate } from "../../common/navigate";
|
||||
|
||||
const ENERGY_LOVELACE_CONFIG: LovelaceConfig = {
|
||||
views: [
|
||||
@ -71,7 +74,21 @@ class PanelEnergy extends LitElement {
|
||||
<hui-energy-period-selector
|
||||
.hass=${this.hass}
|
||||
collectionKey="energy_dashboard"
|
||||
></hui-energy-period-selector>
|
||||
>
|
||||
${this.hass.user?.is_admin
|
||||
? html`
|
||||
<ha-list-item
|
||||
slot="overflow-menu"
|
||||
graphic="icon"
|
||||
@request-selected=${this._navigateConfig}
|
||||
>
|
||||
<ha-svg-icon slot="graphic" .path=${mdiPencil}>
|
||||
</ha-svg-icon>
|
||||
${this.hass!.localize("ui.panel.energy.configure")}
|
||||
</ha-list-item>
|
||||
`
|
||||
: nothing}
|
||||
</hui-energy-period-selector>
|
||||
</div>
|
||||
</div>
|
||||
<hui-view
|
||||
@ -100,6 +117,11 @@ class PanelEnergy extends LitElement {
|
||||
};
|
||||
}
|
||||
|
||||
private _navigateConfig(ev) {
|
||||
ev.stopPropagation();
|
||||
navigate("/config/energy?historyBack=1");
|
||||
}
|
||||
|
||||
private _reloadView() {
|
||||
// Force strategy to be re-run by make a copy of the view
|
||||
const config = this._lovelace!.config;
|
||||
|
@ -278,6 +278,7 @@ export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) {
|
||||
"ui.panel.lovelace.components.energy_period_selector.compare"
|
||||
)}
|
||||
</ha-check-list-item>
|
||||
<slot name="overflow-menu"></slot>
|
||||
</ha-button-menu>
|
||||
</div>
|
||||
`;
|
||||
|
@ -6069,6 +6069,7 @@
|
||||
}
|
||||
},
|
||||
"energy": {
|
||||
"configure": "[%key:ui::dialogs::quick-bar::commands::navigation::energy%]",
|
||||
"compare": {
|
||||
"info": "You are comparing the period {start} with the period {end}"
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user