mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Restore energy config in quickbar (#11391)
This commit is contained in:
parent
14e5b2a7a5
commit
d4646bac01
@ -573,23 +573,29 @@ export class QuickBar extends LitElement {
|
|||||||
|
|
||||||
for (const sectionKey of Object.keys(configSections)) {
|
for (const sectionKey of Object.keys(configSections)) {
|
||||||
for (const page of configSections[sectionKey]) {
|
for (const page of configSections[sectionKey]) {
|
||||||
if (canShowPage(this.hass, page)) {
|
if (!canShowPage(this.hass, page)) {
|
||||||
if (page.component) {
|
continue;
|
||||||
|
}
|
||||||
|
if (!page.component) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const info = this._getNavigationInfoFromConfig(page);
|
const info = this._getNavigationInfoFromConfig(page);
|
||||||
|
|
||||||
|
if (!info) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Add to list, but only if we do not already have an entry for the same path and component
|
// Add to list, but only if we do not already have an entry for the same path and component
|
||||||
if (
|
if (
|
||||||
info &&
|
items.some(
|
||||||
!items.some(
|
|
||||||
(e) => e.path === info.path && e.component === info.component
|
(e) => e.path === info.path && e.component === info.component
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
items.push(info);
|
items.push(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
@ -597,7 +603,9 @@ export class QuickBar extends LitElement {
|
|||||||
private _getNavigationInfoFromConfig(
|
private _getNavigationInfoFromConfig(
|
||||||
page: PageNavigation
|
page: PageNavigation
|
||||||
): NavigationInfo | undefined {
|
): NavigationInfo | undefined {
|
||||||
if (page.component) {
|
if (!page.component) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
const caption = this.hass.localize(
|
const caption = this.hass.localize(
|
||||||
`ui.dialogs.quick-bar.commands.navigation.${page.component}`
|
`ui.dialogs.quick-bar.commands.navigation.${page.component}`
|
||||||
);
|
);
|
||||||
@ -605,7 +613,6 @@ export class QuickBar extends LitElement {
|
|||||||
if (page.translationKey && caption) {
|
if (page.translationKey && caption) {
|
||||||
return { ...page, primaryText: caption };
|
return { ...page, primaryText: caption };
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
mdiDevices,
|
mdiDevices,
|
||||||
mdiHomeAssistant,
|
mdiHomeAssistant,
|
||||||
mdiInformation,
|
mdiInformation,
|
||||||
|
mdiLightningBolt,
|
||||||
mdiMapMarkerRadius,
|
mdiMapMarkerRadius,
|
||||||
mdiMathLog,
|
mdiMathLog,
|
||||||
mdiNfcVariant,
|
mdiNfcVariant,
|
||||||
@ -192,6 +193,16 @@ export const configSections: { [name: string]: PageNavigation[] } = {
|
|||||||
iconColor: "#616161",
|
iconColor: "#616161",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
// Not used as a tab, but this way it will stay in the quick bar
|
||||||
|
energy: [
|
||||||
|
{
|
||||||
|
component: "energy",
|
||||||
|
path: "/config/energy",
|
||||||
|
translationKey: "ui.panel.config.energy.caption",
|
||||||
|
iconPath: mdiLightningBolt,
|
||||||
|
iconColor: "#F1C447",
|
||||||
|
},
|
||||||
|
],
|
||||||
lovelace: [
|
lovelace: [
|
||||||
{
|
{
|
||||||
component: "lovelace",
|
component: "lovelace",
|
||||||
|
@ -616,7 +616,7 @@
|
|||||||
"person": "[%key:ui::panel::config::person::caption%]",
|
"person": "[%key:ui::panel::config::person::caption%]",
|
||||||
"devices": "[%key:ui::panel::config::devices::caption%]",
|
"devices": "[%key:ui::panel::config::devices::caption%]",
|
||||||
"entities": "[%key:ui::panel::config::entities::caption%]",
|
"entities": "[%key:ui::panel::config::entities::caption%]",
|
||||||
"energy": "[%key:ui::panel::config::energy::caption%]",
|
"energy": "Energy Configuration",
|
||||||
"lovelace": "[%key:ui::panel::config::lovelace::caption%]",
|
"lovelace": "[%key:ui::panel::config::lovelace::caption%]",
|
||||||
"core": "[%key:ui::panel::config::core::caption%]",
|
"core": "[%key:ui::panel::config::core::caption%]",
|
||||||
"zone": "[%key:ui::panel::config::zone::caption%]",
|
"zone": "[%key:ui::panel::config::zone::caption%]",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user