20241031.0 (#22613)

This commit is contained in:
Paul Bottein 2024-10-31 15:14:02 +01:00 committed by GitHub
commit deb077b5e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 117 additions and 34 deletions

View File

@ -374,6 +374,9 @@ export class HassioBackups extends LitElement {
haStyle, haStyle,
hassioStyle, hassioStyle,
css` css`
:host {
color: var(--primary-text-color);
}
.table-header { .table-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

View File

@ -120,9 +120,6 @@ class HassioRepositoriesDialog extends LitElement {
</div> </div>
<div class="delete" slot="end"> <div class="delete" slot="end">
<ha-icon-button <ha-icon-button
.label=${this._dialogParams!.supervisor.localize(
"dialog.repositories.remove"
)}
.disabled=${usedRepositories.includes(repo.slug)} .disabled=${usedRepositories.includes(repo.slug)}
.slug=${repo.slug} .slug=${repo.slug}
.path=${usedRepositories.includes(repo.slug) .path=${usedRepositories.includes(repo.slug)
@ -146,7 +143,11 @@ class HassioRepositoriesDialog extends LitElement {
</ha-md-list-item> </ha-md-list-item>
` `
) )
: html`<ha-md-list-item> No repositories </ha-md-list-item>`} : html`<ha-md-list-item
>${this._dialogParams!.supervisor.localize(
"dialog.repositories.no_repositories"
)}</ha-md-list-item
>`}
</ha-md-list> </ha-md-list>
<div class="layout horizontal bottom"> <div class="layout horizontal bottom">
<ha-textfield <ha-textfield
@ -212,6 +213,7 @@ class HassioRepositoriesDialog extends LitElement {
} }
ha-md-list-item { ha-md-list-item {
position: relative; position: relative;
--md-item-overflow: visible;
} }
`, `,
]; ];

View File

@ -98,7 +98,7 @@
"@webcomponents/scoped-custom-element-registry": "0.0.9", "@webcomponents/scoped-custom-element-registry": "0.0.9",
"@webcomponents/webcomponentsjs": "2.8.0", "@webcomponents/webcomponentsjs": "2.8.0",
"app-datepicker": "5.1.1", "app-datepicker": "5.1.1",
"chart.js": "4.4.5", "chart.js": "4.4.6",
"color-name": "2.0.0", "color-name": "2.0.0",
"comlink": "4.4.1", "comlink": "4.4.1",
"core-js": "3.38.1", "core-js": "3.38.1",

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "home-assistant-frontend" name = "home-assistant-frontend"
version = "20241030.0" version = "20241031.0"
license = {text = "Apache-2.0"} license = {text = "Apache-2.0"}
description = "The Home Assistant frontend" description = "The Home Assistant frontend"
readme = "README.md" readme = "README.md"

View File

@ -25,7 +25,6 @@ export class HaBadge extends LitElement {
static get styles(): CSSResultGroup { static get styles(): CSSResultGroup {
return css` return css`
:host { :host {
color: var(--secondary-text-color);
} }
[role="button"] { [role="button"] {
cursor: pointer; cursor: pointer;
@ -36,11 +35,10 @@ export class HaBadge extends LitElement {
white-space: nowrap; white-space: nowrap;
align-items: center; align-items: center;
gap: 3px; gap: 3px;
font-family: Roboto; color: var(--ha-heading-badge-text-color, var(--secondary-text-color));
font-size: 14px; font-size: var(--ha-heading-badge-font-size, 14px);
font-style: normal; font-weight: var(--ha-heading-badge-font-weight, 400);
font-weight: 400; line-height: var(--ha-heading-badge-line-height, 20px);
line-height: 20px;
letter-spacing: 0.1px; letter-spacing: 0.1px;
--mdc-icon-size: 14px; --mdc-icon-size: 14px;
} }

View File

@ -15,6 +15,9 @@ export class HaMdListItem extends MdListItem {
--md-sys-color-on-surface: var(--primary-text-color); --md-sys-color-on-surface: var(--primary-text-color);
--md-sys-color-on-surface-variant: var(--secondary-text-color); --md-sys-color-on-surface-variant: var(--secondary-text-color);
} }
md-item {
overflow: var(--md-item-overflow, hidden);
}
`, `,
]; ];
} }

View File

