Skip to content

Commit

Permalink
20241031.0 (#22613)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Oct 31, 2024
2 parents 79e223c + a4bb0e0 commit deb077b
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 34 deletions.
3 changes: 3 additions & 0 deletions hassio/src/backups/hassio-backups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions hassio/src/dialogs/repositories/dialog-hassio-repositories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ class HassioRepositoriesDialog extends LitElement {
</div>
<div class="delete" slot="end">
<ha-icon-button
.label=${this._dialogParams!.supervisor.localize(
"dialog.repositories.remove"
)}
.disabled=${usedRepositories.includes(repo.slug)}
.slug=${repo.slug}
.path=${usedRepositories.includes(repo.slug)
Expand All @@ -146,7 +143,11 @@ class HassioRepositoriesDialog extends LitElement {
</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>
<div class="layout horizontal bottom">
<ha-textfield
Expand Down Expand Up @@ -212,6 +213,7 @@ class HassioRepositoriesDialog extends LitElement {
}
ha-md-list-item {
position: relative;
--md-item-overflow: visible;
}
`,
];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 4 additions & 6 deletions src/components/ha-heading-badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions src/components/ha-md-list-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export class HaMdListItem extends MdListItem {
--md-sys-color-on-surface: var(--primary-text-color);
--md-sys-color-on-surface-variant: var(--secondary-text-color);
}
md-item {
overflow: var(--md-item-overflow, hidden);
}
`,
];
}
Expand Down
21 changes: 20 additions & 1 deletion src/data/hassio/supervisor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/data/lovelace/config/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 7 additions & 5 deletions src/layouts/hass-tabs-subpage-data-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,13 @@ export class HaTabsSubpageDataTable extends LitElement {
</div>
</ha-md-menu-item>
</ha-md-button-menu>
<p>
${localize("ui.components.subpage-data-table.selected", {
selected: this.selected || "0",
})}
</p>
${this.selected !== undefined
? html`<p>
${localize("ui.components.subpage-data-table.selected", {
selected: this.selected || "0",
})}
</p>`
: nothing}
</div>
<div class="center-vertical">
<slot name="selection-bar"></slot>
Expand Down
14 changes: 12 additions & 2 deletions src/panels/config/logs/dialog-download-logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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
Expand All @@ -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);
}
Expand Down
17 changes: 15 additions & 2 deletions src/panels/config/logs/error-log-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { extractApiErrorMessage } from "../../../data/hassio/common";
import {
fetchHassioBoots,
fetchHassioLogs,
fetchHassioLogsBootFollow,
fetchHassioLogsFollow,
getHassioLogDownloadUrl,
} from "../../../data/hassio/supervisor";
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions src/panels/lovelace/cards/hui-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
Expand Down
2 changes: 1 addition & 1 deletion src/panels/lovelace/common/handle-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/panels/lovelace/editor/structs/action-struct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
34 changes: 33 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7774,7 +7774,8 @@
"title": "Manage add-on repositories",
"add": "Add",
"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": {
"title": "Restart {name}?",
Expand Down Expand Up @@ -7814,6 +7815,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%]"
}
}
}
}
}
}
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit deb077b

Please sign in to comment.