mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-15 21:36:36 +00:00
Merge branch 'master' into dev
This commit is contained in:
commit
c5fe5565bb
4
src/data/external.ts
Normal file
4
src/data/external.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export const isExternal =
|
||||
window.externalApp ||
|
||||
window.webkit?.messageHandlers?.getExternalAuth ||
|
||||
location.search.includes("external_auth=1");
|
@ -10,6 +10,7 @@ import {
|
||||
} from "home-assistant-js-websocket";
|
||||
|
||||
import { loadTokens, saveTokens } from "../common/auth/token_storage";
|
||||
import { isExternal } from "../data/external";
|
||||
import { subscribePanels } from "../data/ws-panels";
|
||||
import { subscribeThemes } from "../data/ws-themes";
|
||||
import { subscribeUser } from "../data/ws-user";
|
||||
@ -28,11 +29,6 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
const isExternal =
|
||||
window.externalApp ||
|
||||
window.webkit?.messageHandlers?.getExternalAuth ||
|
||||
location.search.includes("external_auth=1");
|
||||
|
||||
const authProm = isExternal
|
||||
? () =>
|
||||
import(
|
||||
|
@ -3,9 +3,18 @@ import "../badges/hui-state-label-badge";
|
||||
import { LovelaceBadgeConfig } from "../../../data/lovelace";
|
||||
import { createLovelaceElement } from "./create-element-base";
|
||||
|
||||
const ALWAYS_LOADED_TYPES = new Set(["error", "state-label"]);
|
||||
// lazy load imports
|
||||
import "../badges/hui-entity-filter-badge";
|
||||
|
||||
const ALWAYS_LOADED_TYPES = new Set([
|
||||
"error",
|
||||
"state-label",
|
||||
|
||||
// lazy load types
|
||||
"entity-filter",
|
||||
]);
|
||||
const LAZY_LOAD_TYPES = {
|
||||
"entity-filter": () => import("../badges/hui-entity-filter-badge"),
|
||||
// "entity-filter": () => import("../badges/hui-entity-filter-badge"),
|
||||
};
|
||||
|
||||
export const createBadgeElement = (config: LovelaceBadgeConfig) =>
|
||||
|
@ -16,6 +16,23 @@ import {
|
||||
getLovelaceElementClass,
|
||||
} from "./create-element-base";
|
||||
|
||||
// lazy load imports
|
||||
import "../cards/hui-alarm-panel-card";
|
||||
import "../cards/hui-empty-state-card";
|
||||
import "../cards/hui-entity-filter-card";
|
||||
import "../cards/hui-picture-elements-card";
|
||||
import "../cards/hui-picture-entity-card";
|
||||
import "../cards/hui-picture-glance-card";
|
||||
import "../cards/hui-plant-status-card";
|
||||
import "../cards/hui-safe-mode-card";
|
||||
import "../cards/hui-shopping-list-card";
|
||||
import "../cards/hui-conditional-card";
|
||||
import "../cards/hui-gauge-card";
|
||||
import "../cards/hui-iframe-card";
|
||||
import "../cards/hui-map-card";
|
||||
import "../cards/hui-markdown-card";
|
||||
import "../cards/hui-picture-card";
|
||||
|
||||
const ALWAYS_LOADED_TYPES = new Set([
|
||||
"entities",
|
||||
"button",
|
||||
@ -30,24 +47,41 @@ const ALWAYS_LOADED_TYPES = new Set([
|
||||
"thermostat",
|
||||
"vertical-stack",
|
||||
"weather-forecast",
|
||||
|
||||
// Lazy load types
|
||||
"alarm-panel",
|
||||
"empty-state",
|
||||
"entity-filter",
|
||||
"picture-elements",
|
||||
"picture-entity",
|
||||
"picture-glance",
|
||||
"plant-status",
|
||||
"safe-mode",
|
||||
"shopping-list",
|
||||
"conditional",
|
||||
"gauge",
|
||||
"iframe",
|
||||
"map",
|
||||
"markdown",
|
||||
"picture",
|
||||
]);
|
||||
|
||||
const LAZY_LOAD_TYPES = {
|
||||
"alarm-panel": () => import("../cards/hui-alarm-panel-card"),
|
||||
"empty-state": () => import("../cards/hui-empty-state-card"),
|
||||
"entity-filter": () => import("../cards/hui-entity-filter-card"),
|
||||
"picture-elements": () => import("../cards/hui-picture-elements-card"),
|
||||
"picture-entity": () => import("../cards/hui-picture-entity-card"),
|
||||
"picture-glance": () => import("../cards/hui-picture-glance-card"),
|
||||
"plant-status": () => import("../cards/hui-plant-status-card"),
|
||||
"safe-mode": () => import("../cards/hui-safe-mode-card"),
|
||||
"shopping-list": () => import("../cards/hui-shopping-list-card"),
|
||||
conditional: () => import("../cards/hui-conditional-card"),
|
||||
gauge: () => import("../cards/hui-gauge-card"),
|
||||
iframe: () => import("../cards/hui-iframe-card"),
|
||||
map: () => import("../cards/hui-map-card"),
|
||||
markdown: () => import("../cards/hui-markdown-card"),
|
||||
picture: () => import("../cards/hui-picture-card"),
|
||||
// "alarm-panel": () => import("../cards/hui-alarm-panel-card"),
|
||||
// "empty-state": () => import("../cards/hui-empty-state-card"),
|
||||
// "entity-filter": () => import("../cards/hui-entity-filter-card"),
|
||||
// "picture-elements": () => import("../cards/hui-picture-elements-card"),
|
||||
// "picture-entity": () => import("../cards/hui-picture-entity-card"),
|
||||
// "picture-glance": () => import("../cards/hui-picture-glance-card"),
|
||||
// "plant-status": () => import("../cards/hui-plant-status-card"),
|
||||
// "safe-mode": () => import("../cards/hui-safe-mode-card"),
|
||||
// "shopping-list": () => import("../cards/hui-shopping-list-card"),
|
||||
// conditional: () => import("../cards/hui-conditional-card"),
|
||||
// gauge: () => import("../cards/hui-gauge-card"),
|
||||
// iframe: () => import("../cards/hui-iframe-card"),
|
||||
// map: () => import("../cards/hui-map-card"),
|
||||
// markdown: () => import("../cards/hui-markdown-card"),
|
||||
// picture: () => import("../cards/hui-picture-card"),
|
||||
};
|
||||
|
||||
export const createCardElement = (config: LovelaceCardConfig) =>
|
||||
|
@ -1,16 +1,25 @@
|
||||
import { LovelaceHeaderFooterConfig } from "../header-footer/types";
|
||||
import { createLovelaceElement } from "./create-element-base";
|
||||
|
||||
// lazy load imports
|
||||
import "../header-footer/hui-picture-header-footer";
|
||||
import "../header-footer/hui-buttons-header-footer";
|
||||
|
||||
const ALWAYS_LOADED_TYPES = new Set([
|
||||
// lazy load types
|
||||
"picture",
|
||||
"buttons",
|
||||
]);
|
||||
const LAZY_LOAD_TYPES = {
|
||||
picture: () => import("../header-footer/hui-picture-header-footer"),
|
||||
buttons: () => import("../header-footer/hui-buttons-header-footer"),
|
||||
// picture: () => import("../header-footer/hui-picture-header-footer"),
|
||||
// buttons: () => import("../header-footer/hui-buttons-header-footer"),
|
||||
};
|
||||
|
||||
export const createHeaderFooterElement = (config: LovelaceHeaderFooterConfig) =>
|
||||
createLovelaceElement(
|
||||
"header-footer",
|
||||
config,
|
||||
undefined,
|
||||
ALWAYS_LOADED_TYPES, // replace with undefined when empty
|
||||
LAZY_LOAD_TYPES,
|
||||
undefined,
|
||||
undefined
|
||||
|
@ -8,6 +8,23 @@ import "../special-rows/hui-call-service-row";
|
||||
import { EntityConfig } from "../entity-rows/types";
|
||||
import { createLovelaceElement } from "./create-element-base";
|
||||
|
||||
// lazy load imports
|
||||
import "../entity-rows/hui-climate-entity-row";
|
||||
import "../entity-rows/hui-cover-entity-row";
|
||||
import "../entity-rows/hui-group-entity-row";
|
||||
import "../entity-rows/hui-input-datetime-entity-row";
|
||||
import "../entity-rows/hui-input-number-entity-row";
|
||||
import "../entity-rows/hui-input-select-entity-row";
|
||||
import "../entity-rows/hui-input-text-entity-row";
|
||||
import "../entity-rows/hui-lock-entity-row";
|
||||
import "../entity-rows/hui-timer-entity-row";
|
||||
import "../special-rows/hui-conditional-row";
|
||||
import "../special-rows/hui-divider-row";
|
||||
import "../special-rows/hui-section-row";
|
||||
import "../special-rows/hui-weblink-row";
|
||||
import "../special-rows/hui-cast-row";
|
||||
import "../special-rows/hui-buttons-row";
|
||||
|
||||
const ALWAYS_LOADED_TYPES = new Set([
|
||||
"media-player-entity",
|
||||
"scene-entity",
|
||||
@ -16,26 +33,43 @@ const ALWAYS_LOADED_TYPES = new Set([
|
||||
"text-entity",
|
||||
"toggle-entity",
|
||||
"call-service",
|
||||
|
||||
// lazy load types
|
||||
"climate-entity",
|
||||
"cover-entity",
|
||||
"group-entity",
|
||||
"input-datetime-entity",
|
||||
"input-number-entity",
|
||||
"input-select-entity",
|
||||
"input-text-entity",
|
||||
"lock-entity",
|
||||
"timer-entity",
|
||||
"conditional",
|
||||
"divider",
|
||||
"section",
|
||||
"weblink",
|
||||
"cast",
|
||||
"buttons",
|
||||
]);
|
||||
const LAZY_LOAD_TYPES = {
|
||||
"climate-entity": () => import("../entity-rows/hui-climate-entity-row"),
|
||||
"cover-entity": () => import("../entity-rows/hui-cover-entity-row"),
|
||||
"group-entity": () => import("../entity-rows/hui-group-entity-row"),
|
||||
"input-datetime-entity": () =>
|
||||
import("../entity-rows/hui-input-datetime-entity-row"),
|
||||
"input-number-entity": () =>
|
||||
import("../entity-rows/hui-input-number-entity-row"),
|
||||
"input-select-entity": () =>
|
||||
import("../entity-rows/hui-input-select-entity-row"),
|
||||
"input-text-entity": () => import("../entity-rows/hui-input-text-entity-row"),
|
||||
"lock-entity": () => import("../entity-rows/hui-lock-entity-row"),
|
||||
"timer-entity": () => import("../entity-rows/hui-timer-entity-row"),
|
||||
conditional: () => import("../special-rows/hui-conditional-row"),
|
||||
divider: () => import("../special-rows/hui-divider-row"),
|
||||
section: () => import("../special-rows/hui-section-row"),
|
||||
weblink: () => import("../special-rows/hui-weblink-row"),
|
||||
cast: () => import("../special-rows/hui-cast-row"),
|
||||
buttons: () => import("../special-rows/hui-buttons-row"),
|
||||
// "climate-entity": () => import("../entity-rows/hui-climate-entity-row"),
|
||||
// "cover-entity": () => import("../entity-rows/hui-cover-entity-row"),
|
||||
// "group-entity": () => import("../entity-rows/hui-group-entity-row"),
|
||||
// "input-datetime-entity": () =>
|
||||
// import("../entity-rows/hui-input-datetime-entity-row"),
|
||||
// "input-number-entity": () =>
|
||||
// import("../entity-rows/hui-input-number-entity-row"),
|
||||
// "input-select-entity": () =>
|
||||
// import("../entity-rows/hui-input-select-entity-row"),
|
||||
// "input-text-entity": () => import("../entity-rows/hui-input-text-entity-row"),
|
||||
// "lock-entity": () => import("../entity-rows/hui-lock-entity-row"),
|
||||
// "timer-entity": () => import("../entity-rows/hui-timer-entity-row"),
|
||||
// conditional: () => import("../special-rows/hui-conditional-row"),
|
||||
// divider: () => import("../special-rows/hui-divider-row"),
|
||||
// section: () => import("../special-rows/hui-section-row"),
|
||||
// weblink: () => import("../special-rows/hui-weblink-row"),
|
||||
// cast: () => import("../special-rows/hui-cast-row"),
|
||||
// buttons: () => import("../special-rows/hui-buttons-row"),
|
||||
};
|
||||
const DOMAIN_TO_ELEMENT_TYPE = {
|
||||
_domain_not_found: "text",
|
||||
|
@ -31,6 +31,7 @@ import {
|
||||
getOptimisticFrontendUserDataCollection,
|
||||
CoreFrontendUserData,
|
||||
} from "../../data/frontend";
|
||||
import { isExternal } from "../../data/external";
|
||||
import { haStyle } from "../../resources/styles";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
@ -113,10 +114,14 @@ class HaPanelProfile extends LitElement {
|
||||
></ha-set-vibrate-row>
|
||||
`
|
||||
: ""}
|
||||
<ha-push-notifications-row
|
||||
.narrow=${this.narrow}
|
||||
.hass=${this.hass}
|
||||
></ha-push-notifications-row>
|
||||
${!isExternal
|
||||
? html`
|
||||
<ha-push-notifications-row
|
||||
.narrow=${this.narrow}
|
||||
.hass=${this.hass}
|
||||
></ha-push-notifications-row>
|
||||
`
|
||||
: ""}
|
||||
${this.hass.user!.is_admin
|
||||
? html`
|
||||
<ha-advanced-mode-row
|
||||
|
Loading…
x
Reference in New Issue
Block a user