Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:home-assistant/frontend into combine…
Browse files Browse the repository at this point in the history
…-component(s)-entries
  • Loading branch information
ludeeus committed Feb 27, 2024
2 parents 2a8b12d + 29954e5 commit b0614dd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/common/config/can_show_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ import { isComponentLoaded } from "./is_component_loaded";

export const canShowPage = (hass: HomeAssistant, page: PageNavigation) =>
(isCore(page) || isLoadedIntegration(hass, page)) &&
!hideAdvancedPage(hass, page);
!hideAdvancedPage(hass, page) &&
isNotLoadedIntegration(hass, page);

const isLoadedIntegration = (hass: HomeAssistant, page: PageNavigation) =>
!page.component ||
ensureArray(page.component).some((integration) =>
isComponentLoaded(hass, integration)
);

const isNotLoadedIntegration = (hass: HomeAssistant, page: PageNavigation) =>
!page.not_component ||
!ensureArray(page.not_component).some((integration) =>
isComponentLoaded(hass, integration)
);

const isCore = (page: PageNavigation) => page.core;
const isAdvancedPage = (page: PageNavigation) => page.advancedOnly;
const userWantsAdvanced = (hass: HomeAssistant) => hass.userData?.showAdvanced;
Expand Down
1 change: 1 addition & 0 deletions src/layouts/hass-tabs-subpage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface PageNavigation {
translationKey?: string;
component?: string | string[];
name?: string;
not_component?: string | string[];
core?: boolean;
advancedOnly?: boolean;
iconPath?: string;
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/ha-panel-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ export const configSections: { [name: string]: PageNavigation[] } = {
iconPath: mdiBackupRestore,
iconColor: "#0D47A1",
component: "backup",
not_component: "hassio",
},
{
path: "/hassio/backups",
Expand Down

0 comments on commit b0614dd

Please sign in to comment.