From 744cda39747b834277796fb4cdcb5d0f3f3d88d8 Mon Sep 17 00:00:00 2001 From: Wendelin <12148533+wendevlin@users.noreply.github.com> Date: Thu, 31 Oct 2024 08:57:27 +0100 Subject: [PATCH 1/8] Add fallback for missing logs boot result. (#22600) * Add fallback for missing logs boot result. * Add fallback for logs full download when boots are missing * Fix function naming and single boot select in error-log-card --- src/data/hassio/supervisor.ts | 21 ++++++++++++++++++- .../config/logs/dialog-download-logs.ts | 14 +++++++++++-- src/panels/config/logs/error-log-card.ts | 17 +++++++++++++-- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/data/hassio/supervisor.ts b/src/data/hassio/supervisor.ts index 2f34c77f84ce..cc74a7fd70f8 100644 --- a/src/data/hassio/supervisor.ts +++ b/src/data/hassio/supervisor.ts @@ -203,6 +203,20 @@ export const fetchHassioLogs = async ( ); export const fetchHassioLogsFollow = async ( + hass: HomeAssistant, + provider: string, + signal: AbortSignal, + lines = 100 +) => + hass.callApiRaw( + "GET", + `hassio/${provider.includes("_") ? `addons/${provider}` : provider}/logs/follow?lines=${lines}`, + undefined, + undefined, + signal + ); + +export const fetchHassioLogsBootFollow = async ( hass: HomeAssistant, provider: string, signal: AbortSignal, @@ -222,7 +236,12 @@ export const getHassioLogDownloadUrl = (provider: string) => provider.includes("_") ? `addons/${provider}` : provider }/logs`; -export const getHassioLogDownloadLinesUrl = ( +export const getHassioLogDownloadLinesUrl = (provider: string, lines: number) => + `/api/hassio/${ + provider.includes("_") ? `addons/${provider}` : provider + }/logs?lines=${lines}`; + +export const getHassioLogBootDownloadLinesUrl = ( provider: string, lines: number, boot = 0 diff --git a/src/panels/config/logs/dialog-download-logs.ts b/src/panels/config/logs/dialog-download-logs.ts index fdd67e5a315b..e4726e0528a6 100644 --- a/src/panels/config/logs/dialog-download-logs.ts +++ b/src/panels/config/logs/dialog-download-logs.ts @@ -14,7 +14,10 @@ import type { DownloadLogsDialogParams } from "./show-dialog-download-logs"; import "../../../components/ha-select"; import "../../../components/ha-list-item"; import { stopPropagation } from "../../../common/dom/stop_propagation"; -import { getHassioLogDownloadLinesUrl } from "../../../data/hassio/supervisor"; +import { + getHassioLogDownloadLinesUrl, + getHassioLogBootDownloadLinesUrl, +} from "../../../data/hassio/supervisor"; import { getSignedPath } from "../../../data/auth"; import { fileDownload } from "../../../util/file_download"; @@ -112,7 +115,7 @@ class DownloadLogsDialog extends LitElement { const boot = this._dialogParams!.boot; const timeString = new Date().toISOString().replace(/:/g, "-"); - const downloadUrl = getHassioLogDownloadLinesUrl( + const downloadUrl = this._getDownloadUrlFunction()( provider, this._lineCount, boot @@ -126,6 +129,13 @@ class DownloadLogsDialog extends LitElement { this.closeDialog(); } + private _getDownloadUrlFunction() { + if (this._dialogParams!.boot === 0) { + return getHassioLogDownloadLinesUrl; + } + return getHassioLogBootDownloadLinesUrl; + } + private _setNumberOfLogs(ev) { this._lineCount = Number(ev.target.value); } diff --git a/src/panels/config/logs/error-log-card.ts b/src/panels/config/logs/error-log-card.ts index b487f07c9549..12994fe1e23f 100644 --- a/src/panels/config/logs/error-log-card.ts +++ b/src/panels/config/logs/error-log-card.ts @@ -39,6 +39,7 @@ import { extractApiErrorMessage } from "../../../data/hassio/common"; import { fetchHassioBoots, fetchHassioLogs, + fetchHassioLogsBootFollow, fetchHassioLogsFollow, getHassioLogDownloadUrl, } from "../../../data/hassio/supervisor"; @@ -378,7 +379,7 @@ class ErrorLogCard extends LitElement { isComponentLoaded(this.hass, "hassio") && this.provider ) { - const response = await fetchHassioLogsFollow( + const response = await this._fetchLogsFunction()( this.hass, this.provider, this._logStreamAborter.signal, @@ -468,6 +469,13 @@ class ErrorLogCard extends LitElement { } } + private _fetchLogsFunction = () => { + if (this._boot === 0) { + return fetchHassioLogsFollow; + } + return fetchHassioLogsBootFollow; + }; + private _debounceSearch = debounce(() => { this._noSearchResults = !this._ansiToHtmlElement?.filterLines(this.filter); @@ -570,9 +578,14 @@ class ErrorLogCard extends LitElement { if (this._streamSupported && isComponentLoaded(this.hass, "hassio")) { try { const { data } = await fetchHassioBoots(this.hass); - this._boots = Object.keys(data.boots) + const boots = Object.keys(data.boots) .map(Number) .sort((a, b) => b - a); + + // only show boots select when there are more than one boot + if (boots.length > 1) { + this._boots = boots; + } } catch (err: any) { // eslint-disable-next-line no-console console.error(err); From 5db293ce01f1e6e6a753a7c2925f9547b225c693 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 31 Oct 2024 12:59:23 +0100 Subject: [PATCH 2/8] Use entity instead of entity_id for more info action (#22603) --- src/data/lovelace/config/action.ts | 2 +- src/panels/lovelace/common/handle-action.ts | 2 +- src/panels/lovelace/editor/structs/action-struct.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/lovelace/config/action.ts b/src/data/lovelace/config/action.ts index 800a54dc3f28..6aa0a8ee8831 100644 --- a/src/data/lovelace/config/action.ts +++ b/src/data/lovelace/config/action.ts @@ -28,7 +28,7 @@ export interface UrlActionConfig extends BaseActionConfig { export interface MoreInfoActionConfig extends BaseActionConfig { action: "more-info"; - entity_id?: string; + entity?: string; } export interface AssistActionConfig extends BaseActionConfig { diff --git a/src/panels/lovelace/common/handle-action.ts b/src/panels/lovelace/common/handle-action.ts index 00ab032fdd8d..e7337ab51c97 100644 --- a/src/panels/lovelace/common/handle-action.ts +++ b/src/panels/lovelace/common/handle-action.ts @@ -95,7 +95,7 @@ export const handleAction = async ( switch (actionConfig.action) { case "more-info": { const entityId = - actionConfig.entity_id || + actionConfig.entity || config.entity || config.camera_image || config.image_entity; diff --git a/src/panels/lovelace/editor/structs/action-struct.ts b/src/panels/lovelace/editor/structs/action-struct.ts index 7744a99070dc..b6b7c75a27d4 100644 --- a/src/panels/lovelace/editor/structs/action-struct.ts +++ b/src/panels/lovelace/editor/structs/action-struct.ts @@ -63,7 +63,7 @@ const actionConfigStructAssist = type({ const actionConfigStructMoreInfo = type({ action: literal("more-info"), - entity_id: optional(string()), + entity: optional(string()), }); export const actionConfigStructType = object({ From f1d49aaeb1ba0fd143480b70af464f77b801b779 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 31 Oct 2024 13:45:42 +0100 Subject: [PATCH 3/8] Add theme variable for text in heading badge, fix font family (#22606) --- src/components/ha-heading-badge.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/ha-heading-badge.ts b/src/components/ha-heading-badge.ts index 5fff177a2ab1..f60b3af4b7e2 100644 --- a/src/components/ha-heading-badge.ts +++ b/src/components/ha-heading-badge.ts @@ -25,7 +25,6 @@ export class HaBadge extends LitElement { static get styles(): CSSResultGroup { return css` :host { - color: var(--secondary-text-color); } [role="button"] { cursor: pointer; @@ -36,11 +35,10 @@ export class HaBadge extends LitElement { white-space: nowrap; align-items: center; gap: 3px; - font-family: Roboto; - font-size: 14px; - font-style: normal; - font-weight: 400; - line-height: 20px; + color: var(--ha-heading-badge-text-color, var(--secondary-text-color)); + font-size: var(--ha-heading-badge-font-size, 14px); + font-weight: var(--ha-heading-badge-font-weight, 400); + line-height: var(--ha-heading-badge-line-height, 20px); letter-spacing: 0.1px; --mdc-icon-size: 14px; } From 152b665f2e5345f65bbc2c8ccfac894b1d0148ce Mon Sep 17 00:00:00 2001 From: Wendelin <12148533+wendevlin@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:57:40 +0100 Subject: [PATCH 4/8] Fix hassio backups translations (#22609) * Fix hassio backup styling * Add missing hassio backups data-table translations --- hassio/src/backups/hassio-backups.ts | 3 ++ src/layouts/hass-tabs-subpage-data-table.ts | 12 ++++---- src/translations/en.json | 31 +++++++++++++++++++++ 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/hassio/src/backups/hassio-backups.ts b/hassio/src/backups/hassio-backups.ts index c089d395bfd8..af8cbf170b86 100644 --- a/hassio/src/backups/hassio-backups.ts +++ b/hassio/src/backups/hassio-backups.ts @@ -374,6 +374,9 @@ export class HassioBackups extends LitElement { haStyle, hassioStyle, css` + :host { + color: var(--primary-text-color); + } .table-header { display: flex; justify-content: space-between; diff --git a/src/layouts/hass-tabs-subpage-data-table.ts b/src/layouts/hass-tabs-subpage-data-table.ts index cdc5d9f84551..9ac568e80d4f 100644 --- a/src/layouts/hass-tabs-subpage-data-table.ts +++ b/src/layouts/hass-tabs-subpage-data-table.ts @@ -371,11 +371,13 @@ export class HaTabsSubpageDataTable extends LitElement { -

- ${localize("ui.components.subpage-data-table.selected", { - selected: this.selected || "0", - })} -

+ ${this.selected !== undefined + ? html`

+ ${localize("ui.components.subpage-data-table.selected", { + selected: this.selected || "0", + })} +

` + : nothing}
diff --git a/src/translations/en.json b/src/translations/en.json index 5c62be98d216..7c6051cb42c5 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -7814,6 +7814,37 @@ "cancel": "[%key:ui::common::cancel%]", "move": "Move" } + }, + "ui": { + "components": { + "subpage-data-table": { + "filters": "[%key:ui::components::subpage-data-table::filters%]", + "show_results": "[%key:ui::components::subpage-data-table::show_results%]", + "clear_filter": "[%key:ui::components::subpage-data-table::clear_filter%]", + "close_filter": "[%key:ui::components::subpage-data-table::close_filter%]", + "exit_selection_mode": "[%key:ui::components::subpage-data-table::exit_selection_mode%]", + "enter_selection_mode": "[%key:ui::components::subpage-data-table::enter_selection_mode%]", + "sort_by": "[%key:ui::components::subpage-data-table::sort_by%]", + "group_by": "[%key:ui::components::subpage-data-table::group_by%]", + "dont_group_by": "[%key:ui::components::subpage-data-table::dont_group_by%]", + "collapse_all_groups": "[%key:ui::components::subpage-data-table::collapse_all_groups%]", + "expand_all_groups": "[%key:ui::components::subpage-data-table::expand_all_groups%]", + "select": "[%key:ui::components::subpage-data-table::select%]", + "selected": "[%key:ui::components::subpage-data-table::selected%]", + "select_all": "[%key:ui::components::subpage-data-table::select_all%]", + "select_none": "[%key:ui::components::subpage-data-table::select_none%]", + "settings": "[%key:ui::components::subpage-data-table::settings%]" + }, + "data-table": { + "settings": { + "header": "[%key:ui::components::data-table::settings::header%]", + "hide": "[%key:ui::components::data-table::settings::hide%]", + "show": "[%key:ui::components::data-table::settings::show%]", + "done": "[%key:ui::components::data-table::settings::done%]", + "restore": "[%key:ui::components::data-table::settings::restore%]" + } + } + } } } } From f4df5852fb77b988396ed925afaf538a3889ba1c Mon Sep 17 00:00:00 2001 From: Wendelin <12148533+wendevlin@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:43:51 +0100 Subject: [PATCH 5/8] Fix hassio repositories tooltip (#22610) --- .../dialogs/repositories/dialog-hassio-repositories.ts | 10 ++++++---- src/components/ha-md-list-item.ts | 3 +++ src/translations/en.json | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts b/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts index 9d616d68c315..e2769703f663 100644 --- a/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts +++ b/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts @@ -120,9 +120,6 @@ class HassioRepositoriesDialog extends LitElement {
` ) - : html` No repositories `} + : html`${this._dialogParams!.supervisor.localize( + "dialog.repositories.no_repositories" + )}`}
Date: Thu, 31 Oct 2024 14:48:21 +0100 Subject: [PATCH 6/8] Remove get layout options warning in console (#22611) --- src/panels/lovelace/cards/hui-card.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/panels/lovelace/cards/hui-card.ts b/src/panels/lovelace/cards/hui-card.ts index 855c4d30404f..8692e34dd1d5 100644 --- a/src/panels/lovelace/cards/hui-card.ts +++ b/src/panels/lovelace/cards/hui-card.ts @@ -86,10 +86,11 @@ export class HuiCard extends ReactiveElement { return this._element.getGridOptions(); } if (this._element.getLayoutOptions) { + // Disabled for now to avoid spamming the console, need to be re-enabled when hui-card performance are fixed // eslint-disable-next-line no-console - console.warn( - `This card (${this.config?.type}) is using "getLayoutOptions" and it is deprecated, contact the developer to suggest to use "getGridOptions" instead` - ); + // console.warn( + // `This card (${this.config?.type}) is using "getLayoutOptions" and it is deprecated, contact the developer to suggest to use "getGridOptions" instead` + // ); const options = migrateLayoutToGridOptions( this._element.getLayoutOptions() ); From 1df60056b2dbe08a158b79ac7f63e7c7df4a4f3d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:57:45 +0000 Subject: [PATCH 7/8] Update dependency chart.js to v4.4.6 (#22612) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 774c9e9bfa83..97b0732e1201 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "@webcomponents/scoped-custom-element-registry": "0.0.9", "@webcomponents/webcomponentsjs": "2.8.0", "app-datepicker": "5.1.1", - "chart.js": "4.4.5", + "chart.js": "4.4.6", "color-name": "2.0.0", "comlink": "4.4.1", "core-js": "3.38.1", diff --git a/yarn.lock b/yarn.lock index 5a866a60dd77..b6d4ed513af1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6099,12 +6099,12 @@ __metadata: languageName: node linkType: hard -"chart.js@npm:4.4.5": - version: 4.4.5 - resolution: "chart.js@npm:4.4.5" +"chart.js@npm:4.4.6": + version: 4.4.6 + resolution: "chart.js@npm:4.4.6" dependencies: "@kurkle/color": "npm:^0.3.0" - checksum: 10/def643ed3ae898f3f37a0a59b5f1a36ffaf68c8a4f4392dcfebb6e5872534065d04b5b437b25c2b3065c20799403b4436a356bdd1700727267b3b468fec49f84 + checksum: 10/50d0c13a16fd8c156784ff5e4c79070f09325147b0ee5c64d6d3a17933dd9072027dbc72c561cdd8aa41183d8e5736ef634c9843767f79e8abcf1fa0fd03543b languageName: node linkType: hard @@ -8824,7 +8824,7 @@ __metadata: babel-plugin-template-html-minifier: "npm:4.1.0" browserslist-useragent-regexp: "npm:4.1.3" chai: "npm:5.1.2" - chart.js: "npm:4.4.5" + chart.js: "npm:4.4.6" color-name: "npm:2.0.0" comlink: "npm:4.4.1" core-js: "npm:3.38.1" From a4bb0e04ab59c673570d2cf151e155fc6dc4db5b Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 31 Oct 2024 15:13:21 +0100 Subject: [PATCH 8/8] Bumped version to 20241031.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 01f228165544..9cc215662c9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20241030.0" +version = "20241031.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md"