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", 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` { - 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)) + ); }; 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; + } `, ]; } 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 { diff --git a/src/panels/config/info/integrations-card.ts b/src/panels/config/info/integrations-card.ts index 979393eac1..17f12a7918 100644 --- a/src/panels/config/info/integrations-card.ts +++ b/src/panels/config/info/integrations-card.ts @@ -12,6 +12,7 @@ import { } from "../../../data/integration"; import { HomeAssistant } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; +import { documentationUrl } from "../../../util/documentation-url"; @customElement("integrations-card") class IntegrationsCard extends LitElement { @@ -66,7 +67,12 @@ class IntegrationsCard extends LitElement { const manifest = this._manifests && this._manifests[domain]; const docLink = 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[] = [ { 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`), - 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 { 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 { > 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( 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 {