@ -203,6 +203,20 @@ export const fetchHassioLogs = async (
); );
export const fetchHassioLogsFollow = 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, hass: HomeAssistant,
provider: string, provider: string,
signal: AbortSignal, signal: AbortSignal,
@ -222,7 +236,12 @@ export const getHassioLogDownloadUrl = (provider: string) =>
provider.includes("_") ? `addons/${provider}` : provider provider.includes("_") ? `addons/${provider}` : provider
}/logs`; }/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, provider: string,
lines: number, lines: number,
boot = 0 boot = 0

View File

@ -28,7 +28,7 @@ export interface UrlActionConfig extends BaseActionConfig {
export interface MoreInfoActionConfig extends BaseActionConfig { export interface MoreInfoActionConfig extends BaseActionConfig {
action: "more-info"; action: "more-info";
entity_id?: string; entity?: string;
} }
export interface AssistActionConfig extends BaseActionConfig { export interface AssistActionConfig extends BaseActionConfig {

View File

@ -371,11 +371,13 @@ export class HaTabsSubpageDataTable extends LitElement {
</div> </div>
</ha-md-menu-item> </ha-md-menu-item>
</ha-md-button-menu> </ha-md-button-menu>
<p> ${this.selected !== undefined
? html`<p>
${localize("ui.components.subpage-data-table.selected", { ${localize("ui.components.subpage-data-table.selected", {
selected: this.selected || "0", selected: this.selected || "0",
})} })}
</p> </p>`
: nothing}
</div> </div>
<div class="center-vertical"> <div class="center-vertical">
<slot name="selection-bar"></slot> <slot name="selection-bar"></slot>

View File

@ -14,7 +14,10 @@ import type { DownloadLogsDialogParams } from "./show-dialog-download-logs";
import "../../../components/ha-select"; import "../../../components/ha-select";
import "../../../components/ha-list-item"; import "../../../components/ha-list-item";
import { stopPropagation } from "../../../common/dom/stop_propagation"; 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 { getSignedPath } from "../../../data/auth";
import { fileDownload } from "../../../util/file_download"; import { fileDownload } from "../../../util/file_download";
@ -112,7 +115,7 @@ class DownloadLogsDialog extends LitElement {
const boot = this._dialogParams!.boot; const boot = this._dialogParams!.boot;
const timeString = new Date().toISOString().replace(/:/g, "-"); const timeString = new Date().toISOString().replace(/:/g, "-");
const downloadUrl = getHassioLogDownloadLinesUrl( const downloadUrl = this._getDownloadUrlFunction()(
provider, provider,
this._lineCount, this._lineCount,
boot boot
@ -126,6 +129,13 @@ class DownloadLogsDialog extends LitElement {
this.closeDialog(); this.closeDialog();
} }
private _getDownloadUrlFunction() {
if (this._dialogParams!.boot === 0) {
return getHassioLogDownloadLinesUrl;
}
return getHassioLogBootDownloadLinesUrl;
}
private _setNumberOfLogs(ev) { private _setNumberOfLogs(ev) {
this._lineCount = Number(ev.target.value); this._lineCount = Number(ev.target.value);
} }

View File

@ -39,6 +39,7 @@ import { extractApiErrorMessage } from "../../../data/hassio/common";
import { import {
fetchHassioBoots, fetchHassioBoots,
fetchHassioLogs, fetchHassioLogs,
fetchHassioLogsBootFollow,
fetchHassioLogsFollow, fetchHassioLogsFollow,
getHassioLogDownloadUrl, getHassioLogDownloadUrl,
} from "../../../data/hassio/supervisor"; } from "../../../data/hassio/supervisor";
@ -378,7 +379,7 @@ class ErrorLogCard extends LitElement {
isComponentLoaded(this.hass, "hassio") && isComponentLoaded(this.hass, "hassio") &&
this.provider this.provider
) { ) {
const response = await fetchHassioLogsFollow( const response = await this._fetchLogsFunction()(
this.hass, this.hass,
this.provider, this.provider,
this._logStreamAborter.signal, this._logStreamAborter.signal,
@ -468,6 +469,13 @@ class ErrorLogCard extends LitElement {
} }
} }
private _fetchLogsFunction = () => {
if (this._boot === 0) {
return fetchHassioLogsFollow;
}
return fetchHassioLogsBootFollow;
};
private _debounceSearch = debounce(() => { private _debounceSearch = debounce(() => {
this._noSearchResults = !this._ansiToHtmlElement?.filterLines(this.filter); this._noSearchResults = !this._ansiToHtmlElement?.filterLines(this.filter);
@ -570,9 +578,14 @@ class ErrorLogCard extends LitElement {
if (this._streamSupported && isComponentLoaded(this.hass, "hassio")) { if (this._streamSupported && isComponentLoaded(this.hass, "hassio")) {
try { try {
const { data } = await fetchHassioBoots(this.hass); const { data } = await fetchHassioBoots(this.hass);
this._boots = Object.keys(data.boots) const boots = Object.keys(data.boots)
.map(Number) .map(Number)
.sort((a, b) => b - a); .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) { } catch (err: any) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(err); console.error(err);

View File

@ -86,10 +86,11 @@ export class HuiCard extends ReactiveElement {
return this._element.getGridOptions(); return this._element.getGridOptions();
} }
if (this._element.getLayoutOptions) { 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 // eslint-disable-next-line no-console
console.warn( // console.warn(
`This card (${this.config?.type}) is using "getLayoutOptions" and it is deprecated, contact the developer to suggest to use "getGridOptions" instead` // `This card (${this.config?.type}) is using "getLayoutOptions" and it is deprecated, contact the developer to suggest to use "getGridOptions" instead`
); // );
const options = migrateLayoutToGridOptions( const options = migrateLayoutToGridOptions(
this._element.getLayoutOptions() this._element.getLayoutOptions()
); );

View File

@ -95,7 +95,7 @@ export const handleAction = async (
switch (actionConfig.action) { switch (actionConfig.action) {
case "more-info": { case "more-info": {
const entityId = const entityId =
actionConfig.entity_id || actionConfig.entity ||
config.entity || config.entity ||
config.camera_image || config.camera_image ||
config.image_entity; config.image_entity;

View File

@ -63,7 +63,7 @@ const actionConfigStructAssist = type({
const actionConfigStructMoreInfo = type({ const actionConfigStructMoreInfo = type({
action: literal("more-info"), action: literal("more-info"),
entity_id: optional(string()), entity: optional(string()),
}); });
export const actionConfigStructType = object({ export const actionConfigStructType = object({

View File

@ -7774,7 +7774,8 @@
"title": "Manage add-on repositories", "title": "Manage add-on repositories",
"add": "Add", "add": "Add",
"remove": "Remove", "remove": "Remove",
"used": "Repository is in use for installed add-ons and can't be removed." "used": "Repository is in use for installed add-ons and can't be removed.",
"no_repositories": "No repositories"
}, },
"restart_addon": { "restart_addon": {
"title": "Restart {name}?", "title": "Restart {name}?",
@ -7814,6 +7815,37 @@
"cancel": "[%key:ui::common::cancel%]", "cancel": "[%key:ui::common::cancel%]",
"move": "Move" "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%]"
}
}
}
} }
} }
} }

View File

@ -6099,12 +6099,12 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"chart.js@npm:4.4.5": "chart.js@npm:4.4.6":
version: 4.4.5 version: 4.4.6
resolution: "chart.js@npm:4.4.5" resolution: "chart.js@npm:4.4.6"
dependencies: dependencies:
"@kurkle/color": "npm:^0.3.0" "@kurkle/color": "npm:^0.3.0"
checksum: 10/def643ed3ae898f3f37a0a59b5f1a36ffaf68c8a4f4392dcfebb6e5872534065d04b5b437b25c2b3065c20799403b4436a356bdd1700727267b3b468fec49f84 checksum: 10/50d0c13a16fd8c156784ff5e4c79070f09325147b0ee5c64d6d3a17933dd9072027dbc72c561cdd8aa41183d8e5736ef634c9843767f79e8abcf1fa0fd03543b
languageName: node languageName: node
linkType: hard linkType: hard
@ -8824,7 +8824,7 @@ __metadata:
babel-plugin-template-html-minifier: "npm:4.1.0" babel-plugin-template-html-minifier: "npm:4.1.0"
browserslist-useragent-regexp: "npm:4.1.3" browserslist-useragent-regexp: "npm:4.1.3"
chai: "npm:5.1.2" chai: "npm:5.1.2"
chart.js: "npm:4.4.5" chart.js: "npm:4.4.6"
color-name: "npm:2.0.0" color-name: "npm:2.0.0"
comlink: "npm:4.4.1" comlink: "npm:4.4.1"
core-js: "npm:3.38.1" core-js: "npm:3.38.1"