Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/ha-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
11 changes: 11 additions & 0 deletions src/dialogs/sidebar/dialog-edit-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
Expand All @@ -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: "",
Expand All @@ -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: "",
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
Loading