From 866a57cde4c9d9505a690e5f9d942c9b31569fdd Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Wed, 2 Feb 2022 18:57:25 +0100 Subject: [PATCH 01/12] Only upload wheels to PyPI (#11514) --- script/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/release b/script/release index 3b981bf503..13eaaa4cb2 100755 --- a/script/release +++ b/script/release @@ -13,4 +13,4 @@ script/build_frontend rm -rf dist home_assistant_frontend.egg-info python3 -m build -python3 -m twine upload dist/* --skip-existing +python3 -m twine upload dist/*.whl --skip-existing From 5e80a2b4653f6a0b9f15a29b0e52fe77683ef6d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Thu, 3 Feb 2022 09:56:38 +0100 Subject: [PATCH 02/12] Make sure we load data in update card (#11516) --- .../update-available/update-available-card.ts | 65 +++++++++++++++++-- src/data/supervisor/supervisor.ts | 2 +- 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/hassio/src/update-available/update-available-card.ts b/hassio/src/update-available/update-available-card.ts index df35fcd40c..5012d61567 100644 --- a/hassio/src/update-available/update-available-card.ts +++ b/hassio/src/update-available/update-available-card.ts @@ -33,8 +33,12 @@ import { extractApiErrorMessage, ignoreSupervisorError, } from "../../../src/data/hassio/common"; -import { updateOS } from "../../../src/data/hassio/host"; -import { updateSupervisor } from "../../../src/data/hassio/supervisor"; +import { fetchHassioHassOsInfo, updateOS } from "../../../src/data/hassio/host"; +import { + fetchHassioHomeAssistantInfo, + fetchHassioSupervisorInfo, + updateSupervisor, +} from "../../../src/data/hassio/supervisor"; import { updateCore } from "../../../src/data/supervisor/core"; import { StoreAddon } from "../../../src/data/supervisor/store"; import { Supervisor } from "../../../src/data/supervisor/supervisor"; @@ -212,11 +216,22 @@ class UpdateAvailableCard extends LitElement { : "addon"; this._updateType = updateType as updateType; - if (updateType === "addon") { - if (!this.addonSlug) { - this.addonSlug = pathPart; - } - this._loadAddonData(); + switch (updateType) { + case "addon": + if (!this.addonSlug) { + this.addonSlug = pathPart; + } + this._loadAddonData(); + break; + case "core": + this._loadCoreData(); + break; + case "supervisor": + this._loadSupervisorData(); + break; + case "os": + this._loadOsData(); + break; } } @@ -308,6 +323,42 @@ class UpdateAvailableCard extends LitElement { } } + private async _loadSupervisorData() { + try { + const supervisor = await fetchHassioSupervisorInfo(this.hass); + fireEvent(this, "supervisor-update", { supervisor }); + } catch (err) { + showAlertDialog(this, { + title: this._updateType, + text: extractApiErrorMessage(err), + }); + } + } + + private async _loadCoreData() { + try { + const core = await fetchHassioHomeAssistantInfo(this.hass); + fireEvent(this, "supervisor-update", { core }); + } catch (err) { + showAlertDialog(this, { + title: this._updateType, + text: extractApiErrorMessage(err), + }); + } + } + + private async _loadOsData() { + try { + const os = await fetchHassioHassOsInfo(this.hass); + fireEvent(this, "supervisor-update", { os }); + } catch (err) { + showAlertDialog(this, { + title: this._updateType, + text: extractApiErrorMessage(err), + }); + } + } + private async _update() { this._error = undefined; this._updating = true; diff --git a/src/data/supervisor/supervisor.ts b/src/data/supervisor/supervisor.ts index 1a38c4cbe2..965d51506b 100644 --- a/src/data/supervisor/supervisor.ts +++ b/src/data/supervisor/supervisor.ts @@ -82,7 +82,7 @@ async function processEvent( event: SupervisorEvent, key: string ) { - if (event.event !== "supervisor-update" || event.update_key !== key) { + if (event.event !== "supervisor_update" || event.update_key !== key) { return; } From 19e1eaf2d76f8cbb8d60afb7d958355c5d921275 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 3 Feb 2022 00:59:04 -0800 Subject: [PATCH 03/12] Guard load diagnostics (#11518) --- src/panels/config/devices/ha-config-device-page.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/panels/config/devices/ha-config-device-page.ts b/src/panels/config/devices/ha-config-device-page.ts index 58db797b3c..ee1d3653f2 100644 --- a/src/panels/config/devices/ha-config-device-page.ts +++ b/src/panels/config/devices/ha-config-device-page.ts @@ -201,6 +201,10 @@ export class HaConfigDevicePage extends LitElement { } private async _renderDiagnosticButtons(requestId: number): Promise { + if (!isComponentLoaded(this.hass, "diagnostics")) { + return; + } + const device = this._device(this.deviceId, this.devices); if (!device) { From 0e41a408e7a0d9c303a009e5aa554524892e9f8a Mon Sep 17 00:00:00 2001 From: fpro1212 <75439345+fpro1212@users.noreply.github.com> Date: Thu, 3 Feb 2022 10:03:26 +0100 Subject: [PATCH 04/12] Design home - Fix GitHub Links (#11519) --- gallery/src/pages/concepts/home.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gallery/src/pages/concepts/home.markdown b/gallery/src/pages/concepts/home.markdown index 3d1217b4d8..666e567455 100644 --- a/gallery/src/pages/concepts/home.markdown +++ b/gallery/src/pages/concepts/home.markdown @@ -17,7 +17,7 @@ We want to make it as easy for designers to contribute as it is for developers. - Meet us at devs_ux Discord. Feel free to share your designs, user test or strategic ideas. - Start designing with our Figma DesignKit. -- Find the lates UX discussions and issues on GitHub. Everyone can start a new issue or discussion! +- Find the lates UX discussions and issues on GitHub. Everyone can start a new issue or discussion! ## Developers From 3aca67d511ec3953eb7aa1b43516b5e86a801890 Mon Sep 17 00:00:00 2001 From: Kuba Wolanin Date: Thu, 3 Feb 2022 11:15:27 +0100 Subject: [PATCH 05/12] Add filtering to system log card and error log card (#11166) Co-authored-by: Bram Kragten --- src/panels/config/logs/error-log-card.ts | 55 ++++++++++++----- src/panels/config/logs/ha-config-logs.ts | 60 ++++++++++++++++++- src/panels/config/logs/system-log-card.ts | 72 ++++++++++++++++------- src/translations/en.json | 2 + 4 files changed, 150 insertions(+), 39 deletions(-) diff --git a/src/panels/config/logs/error-log-card.ts b/src/panels/config/logs/error-log-card.ts index d5a4c2c156..3008ec2484 100644 --- a/src/panels/config/logs/error-log-card.ts +++ b/src/panels/config/logs/error-log-card.ts @@ -9,6 +9,10 @@ import { HomeAssistant } from "../../../types"; class ErrorLogCard extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; + @property() public filter = ""; + + @state() private _isLogLoaded = false; + @state() private _errorHTML!: TemplateResult[] | string; protected render(): TemplateResult { @@ -43,6 +47,14 @@ class ErrorLogCard extends LitElement { } } + protected updated(changedProps) { + super.updated(changedProps); + + if (changedProps.has("filter") && this._isLogLoaded) { + this._refreshErrorLog(); + } + } + static get styles(): CSSResultGroup { return css` .error-log-intro { @@ -55,12 +67,16 @@ class ErrorLogCard extends LitElement { } .error-log { - @apply --paper-font-code) - clear: both; + font-family: var(--code-font-family, monospace); + clear: both; text-align: left; padding-top: 12px; } + .error-log > div:hover { + background-color: var(--secondary-background-color); + } + .error { color: var(--error-color); } @@ -74,24 +90,33 @@ class ErrorLogCard extends LitElement { private async _refreshErrorLog(): Promise { this._errorHTML = this.hass.localize("ui.panel.config.logs.loading_log"); const log = await fetchErrorLog(this.hass!); + this._isLogLoaded = true; this._errorHTML = log - ? log.split("\n").map((entry) => { - if (entry.includes("INFO")) - return html`
${entry}
`; + ? log + .split("\n") + .filter((entry) => { + if (this.filter) { + return entry.toLowerCase().includes(this.filter.toLowerCase()); + } + return entry; + }) + .map((entry) => { + if (entry.includes("INFO")) + return html`
${entry}
`; - if (entry.includes("WARNING")) - return html`
${entry}
`; + if (entry.includes("WARNING")) + return html`
${entry}
`; - if ( - entry.includes("ERROR") || - entry.includes("FATAL") || - entry.includes("CRITICAL") - ) - return html`
${entry}
`; + if ( + entry.includes("ERROR") || + entry.includes("FATAL") || + entry.includes("CRITICAL") + ) + return html`
${entry}
`; - return html`
${entry}
`; - }) + return html`
${entry}
`; + }) : this.hass.localize("ui.panel.config.logs.no_errors"); } } diff --git a/src/panels/config/logs/ha-config-logs.ts b/src/panels/config/logs/ha-config-logs.ts index 13ef1137dc..48f90807eb 100644 --- a/src/panels/config/logs/ha-config-logs.ts +++ b/src/panels/config/logs/ha-config-logs.ts @@ -1,9 +1,11 @@ import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; -import { customElement, property, query } from "lit/decorators"; +import { customElement, property, query, state } from "lit/decorators"; import "../../../layouts/hass-tabs-subpage"; import { haStyle } from "../../../resources/styles"; import { HomeAssistant, Route } from "../../../types"; import { configSections } from "../ha-panel-config"; +import "../../../common/search/search-input"; +import { extractSearchParam } from "../../../common/url/search-params"; import "./error-log-card"; import "./system-log-card"; import type { SystemLogCard } from "./system-log-card"; @@ -20,6 +22,8 @@ export class HaConfigLogs extends LitElement { @property() public route!: Route; + @state() private _filter = extractSearchParam("filter") ?? ""; + @query("system-log-card", true) private systemLog?: SystemLogCard; public connectedCallback() { @@ -29,7 +33,39 @@ export class HaConfigLogs extends LitElement { } } + private async _filterChanged(ev) { + this._filter = ev.detail.value; + } + protected render(): TemplateResult { + const search = this.narrow + ? html` +
+ +
+ ` + : html` + + `; + return html` + ${search}
- - + +
`; @@ -56,6 +99,17 @@ export class HaConfigLogs extends LitElement { -moz-user-select: initial; } + .search { + padding: 0 16px; + background: var(--sidebar-background-color); + border-bottom: 1px solid var(--divider-color); + } + + .search search-input { + position: relative; + top: 2px; + } + .content { direction: ltr; } diff --git a/src/panels/config/logs/system-log-card.ts b/src/panels/config/logs/system-log-card.ts index 3baf39266a..373b797a06 100644 --- a/src/panels/config/logs/system-log-card.ts +++ b/src/panels/config/logs/system-log-card.ts @@ -2,6 +2,7 @@ import "@polymer/paper-item/paper-item"; import "@polymer/paper-item/paper-item-body"; import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { customElement, property, state } from "lit/decorators"; +import memoizeOne from "memoize-one"; import "../../../components/buttons/ha-call-service-button"; import "../../../components/buttons/ha-progress-button"; import "../../../components/ha-card"; @@ -22,6 +23,8 @@ import { formatSystemLogTime } from "./util"; export class SystemLogCard extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; + @property() public filter = ""; + public loaded = false; @state() private _items?: LoggedError[]; @@ -31,9 +34,44 @@ export class SystemLogCard extends LitElement { this._items = await fetchSystemLog(this.hass!); } + private _timestamp(item: LoggedError): string { + return formatSystemLogTime(item.timestamp, this.hass!.locale); + } + + private _multipleMessages(item: LoggedError): string { + return this.hass.localize( + "ui.panel.config.logs.multiple_messages", + "time", + formatSystemLogTime(item.first_occurred, this.hass!.locale), + "counter", + item.count + ); + } + + private _getFilteredItems = memoizeOne( + (items: LoggedError[], filter: string) => + items.filter((item: LoggedError) => { + if (filter) { + return ( + item.message.some((message: string) => + message.toLowerCase().includes(filter) + ) || + item.source[0].toLowerCase().includes(filter) || + item.name.toLowerCase().includes(filter) || + this._timestamp(item).toLowerCase().includes(filter) || + this._multipleMessages(item).toLowerCase().includes(filter) + ); + } + return item; + }) + ); + protected render(): TemplateResult { - const integrations = this._items - ? this._items.map((item) => getLoggedErrorIntegration(item)) + const filteredItems = this._items + ? this._getFilteredItems(this._items, this.filter.toLowerCase()) + : []; + const integrations = filteredItems.length + ? filteredItems.map((item) => getLoggedErrorIntegration(item)) : []; return html`
@@ -51,17 +89,21 @@ export class SystemLogCard extends LitElement { ${this.hass.localize("ui.panel.config.logs.no_issues")}
` - : this._items.map( + : filteredItems.length === 0 && this.filter + ? html`
+ ${this.hass.localize( + "ui.panel.config.logs.no_issues_search", + "term", + this.filter + )} +
` + : filteredItems.map( (item, idx) => html`
${item.message[0]}
- ${formatSystemLogTime( - item.timestamp, - this.hass!.locale - )} - – + ${this._timestamp(item)} – ${html`(${this.hass.localize( "ui.panel.config.logs.level." + @@ -81,19 +123,7 @@ export class SystemLogCard extends LitElement { }` : item.source[0]} ${item.count > 1 - ? html` - - - ${this.hass.localize( - "ui.panel.config.logs.multiple_messages", - "time", - formatSystemLogTime( - item.first_occurred, - this.hass!.locale - ), - "counter", - item.count - )} - ` + ? html` - ${this._multipleMessages(item)} ` : html``}
diff --git a/src/translations/en.json b/src/translations/en.json index ba969edb2a..2c64069e4c 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1344,6 +1344,8 @@ "caption": "Logs", "description": "View the Home Assistant logs", "details": "Log Details ({level})", + "search": "Search logs", + "no_issues_search": "No issues found for search term ''{term}''", "load_full_log": "Load Full Home Assistant Log", "loading_log": "Loading error log…", "no_errors": "No errors have been reported", From 0c6f647f5386a6e3094795fcf6aea7d90ad86f7f Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 3 Feb 2022 15:43:41 +0100 Subject: [PATCH 06/12] Handle unknown toggle state (#11522) --- src/components/entity/ha-entity-toggle.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/components/entity/ha-entity-toggle.ts b/src/components/entity/ha-entity-toggle.ts index 962af59b92..0bdf2e3126 100644 --- a/src/components/entity/ha-entity-toggle.ts +++ b/src/components/entity/ha-entity-toggle.ts @@ -12,7 +12,7 @@ import { property, state } from "lit/decorators"; import { STATES_OFF } from "../../common/const"; import { computeStateDomain } from "../../common/entity/compute_state_domain"; import { computeStateName } from "../../common/entity/compute_state_name"; -import { UNAVAILABLE, UNAVAILABLE_STATES } from "../../data/entity"; +import { UNAVAILABLE, UNAVAILABLE_STATES, UNKNOWN } from "../../data/entity"; import { forwardHaptic } from "../../data/haptics"; import { HomeAssistant } from "../../types"; import "../ha-formfield"; @@ -39,21 +39,26 @@ export class HaEntityToggle extends LitElement { return html` `; } - if (this.stateObj.attributes.assumed_state) { + if ( + this.stateObj.attributes.assumed_state || + this.stateObj.state === UNKNOWN + ) { return html` `; } @@ -63,7 +68,7 @@ export class HaEntityToggle extends LitElement { this._isOn ? "off" : "on" }`} .checked=${this._isOn} - .disabled=${UNAVAILABLE_STATES.includes(this.stateObj.state)} + .disabled=${this.stateObj.state === UNAVAILABLE} @change=${this._toggleChanged} >`; @@ -156,10 +161,11 @@ export class HaEntityToggle extends LitElement { min-width: 38px; } ha-icon-button { + --mdc-icon-button-size: 40px; color: var(--ha-icon-button-inactive-color, var(--primary-text-color)); transition: color 0.5s; } - ha-icon-button[state-active] { + ha-icon-button.state-active { color: var(--ha-icon-button-active-color, var(--primary-color)); } ha-switch { From 0540bae7071ca13c8fc1ab0a6a0dd0c443829203 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 3 Feb 2022 15:54:37 +0100 Subject: [PATCH 07/12] Fix dialog heading aria label (#11524) Co-authored-by: Zack Barett --- .../backup/dialog-hassio-backup-upload.ts | 4 +++- .../dialogs/backup/dialog-hassio-backup.ts | 2 +- .../hardware/dialog-hassio-hardware.ts | 4 +++- .../dialogs/network/dialog-hassio-network.ts | 2 +- .../dialog-media-player-browse.ts | 6 ++++- src/dialogs/more-info/ha-more-info-dialog.ts | 2 +- src/dialogs/quick-bar/ha-quick-bar.ts | 2 +- .../config/entities/dialog-entity-editor.ts | 4 +++- .../config/logs/dialog-system-log-detail.ts | 24 +++++++++---------- .../card-editor/hui-dialog-create-card.ts | 22 ++++++++--------- .../card-editor/hui-dialog-edit-card.ts | 2 +- .../view-editor/hui-dialog-edit-view.ts | 2 +- 12 files changed, 42 insertions(+), 34 deletions(-) diff --git a/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts b/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts index 27d91394d4..f6a80cefe6 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts @@ -47,7 +47,9 @@ export class DialogHassioBackupUpload scrimClickAction escapeKeyAction hideActions - .heading=${true} + .heading=${this.hass?.localize( + "ui.panel.page-onboarding.restore.upload_backup" + ) || "Upload backup"} @closed=${this.closeDialog} >
diff --git a/hassio/src/dialogs/backup/dialog-hassio-backup.ts b/hassio/src/dialogs/backup/dialog-hassio-backup.ts index b01159473b..5a5fc61810 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-backup.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-backup.ts @@ -71,7 +71,7 @@ class HassioBackupDialog open scrimClickAction @closed=${this.closeDialog} - .heading=${true} + .heading=${this._backup.name} >
diff --git a/hassio/src/dialogs/hardware/dialog-hassio-hardware.ts b/hassio/src/dialogs/hardware/dialog-hassio-hardware.ts index 0073eaea03..ca94af7c8d 100755 --- a/hassio/src/dialogs/hardware/dialog-hassio-hardware.ts +++ b/hassio/src/dialogs/hardware/dialog-hassio-hardware.ts @@ -65,7 +65,9 @@ class HassioHardwareDialog extends LitElement { scrimClickAction hideActions @closed=${this.closeDialog} - .heading=${true} + .heading=${this._dialogParams.supervisor.localize( + "dialog.hardware.title" + )} >

diff --git a/hassio/src/dialogs/network/dialog-hassio-network.ts b/hassio/src/dialogs/network/dialog-hassio-network.ts index 90221f0747..3e3c8720b4 100644 --- a/hassio/src/dialogs/network/dialog-hassio-network.ts +++ b/hassio/src/dialogs/network/dialog-hassio-network.ts @@ -94,7 +94,7 @@ export class DialogHassioNetwork open scrimClickAction escapeKeyAction - .heading=${true} + .heading=${this.supervisor.localize("dialog.network.title")} hideActions @closed=${this.closeDialog} > diff --git a/src/components/media-player/dialog-media-player-browse.ts b/src/components/media-player/dialog-media-player-browse.ts index 8e737dc0ed..31acf550aa 100644 --- a/src/components/media-player/dialog-media-player-browse.ts +++ b/src/components/media-player/dialog-media-player-browse.ts @@ -55,7 +55,11 @@ class DialogMediaPlayerBrowse extends LitElement { escapeKeyAction hideActions flexContent - .heading=${true} + .heading=${!this._currentItem + ? this.hass.localize( + "ui.components.media-browser.media-player-browser" + ) + : this._currentItem.title} @closed=${this.closeDialog} > diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index 207dbeafed..64082db266 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -105,7 +105,7 @@ export class MoreInfoDialog extends LitElement { diff --git a/src/dialogs/quick-bar/ha-quick-bar.ts b/src/dialogs/quick-bar/ha-quick-bar.ts index 1f9920fa32..ae2c43bfba 100644 --- a/src/dialogs/quick-bar/ha-quick-bar.ts +++ b/src/dialogs/quick-bar/ha-quick-bar.ts @@ -139,7 +139,7 @@ export class QuickBar extends LitElement { return html` ${this.hass.localize( + "ui.panel.config.logs.level." + item.level.toLowerCase() + )}` + ); + return html` - + - - ${this.hass.localize( - "ui.panel.config.logs.details", - "level", - html`${this.hass.localize( - "ui.panel.config.logs.level." + item.level.toLowerCase() - )}` - )} - + ${title}
- - ${this._viewConfig.title - ? this.hass!.localize( - "ui.panel.lovelace.editor.edit_card.pick_card_view_title", - "name", - `"${this._viewConfig.title}"` - ) - : this.hass!.localize( - "ui.panel.lovelace.editor.edit_card.pick_card" - )} - + ${title}
diff --git a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts index 203a7d770f..3b981ee67a 100644 --- a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts +++ b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts @@ -173,7 +173,7 @@ export class HuiDialogEditView extends LitElement { scrimClickAction escapeKeyAction @closed=${this.closeDialog} - .heading=${true} + .heading=${this._viewConfigTitle} >

${this._viewConfigTitle}

From 148bb99d89f7cc2824cc7f2df28ce60c8a6856a1 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 3 Feb 2022 16:28:59 +0100 Subject: [PATCH 08/12] Use css to hide hint in quickbar (#11527) --- src/dialogs/quick-bar/ha-quick-bar.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/dialogs/quick-bar/ha-quick-bar.ts b/src/dialogs/quick-bar/ha-quick-bar.ts index ae2c43bfba..77e1ccd8df 100644 --- a/src/dialogs/quick-bar/ha-quick-bar.ts +++ b/src/dialogs/quick-bar/ha-quick-bar.ts @@ -231,9 +231,7 @@ export class QuickBar extends LitElement { })} `} - ${!this._narrow && this._hint - ? html`
${this._hint}
` - : ""} + ${this._hint ? html`
${this._hint}
` : ""} `; } @@ -718,6 +716,12 @@ export class QuickBar extends LitElement { } } + @media all and (max-width: 450px), all and (max-height: 690px) { + .hint { + display: none; + } + } + ha-icon.entity, ha-svg-icon.entity { margin-left: 20px; From 5fde6e659d75b47ae009f90ef8e012b7837b2cca Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 3 Feb 2022 16:33:24 +0100 Subject: [PATCH 09/12] Revert "Mobile click accessibility" (#11526) --- src/entrypoints/app.ts | 6 +----- src/entrypoints/authorize.ts | 3 --- src/entrypoints/custom-panel.ts | 5 +---- src/entrypoints/onboarding.ts | 3 --- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/entrypoints/app.ts b/src/entrypoints/app.ts index e93a38769e..d4d1852c20 100644 --- a/src/entrypoints/app.ts +++ b/src/entrypoints/app.ts @@ -1,11 +1,7 @@ -import { - setPassiveTouchGestures, - setCancelSyntheticClickEvents, -} from "@polymer/polymer/lib/utils/settings"; +import { setPassiveTouchGestures } from "@polymer/polymer/lib/utils/settings"; import "../layouts/home-assistant"; import "../resources/ha-style"; import "../resources/roboto"; import "../util/legacy-support"; setPassiveTouchGestures(true); -setCancelSyntheticClickEvents(false); diff --git a/src/entrypoints/authorize.ts b/src/entrypoints/authorize.ts index 47ba124a91..36954a3fcf 100644 --- a/src/entrypoints/authorize.ts +++ b/src/entrypoints/authorize.ts @@ -1,14 +1,11 @@ // Compat needs to be first import import "../resources/compatibility"; -import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings"; import "../auth/ha-authorize"; import "../resources/ha-style"; import "../resources/roboto"; import "../resources/safari-14-attachshadow-patch"; import "../resources/array.flat.polyfill"; -setCancelSyntheticClickEvents(false); - /* polyfill for paper-dropdown */ setTimeout( () => import("web-animations-js/web-animations-next-lite.min"), diff --git a/src/entrypoints/custom-panel.ts b/src/entrypoints/custom-panel.ts index 2e09f9931b..e2da175ea8 100644 --- a/src/entrypoints/custom-panel.ts +++ b/src/entrypoints/custom-panel.ts @@ -1,6 +1,5 @@ // Compat needs to be first import import "../resources/compatibility"; -import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings"; import "../resources/safari-14-attachshadow-patch"; import { PolymerElement } from "@polymer/polymer"; @@ -16,8 +15,6 @@ import { createCustomPanelElement } from "../util/custom-panel/create-custom-pan import { loadCustomPanel } from "../util/custom-panel/load-custom-panel"; import { setCustomPanelProperties } from "../util/custom-panel/set-custom-panel-properties"; -setCancelSyntheticClickEvents(false); - declare global { interface Window { loadES5Adapter: () => Promise; @@ -50,7 +47,7 @@ function initialize( ) { const style = document.createElement("style"); - style.innerHTML = `body { margin:0; } + style.innerHTML = `body { margin:0; } @media (prefers-color-scheme: dark) { body { background-color: #111111; diff --git a/src/entrypoints/onboarding.ts b/src/entrypoints/onboarding.ts index 78696169ca..44a67890ab 100644 --- a/src/entrypoints/onboarding.ts +++ b/src/entrypoints/onboarding.ts @@ -1,14 +1,11 @@ // Compat needs to be first import import "../resources/compatibility"; -import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings"; import "../onboarding/ha-onboarding"; import "../resources/ha-style"; import "../resources/roboto"; import "../resources/safari-14-attachshadow-patch"; import "../resources/array.flat.polyfill"; -setCancelSyntheticClickEvents(false); - declare global { interface Window { stepsPromise: Promise; From 4e554607995785bac201fef1fb00aef6aa8dbd4e Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 3 Feb 2022 16:54:26 +0100 Subject: [PATCH 10/12] =?UTF-8?q?Clear=20old=20src=20when=20disconnected?= =?UTF-8?q?=20so=20we=20can't=20fetch=20it=20with=20the=20wrong=20t?= =?UTF-8?q?=E2=80=A6=20(#11528)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/panels/lovelace/components/hui-image.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/panels/lovelace/components/hui-image.ts b/src/panels/lovelace/components/hui-image.ts index 23510d29d3..fcf1654a0a 100644 --- a/src/panels/lovelace/components/hui-image.ts +++ b/src/panels/lovelace/components/hui-image.ts @@ -106,6 +106,9 @@ export class HuiImage extends LitElement { } else if (!this.hass!.connected) { this._stopUpdateCameraInterval(); this._stopIntersectionObserver(); + this._loadState = LoadState.Loading; + this._cameraImageSrc = undefined; + this._loadedImageSrc = undefined; } } if (changedProps.has("_imageVisible")) { From 8466ef371adea22ebc20a8d389f67da3a7189171 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 3 Feb 2022 20:18:48 +0100 Subject: [PATCH 11/12] Add name of integration to diagnostics when more than 1 (#11523) --- .../config/devices/ha-config-device-page.ts | 62 ++++++++++++------- src/translations/en.json | 1 + 2 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/panels/config/devices/ha-config-device-page.ts b/src/panels/config/devices/ha-config-device-page.ts index ee1d3653f2..984acc04fa 100644 --- a/src/panels/config/devices/ha-config-device-page.ts +++ b/src/panels/config/devices/ha-config-device-page.ts @@ -39,6 +39,7 @@ import { findBatteryEntity, updateEntityRegistryEntry, } from "../../../data/entity_registry"; +import { domainToName } from "../../../data/integration"; import { SceneEntities, showSceneEditor } from "../../../data/scene"; import { findRelated, RelatedResult } from "../../../data/search"; import { @@ -212,34 +213,53 @@ export class HaConfigDevicePage extends LitElement { } let links = await Promise.all( - this._integrations(device, this.entries) - .filter((entry) => entry.state === "loaded") - .map(async (entry) => { - const info = await fetchDiagnosticHandler(this.hass, entry.domain); + this._integrations(device, this.entries).map(async (entry) => { + if (entry.state !== "loaded") { + return false; + } + const info = await fetchDiagnosticHandler(this.hass, entry.domain); - if (!info.handlers.device && !info.handlers.config_entry) { - return ""; - } - const link = info.handlers.device + if (!info.handlers.device && !info.handlers.config_entry) { + return false; + } + return { + link: info.handlers.device ? getDeviceDiagnosticsDownloadUrl(entry.entry_id, this.deviceId) - : getConfigEntryDiagnosticsDownloadUrl(entry.entry_id); - return html` - - - ${this.hass.localize( - `ui.panel.config.devices.download_diagnostics` - )} - - - `; - }) + : getConfigEntryDiagnosticsDownloadUrl(entry.entry_id), + domain: entry.domain, + }; + }) ); + + links = links.filter(Boolean); + if (this._diagnosticDownloadLinks !== requestId) { return; } - links = links.filter(Boolean); if (links.length > 0) { - this._diagnosticDownloadLinks = links; + this._diagnosticDownloadLinks = ( + links as { link: string; domain: string }[] + ).map( + (link) => html` + + + ${links.length > 1 + ? this.hass.localize( + `ui.panel.config.devices.download_diagnostics_integration`, + { + integration: domainToName( + this.hass.localize, + link.domain + ), + } + ) + : this.hass.localize( + `ui.panel.config.devices.download_diagnostics` + )} + + + ` + ); } } diff --git a/src/translations/en.json b/src/translations/en.json index 2c64069e4c..e804716cf5 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2231,6 +2231,7 @@ "open_configuration_url_device": "Visit device", "open_configuration_url_service": "Visit service", "download_diagnostics": "Download diagnostics", + "download_diagnostics_integration": "Download {integration} diagnostics", "type": { "device_heading": "Device", "device": "device", From 890ad9a1c8c39c33e03c2763aa13d63e916c5cf4 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 3 Feb 2022 20:27:33 +0100 Subject: [PATCH 12/12] Bumped version to 20220203.0 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 0404d7df03..587f449468 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = home-assistant-frontend -version = 20220202.0 +version = 20220203.0 author = The Home Assistant Authors author_email = hello@home-assistant.io license = Apache-2.0