From 04e63eefe21a9b6e44b903e2f6ac5373aa8f9a8f Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 26 Jan 2022 20:02:56 +0100 Subject: [PATCH 01/11] media_class of integrations should be app (#11444) --- src/components/media-player/ha-media-player-browse.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/media-player/ha-media-player-browse.ts b/src/components/media-player/ha-media-player-browse.ts index 2f8e21686a..4910271298 100644 --- a/src/components/media-player/ha-media-player-browse.ts +++ b/src/components/media-player/ha-media-player-browse.ts @@ -255,8 +255,10 @@ export class HaMediaPlayerBrowse extends LitElement { ${child.thumbnail ? html`
Date: Wed, 26 Jan 2022 20:32:50 +0100 Subject: [PATCH 02/11] Add padding between control buttons and progress bar --- src/panels/media-browser/ha-bar-media-player.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/panels/media-browser/ha-bar-media-player.ts b/src/panels/media-browser/ha-bar-media-player.ts index 0c760dadee..1a2f67d0e7 100644 --- a/src/panels/media-browser/ha-bar-media-player.ts +++ b/src/panels/media-browser/ha-bar-media-player.ts @@ -448,6 +448,7 @@ class BarMediaPlayer extends LitElement { .controls { height: 48px; + padding-bottom: 4px; } .controls-progress { @@ -501,6 +502,7 @@ class BarMediaPlayer extends LitElement { :host([narrow]) .controls { display: flex; + padding-bottom: 0; } :host([narrow]) .choose-player { From f59c30ac04f74eccaaf2a084211fe4f73ce7cc62 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 26 Jan 2022 12:14:28 -0800 Subject: [PATCH 03/11] Fix discovery name (#11445) --- src/data/config_flow.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/data/config_flow.ts b/src/data/config_flow.ts index 41842496d0..92352fafc9 100644 --- a/src/data/config_flow.ts +++ b/src/data/config_flow.ts @@ -104,18 +104,19 @@ export const localizeConfigFlowTitle = ( localize: LocalizeFunc, flow: DataEntryFlowProgress ) => { - const placeholders = flow.context.title_placeholders || {}; - const placeholderKeys = Object.keys(placeholders); - if (placeholderKeys.length === 0) { + if ( + !flow.context.title_placeholders || + Object.keys(flow.context.title_placeholders).length === 0 + ) { return domainToName(localize, flow.handler); } - const args: string[] = []; - placeholderKeys.forEach((key) => { - args.push(key); - args.push(placeholders[key]); - }); - return localize(`component.${flow.handler}.config.flow_title`, ...args) || - "name" in placeholders - ? placeholders.name - : domainToName(localize, flow.handler); + return ( + localize( + `component.${flow.handler}.config.flow_title`, + flow.context.title_placeholders + ) || + ("name" in flow.context.title_placeholders + ? flow.context.title_placeholders.name + : domainToName(localize, flow.handler)) + ); }; From e0c8efc5e6b0071f2b63f7735f0adcdf61e80ee3 Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Thu, 27 Jan 2022 09:44:05 +0100 Subject: [PATCH 04/11] Fix Lovelace view edit mode "Done" button styling (#11449) --- src/panels/lovelace/hui-root.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/panels/lovelace/hui-root.ts b/src/panels/lovelace/hui-root.ts index 5e39088b1a..ccd4ee08fb 100644 --- a/src/panels/lovelace/hui-root.ts +++ b/src/panels/lovelace/hui-root.ts @@ -130,6 +130,7 @@ class HUIRoot extends LitElement { >
Date: Thu, 27 Jan 2022 15:39:20 +0100 Subject: [PATCH 05/11] Adjust values in Energy Dashboard row (#11452) --- .../config/lovelace/dashboards/ha-config-lovelace-dashboards.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts index 63623ccb21..584cd5d2f4 100644 --- a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts +++ b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts @@ -197,6 +197,8 @@ export class HaConfigLovelaceDashboards extends LitElement { { icon: "hass:lightning-bolt", title: this.hass.localize(`ui.panel.config.dashboard.energy.title`), + show_in_sidebar: true, + mode: "storage", url_path: "energy", filename: "", }, From 242bad0a29d4003b990675b9afc2d7722be7fca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Thu, 27 Jan 2022 15:49:55 +0100 Subject: [PATCH 06/11] Use documentationUrl instead of manifest for core integrations (#11450) --- src/components/ha-service-control.ts | 8 +++++++- src/panels/config/info/integrations-card.ts | 8 +++++++- src/panels/config/integrations/ha-config-flow-card.ts | 8 +++++++- src/panels/config/integrations/ha-integration-card.ts | 8 +++++++- src/panels/config/logs/dialog-system-log-detail.ts | 8 +++++++- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/components/ha-service-control.ts b/src/components/ha-service-control.ts index 8b2b189af9..7783544cc4 100644 --- a/src/components/ha-service-control.ts +++ b/src/components/ha-service-control.ts @@ -17,6 +17,7 @@ import { import { Selector } from "../data/selector"; import { PolymerChangedEvent } from "../polymer-types"; import { HomeAssistant } from "../types"; +import { documentationUrl } from "../util/documentation-url"; import "./ha-checkbox"; import "./ha-icon-button"; import "./ha-selector/ha-selector"; @@ -230,7 +231,12 @@ export class HaServiceControl extends LitElement {

${serviceData?.description}

${this._manifest ? html` ${this.hass.localize( diff --git a/src/panels/config/integrations/ha-config-flow-card.ts b/src/panels/config/integrations/ha-config-flow-card.ts index 34dcd2bca9..e3d9fb0265 100644 --- a/src/panels/config/integrations/ha-config-flow-card.ts +++ b/src/panels/config/integrations/ha-config-flow-card.ts @@ -15,6 +15,7 @@ import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box import type { HomeAssistant } from "../../../types"; import type { DataEntryFlowProgressExtended } from "./ha-config-integrations"; import "./ha-integration-action-card"; +import { documentationUrl } from "../../../util/documentation-url"; @customElement("ha-config-flow-card") export class HaConfigFlowCard extends LitElement { @@ -82,7 +83,12 @@ export class HaConfigFlowCard extends LitElement { : ""} ${this.manifest ? html` diff --git a/src/panels/config/integrations/ha-integration-card.ts b/src/panels/config/integrations/ha-integration-card.ts index 1bfd16f0d6..89cc0306c2 100644 --- a/src/panels/config/integrations/ha-integration-card.ts +++ b/src/panels/config/integrations/ha-integration-card.ts @@ -46,6 +46,7 @@ import { } from "../../../dialogs/generic/show-dialog-box"; import { haStyle, haStyleScrollbar } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; +import { documentationUrl } from "../../../util/documentation-url"; import { fileDownload } from "../../../util/file_download"; import type { ConfigEntryExtended } from "./ha-config-integrations"; import "./ha-integration-header"; @@ -331,7 +332,12 @@ export class HaIntegrationCard extends LitElement { ${this.manifest ? html` diff --git a/src/panels/config/logs/dialog-system-log-detail.ts b/src/panels/config/logs/dialog-system-log-detail.ts index b8abf3474d..9d81c37eff 100644 --- a/src/panels/config/logs/dialog-system-log-detail.ts +++ b/src/panels/config/logs/dialog-system-log-detail.ts @@ -21,6 +21,7 @@ import { } from "../../../data/system_log"; import { haStyleDialog } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; +import { documentationUrl } from "../../../util/documentation-url"; import { showToast } from "../../../util/toast"; import type { SystemLogDetailDialogParams } from "./show-dialog-system-log-detail"; import { formatSystemLogTime } from "./util"; @@ -117,7 +118,12 @@ class DialogSystemLogDetail extends LitElement { ? "" : html` (documentation Date: Thu, 27 Jan 2022 16:27:40 +0100 Subject: [PATCH 07/11] Check if energy integration is enabled (#11458) --- .../ha-config-lovelace-dashboards.ts | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts index 584cd5d2f4..456d3bccb0 100644 --- a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts +++ b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts @@ -8,6 +8,7 @@ import "@polymer/paper-tooltip/paper-tooltip"; import { html, LitElement, PropertyValues, TemplateResult } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoize from "memoize-one"; +import { isComponentLoaded } from "../../../../common/config/is_component_loaded"; import { navigate } from "../../../../common/navigate"; import { stringCompare } from "../../../../common/string/compare"; import { @@ -183,31 +184,34 @@ export class HaConfigLovelaceDashboards extends LitElement { ).mode; const defaultUrlPath = this.hass.defaultPanel; const isDefault = defaultUrlPath === "lovelace"; - return [ + const result: Record[] = [ { icon: "hass:view-dashboard", title: this.hass.localize("panel.states"), default: isDefault, - sidebar: isDefault, + show_in_sidebar: isDefault, require_admin: false, url_path: "lovelace", mode: defaultMode, filename: defaultMode === "yaml" ? "ui-lovelace.yaml" : "", }, - { - icon: "hass:lightning-bolt", - title: this.hass.localize(`ui.panel.config.dashboard.energy.title`), - show_in_sidebar: true, - mode: "storage", - url_path: "energy", - filename: "", - }, ...dashboards.map((dashboard) => ({ filename: "", ...dashboard, default: defaultUrlPath === dashboard.url_path, })), ]; + if (isComponentLoaded(this.hass, "energy")) { + result.push({ + icon: "hass:lightning-bolt", + title: this.hass.localize(`ui.panel.config.dashboard.energy.title`), + show_in_sidebar: true, + mode: "storage", + url_path: "energy", + filename: "", + }); + } + return result; }); protected render(): TemplateResult { From ba75c2e7afeb688f5274a759e31feed5c010978e Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 27 Jan 2022 18:56:50 +0100 Subject: [PATCH 08/11] Little cleanup (#11461) --- .../strategies/original-states-strategy.ts | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/panels/lovelace/strategies/original-states-strategy.ts b/src/panels/lovelace/strategies/original-states-strategy.ts index d8941564a1..d94b1ede87 100644 --- a/src/panels/lovelace/strategies/original-states-strategy.ts +++ b/src/panels/lovelace/strategies/original-states-strategy.ts @@ -3,7 +3,7 @@ import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { subscribeOne } from "../../../common/util/subscribe-one"; import { subscribeAreaRegistry } from "../../../data/area_registry"; import { subscribeDeviceRegistry } from "../../../data/device_registry"; -import { EnergyPreferences, getEnergyPreferences } from "../../../data/energy"; +import { getEnergyPreferences } from "../../../data/energy"; import { subscribeEntityRegistry } from "../../../data/entity_registry"; import { generateDefaultViewConfig } from "../common/generate-lovelace-config"; import { @@ -39,30 +39,18 @@ export class OriginalStatesStrategy { subscribeEntityRegistry(hass.connection, () => undefined); } - let energyPromise: Promise | undefined; - - if (isComponentLoaded(hass, "energy")) { - energyPromise = getEnergyPreferences(hass); - } - - const [areaEntries, deviceEntries, entityEntries, localize] = + const [areaEntries, deviceEntries, entityEntries, localize, energyPrefs] = await Promise.all([ subscribeOne(hass.connection, subscribeAreaRegistry), subscribeOne(hass.connection, subscribeDeviceRegistry), subscribeOne(hass.connection, subscribeEntityRegistry), hass.loadBackendTranslation("title"), + isComponentLoaded(hass, "energy") + ? // It raises if not configured, just swallow that. + getEnergyPreferences(hass).catch(() => undefined) + : undefined, ]); - let energyPrefs: EnergyPreferences | undefined; - - if (energyPromise) { - try { - energyPrefs = await energyPromise; - } catch (_) { - // Nothing to do here - } - } - // User can override default view. If they didn't, we will add one // that contains all entities. const view = generateDefaultViewConfig( From b8d3eb76ac80f2a72b1431394558d2e5042bfce4 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 27 Jan 2022 18:57:15 +0100 Subject: [PATCH 09/11] Set frontendVersion sooner (#11460) --- src/entrypoints/app.ts | 2 -- src/entrypoints/core.ts | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/entrypoints/app.ts b/src/entrypoints/app.ts index 39c5f4c493..d4d1852c20 100644 --- a/src/entrypoints/app.ts +++ b/src/entrypoints/app.ts @@ -5,5 +5,3 @@ import "../resources/roboto"; import "../util/legacy-support"; setPassiveTouchGestures(true); - -(window as any).frontendVersion = __VERSION__; diff --git a/src/entrypoints/core.ts b/src/entrypoints/core.ts index 2875b3a8e4..2e34faae09 100644 --- a/src/entrypoints/core.ts +++ b/src/entrypoints/core.ts @@ -29,6 +29,7 @@ import { HomeAssistant } from "../types"; import { MAIN_WINDOW_NAME } from "../data/main_window"; window.name = MAIN_WINDOW_NAME; +(window as any).frontendVersion = __VERSION__; declare global { interface Window { From 815a2a07ff7eb7aab8db6ecf65474435a36f6aba Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 27 Jan 2022 18:58:41 +0100 Subject: [PATCH 10/11] Fix mobile styling quickbar (#11459) --- src/dialogs/quick-bar/ha-quick-bar.ts | 63 +++++++++++++++++---------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/src/dialogs/quick-bar/ha-quick-bar.ts b/src/dialogs/quick-bar/ha-quick-bar.ts index d95f5743c1..161a32403c 100644 --- a/src/dialogs/quick-bar/ha-quick-bar.ts +++ b/src/dialogs/quick-bar/ha-quick-bar.ts @@ -108,7 +108,9 @@ export class QuickBar extends LitElement { public async showDialog(params: QuickBarParams) { this._commandMode = params.commandMode || this._toggleIfAlreadyOpened(); this._hint = params.hint; - this._narrow = matchMedia("(max-width: 600px)").matches; + this._narrow = matchMedia( + "all and (max-width: 450px), all and (max-height: 500px)" + ).matches; this._initializeItemsIfNeeded(); this._opened = true; } @@ -154,7 +156,7 @@ export class QuickBar extends LitElement { )} .value=${this._commandMode ? `>${this._search}` : this._search} .icon=${true} - .iconTrailing=${this._search !== undefined} + .iconTrailing=${this._search !== undefined || this._narrow} @input=${this._handleSearchChange} @keydown=${this._handleInputKeyDown} @focus=${this._setFocusFirstListItem} @@ -174,24 +176,26 @@ export class QuickBar extends LitElement { .path=${mdiMagnify} > `} - ${this._search && - html` - - `} + ${this._search || this._narrow + ? html` +
+ ${this._search && + html``} + ${this._narrow && + html` + + `} +
+ ` + : ""} - ${this._narrow - ? html` - - ` - : ""} ${!items ? html` ${scroll({ @@ -705,6 +711,12 @@ export class QuickBar extends LitElement { } } + @media all and (max-width: 450px), all and (max-height: 500px) { + ha-textfield { + --mdc-shape-small: 0; + } + } + ha-icon.entity, ha-svg-icon.entity { margin-left: 20px; @@ -758,6 +770,11 @@ export class QuickBar extends LitElement { padding: 16px 0px; text-align: center; } + + div[slot="trailingIcon"] { + display: flex; + align-items: center; + } `, ]; } From a91897821a6fa3e823ecf7c85a63c5790d4b5047 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 27 Jan 2022 10:22:19 -0800 Subject: [PATCH 11/11] Bumped version to 20220127.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ac20d77a3b..7417efc3bd 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="home-assistant-frontend", - version="20220126.0", + version="20220127.0", description="The Home Assistant frontend", url="https://github.com/home-assistant/frontend", author="The Home Assistant Authors",