Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20241106.0 #22695

Merged
merged 12 commits into from
Nov 6, 2024
Merged
3 changes: 2 additions & 1 deletion hassio/src/addon-view/log/hassio-addon-log-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ class HassioAddonLogDashboard extends LitElement {
@value-changed=${this._filterChanged}
.hass=${this.hass}
.filter=${this._filter}
.label=${this.hass.localize("ui.panel.config.logs.search")}
.label=${this.supervisor.localize("ui.panel.config.logs.search")}
></search-input>
</div>
<div class="content">
<error-log-card
.hass=${this.hass}
.localizeFunc=${this.supervisor.localize}
.header=${this.addon.name}
.provider=${this.addon.slug}
show
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 = "20241105.0"
version = "20241106.0"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"
Expand Down
10 changes: 8 additions & 2 deletions src/components/ha-ansi-to-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
query,
state as litState,
} from "lit/decorators";
import { classMap } from "lit/directives/class-map";

interface State {
bold: boolean;
Expand All @@ -26,12 +27,15 @@ interface State {
export class HaAnsiToHtml extends LitElement {
@property() public content!: string;

@property({ type: Boolean, attribute: "wrap-disabled" }) public wrapDisabled =
false;

@query("pre") private _pre?: HTMLPreElement;

@litState() private _filter = "";

protected render(): TemplateResult | void {
return html`<pre></pre>`;
return html`<pre class=${classMap({ wrap: !this.wrapDisabled })}></pre>`;
}

protected firstUpdated(_changedProperties: PropertyValues): void {
Expand All @@ -47,9 +51,11 @@ export class HaAnsiToHtml extends LitElement {
return css`
pre {
overflow-x: auto;
margin: 0;
}
pre.wrap {
white-space: pre-wrap;
overflow-wrap: break-word;
margin: 0;
}
.bold {
font-weight: bold;
Expand Down
5 changes: 4 additions & 1 deletion src/components/trace/ha-trace-logbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export class HaTraceLogbook extends LitElement {
.entries=${this.logbookEntries}
.narrow=${this.narrow}
></ha-logbook-renderer>
<hat-logbook-note .domain=${this.trace.domain}></hat-logbook-note>
<hat-logbook-note
.hass=${this.hass}
.domain=${this.trace.domain}
></hat-logbook-note>
`
: html`<div class="padded-box">
No Logbook entries found for this step.
Expand Down
5 changes: 4 additions & 1 deletion src/components/trace/ha-trace-path-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ export class HaTracePathDetails extends LitElement {
.entries=${entries}
.narrow=${this.narrow}
></ha-logbook-renderer>
<hat-logbook-note .domain=${this.trace.domain}></hat-logbook-note>
<hat-logbook-note
.hass=${this.hass}
.domain=${this.trace.domain}
></hat-logbook-note>
`
: html`<div class="padded-box">
${this.hass!.localize(
Expand Down
5 changes: 4 additions & 1 deletion src/components/trace/ha-trace-timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export class HaTraceTimeline extends LitElement {
allowPick
>
</hat-trace-timeline>
<hat-logbook-note .domain=${this.trace.domain}></hat-logbook-note>
<hat-logbook-note
.hass=${this.hass}
.domain=${this.trace.domain}
></hat-logbook-note>
`;
}

Expand Down
18 changes: 13 additions & 5 deletions src/components/trace/hat-logbook-note.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import { css, html, LitElement } from "lit";
import { css, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import type { HomeAssistant } from "../../types";

@customElement("hat-logbook-note")
class HatLogbookNote extends LitElement {
@property() public domain = "automation";
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public domain: "automation" | "script" = "automation";

render() {
return html`
Not all shown logbook entries might be related to this ${this.domain}.
`;
if (this.domain === "script") {
return this.hass.localize(
"ui.panel.config.automation.trace.messages.not_all_entries_are_related_script_note"
);
}
return this.hass.localize(
"ui.panel.config.automation.trace.messages.not_all_entries_are_related_automation_note"
);
}

static styles = css`
Expand Down
111 changes: 60 additions & 51 deletions src/dialogs/more-info/controls/more-info-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,59 +52,61 @@ class MoreInfoUpdate extends LitElement {

return html`
<div class="content">
${this.stateObj.attributes.in_progress
? supportsFeature(this.stateObj, UpdateEntityFeature.PROGRESS) &&
this.stateObj.attributes.update_percentage !== null
? html`<mwc-linear-progress
.progress=${this.stateObj.attributes.update_percentage / 100}
buffer=""
></mwc-linear-progress>`
: html`<mwc-linear-progress indeterminate></mwc-linear-progress>`
: nothing}
<h3>${this.stateObj.attributes.title}</h3>
${this._error
? html`<ha-alert alert-type="error">${this._error}</ha-alert>`
: nothing}
<div class="row">
<div class="key">
${this.hass.formatEntityAttributeName(
this.stateObj,
"installed_version"
)}
</div>
<div class="value">
${this.stateObj.attributes.installed_version ??
this.hass.localize("state.default.unavailable")}
</div>
</div>
<div class="row">
<div class="key">
${this.hass.formatEntityAttributeName(
this.stateObj,
"latest_version"
)}
<div class="summary">
${this.stateObj.attributes.in_progress
? supportsFeature(this.stateObj, UpdateEntityFeature.PROGRESS) &&
this.stateObj.attributes.update_percentage !== null
? html`<mwc-linear-progress
.progress=${this.stateObj.attributes.update_percentage / 100}
buffer=""
></mwc-linear-progress>`
: html`<mwc-linear-progress indeterminate></mwc-linear-progress>`
: nothing}
<h3>${this.stateObj.attributes.title}</h3>
${this._error
? html`<ha-alert alert-type="error">${this._error}</ha-alert>`
: nothing}
<div class="row">
<div class="key">
${this.hass.formatEntityAttributeName(
this.stateObj,
"installed_version"
)}
</div>
<div class="value">
${this.stateObj.attributes.installed_version ??
this.hass.localize("state.default.unavailable")}
</div>
</div>
<div class="value">
${this.stateObj.attributes.latest_version ??
this.hass.localize("state.default.unavailable")}
<div class="row">
<div class="key">
${this.hass.formatEntityAttributeName(
this.stateObj,
"latest_version"
)}
</div>
<div class="value">
${this.stateObj.attributes.latest_version ??
this.hass.localize("state.default.unavailable")}
</div>
</div>
</div>

${this.stateObj.attributes.release_url
? html`<div class="row">
<div class="key">
<a
href=${this.stateObj.attributes.release_url}
target="_blank"
rel="noreferrer"
>
${this.hass.localize(
"ui.dialogs.more_info_control.update.release_announcement"
)}
</a>
</div>
</div>`
: nothing}
${this.stateObj.attributes.release_url
? html`<div class="row">
<div class="key">
<a
href=${this.stateObj.attributes.release_url}
target="_blank"
rel="noreferrer"
>
${this.hass.localize(
"ui.dialogs.more_info_control.update.release_announcement"
)}
</a>
</div>
</div>`
: nothing}
</div>
${supportsFeature(this.stateObj!, UpdateEntityFeature.RELEASE_NOTES) &&
!this._error
? this._releaseNotes === undefined
Expand Down Expand Up @@ -293,6 +295,11 @@ class MoreInfoUpdate extends LitElement {
ha-expansion-panel {
margin: 16px 0;
}

.summary {
margin-bottom: 16px;
}

.row {
margin: 0;
display: flex;
Expand All @@ -308,7 +315,9 @@ class MoreInfoUpdate extends LitElement {
);
position: sticky;
bottom: 0;
margin: 0 -24px -24px -24px;
margin: 0 -24px 0 -24px;
margin-bottom: calc(-1 * max(env(safe-area-inset-bottom), 24px));
padding-bottom: env(safe-area-inset-bottom);
box-sizing: border-box;
display: flex;
flex-direction: column;
Expand Down
1 change: 1 addition & 0 deletions src/external_app/external_messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ export interface ExternalConfig {
hasAssist: boolean;
hasBarCodeScanner: number;
canSetupImprov: boolean;
downloadFileSupported: boolean;
}

export class ExternalMessaging {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
}`,
description:
this.hass.localize(
`component.${domain}.services.${service}.description`
`component.${dmn}.services.${service}.description`
) || services[dmn][service]?.description,
});
}
Expand Down
16 changes: 9 additions & 7 deletions src/panels/config/logs/dialog-download-logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ import type { HomeAssistant } from "../../../types";
import { fileDownload } from "../../../util/file_download";
import type { DownloadLogsDialogParams } from "./show-dialog-download-logs";

const DEFAULT_LINE_COUNT = 500;

@customElement("dialog-download-logs")
class DownloadLogsDialog extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@state() private _dialogParams?: DownloadLogsDialogParams;

@state() private _lineCount = 100;
@state() private _lineCount = DEFAULT_LINE_COUNT;

@query("ha-md-dialog") private _dialogElement!: HaMdDialog;

public showDialog(dialogParams: DownloadLogsDialogParams) {
this._dialogParams = dialogParams;
this._lineCount = this._dialogParams?.defaultLineCount ?? 100;
this._lineCount = this._dialogParams?.defaultLineCount || 500;
}

public closeDialog() {
Expand All @@ -38,7 +40,7 @@ class DownloadLogsDialog extends LitElement {

private _dialogClosed() {
this._dialogParams = undefined;
this._lineCount = 100;
this._lineCount = DEFAULT_LINE_COUNT;
fireEvent(this, "dialog-closed", { dialog: this.localName });
}

Expand All @@ -48,7 +50,7 @@ class DownloadLogsDialog extends LitElement {
}

const numberOfLinesOptions = [100, 500, 1000, 5000, 10000];
if (!numberOfLinesOptions.includes(this._lineCount)) {
if (!numberOfLinesOptions.includes(this._lineCount) && this._lineCount) {
numberOfLinesOptions.push(this._lineCount);
numberOfLinesOptions.sort((a, b) => a - b);
}
Expand All @@ -63,7 +65,7 @@ class DownloadLogsDialog extends LitElement {
.path=${mdiClose}
></ha-icon-button>
<span slot="title" id="dialog-light-color-favorite-title">
${this.hass.localize("ui.panel.config.logs.download_full_log")}
${this.hass.localize("ui.panel.config.logs.download_logs")}
</span>
<span slot="subtitle">
${this._dialogParams.header}${this._dialogParams.boot === 0
Expand Down Expand Up @@ -95,15 +97,15 @@ class DownloadLogsDialog extends LitElement {
<ha-button @click=${this.closeDialog}>
${this.hass.localize("ui.common.cancel")}
</ha-button>
<ha-button @click=${this._dowloadLogs}>
<ha-button @click=${this._downloadLogs}>
${this.hass.localize("ui.common.download")}
</ha-button>
</div>
</ha-md-dialog>
`;
}

private async _dowloadLogs() {
private async _downloadLogs() {
const provider = this._dialogParams!.provider;
const boot = this._dialogParams!.boot;

Expand Down
Loading
Loading