mirror of
https://github.com/home-assistant/frontend.git
synced 2026-02-04 01:10:33 -06:00
Only show panel with default visible flag in sidebar (#27838)
This commit is contained in:
parent
b2ec4b7d2c
commit
237f974ee8
@ -157,7 +157,8 @@ export const computePanels = memoizeOne(
|
||||
Object.values(panels).forEach((panel) => {
|
||||
if (
|
||||
hiddenPanels.includes(panel.url_path) ||
|
||||
(!panel.title && panel.url_path !== defaultPanel)
|
||||
(!panel.title && panel.url_path !== defaultPanel) ||
|
||||
(!panel.default_visible && !panelsOrder.includes(panel.url_path))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -102,6 +102,17 @@ class DialogEditSidebar extends LitElement {
|
||||
this.hass.locale
|
||||
);
|
||||
|
||||
// Add default hidden panels that are missing in hidden
|
||||
for (const panel of panels) {
|
||||
if (
|
||||
!panel.default_visible &&
|
||||
!this._order.includes(panel.url_path) &&
|
||||
!this._hidden.includes(panel.url_path)
|
||||
) {
|
||||
this._hidden.push(panel.url_path);
|
||||
}
|
||||
}
|
||||
|
||||
const items = [
|
||||
...beforeSpacer,
|
||||
...panels.filter((panel) => this._hidden!.includes(panel.url_path)),
|
||||
|
||||
@ -320,9 +320,9 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
|
||||
if (this.hass.panels.light) {
|
||||
result.push({
|
||||
icon: "mdi:lamps",
|
||||
icon: this.hass.panels.light.icon || "mdi:lamps",
|
||||
title: this.hass.localize("panel.light"),
|
||||
show_in_sidebar: false,
|
||||
show_in_sidebar: true,
|
||||
mode: "storage",
|
||||
url_path: "light",
|
||||
filename: "",
|
||||
@ -334,9 +334,9 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
|
||||
if (this.hass.panels.security) {
|
||||
result.push({
|
||||
icon: "mdi:security",
|
||||
icon: this.hass.panels.security.icon || "mdi:security",
|
||||
title: this.hass.localize("panel.security"),
|
||||
show_in_sidebar: false,
|
||||
show_in_sidebar: true,
|
||||
mode: "storage",
|
||||
url_path: "security",
|
||||
filename: "",
|
||||
@ -348,9 +348,9 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
|
||||
if (this.hass.panels.climate) {
|
||||
result.push({
|
||||
icon: "mdi:home-thermometer",
|
||||
icon: this.hass.panels.climate.icon || "mdi:home-thermometer",
|
||||
title: this.hass.localize("panel.climate"),
|
||||
show_in_sidebar: false,
|
||||
show_in_sidebar: true,
|
||||
mode: "storage",
|
||||
url_path: "climate",
|
||||
filename: "",
|
||||
|
||||
@ -138,6 +138,7 @@ export interface PanelInfo<T = Record<string, any> | null> {
|
||||
title: string | null;
|
||||
url_path: string;
|
||||
config_panel_domain?: string;
|
||||
default_visible?: boolean;
|
||||
}
|
||||
|
||||
export type Panels = Record<string, PanelInfo>;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user