mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Hide the core backup integration if hassio is loaded (#19833)
* Hide the core backup integration if hassio is loaded * Combine to single entry
This commit is contained in:
parent
fb3c94f403
commit
29954e530e
@ -1,10 +1,12 @@
|
|||||||
import { PageNavigation } from "../../layouts/hass-tabs-subpage";
|
import { PageNavigation } from "../../layouts/hass-tabs-subpage";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
|
import { ensureArray } from "../array/ensure-array";
|
||||||
import { isComponentLoaded } from "./is_component_loaded";
|
import { isComponentLoaded } from "./is_component_loaded";
|
||||||
|
|
||||||
export const canShowPage = (hass: HomeAssistant, page: PageNavigation) =>
|
export const canShowPage = (hass: HomeAssistant, page: PageNavigation) =>
|
||||||
(isCore(page) || isLoadedIntegration(hass, page)) &&
|
(isCore(page) || isLoadedIntegration(hass, page)) &&
|
||||||
!hideAdvancedPage(hass, page);
|
!hideAdvancedPage(hass, page) &&
|
||||||
|
isNotLoadedIntegration(hass, page);
|
||||||
|
|
||||||
const isLoadedIntegration = (hass: HomeAssistant, page: PageNavigation) =>
|
const isLoadedIntegration = (hass: HomeAssistant, page: PageNavigation) =>
|
||||||
page.component
|
page.component
|
||||||
@ -14,6 +16,13 @@ const isLoadedIntegration = (hass: HomeAssistant, page: PageNavigation) =>
|
|||||||
isComponentLoaded(hass, integration)
|
isComponentLoaded(hass, integration)
|
||||||
)
|
)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
|
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 isCore = (page: PageNavigation) => page.core;
|
||||||
const isAdvancedPage = (page: PageNavigation) => page.advancedOnly;
|
const isAdvancedPage = (page: PageNavigation) => page.advancedOnly;
|
||||||
const userWantsAdvanced = (hass: HomeAssistant) => hass.userData?.showAdvanced;
|
const userWantsAdvanced = (hass: HomeAssistant) => hass.userData?.showAdvanced;
|
||||||
|
@ -26,6 +26,7 @@ export interface PageNavigation {
|
|||||||
component?: string;
|
component?: string;
|
||||||
components?: string[];
|
components?: string[];
|
||||||
name?: string;
|
name?: string;
|
||||||
|
not_component?: string | string[];
|
||||||
core?: boolean;
|
core?: boolean;
|
||||||
advancedOnly?: boolean;
|
advancedOnly?: boolean;
|
||||||
iconPath?: string;
|
iconPath?: string;
|
||||||
|
@ -309,6 +309,7 @@ export const configSections: { [name: string]: PageNavigation[] } = {
|
|||||||
iconPath: mdiBackupRestore,
|
iconPath: mdiBackupRestore,
|
||||||
iconColor: "#0D47A1",
|
iconColor: "#0D47A1",
|
||||||
component: "backup",
|
component: "backup",
|
||||||
|
not_component: "hassio",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/hassio/backups",
|
path: "/hassio/backups",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user