Skip to content

Commit

Permalink
20240101.0 (#19217)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten authored Jan 1, 2024
2 parents 7b4ecfd + d0c1481 commit aa94ec7
Show file tree
Hide file tree
Showing 16 changed files with 254 additions and 198 deletions.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
"@material/mwc-top-app-bar-fixed": "0.27.0",
"@material/top-app-bar": "=14.0.0-canary.53b3cad2f.0",
"@material/web": "=1.1.1",
"@mdi/js": "7.3.67",
"@mdi/svg": "7.3.67",
"@mdi/js": "7.4.47",
"@mdi/svg": "7.4.47",
"@polymer/paper-input": "3.2.1",
"@polymer/paper-item": "3.0.1",
"@polymer/paper-listbox": "3.0.1",
Expand Down Expand Up @@ -184,13 +184,13 @@
"@types/tar": "6.1.10",
"@types/ua-parser-js": "0.7.39",
"@types/webspeechapi": "0.0.29",
"@typescript-eslint/eslint-plugin": "6.15.0",
"@typescript-eslint/parser": "6.15.0",
"@typescript-eslint/eslint-plugin": "6.16.0",
"@typescript-eslint/parser": "6.16.0",
"@web/dev-server": "0.1.38",
"@web/dev-server-rollup": "0.4.1",
"babel-loader": "9.1.3",
"babel-plugin-template-html-minifier": "4.1.0",
"chai": "4.3.10",
"chai": "5.0.0",
"del": "7.1.0",
"eslint": "8.56.0",
"eslint-config-airbnb-base": "15.0.0",
Expand Down Expand Up @@ -223,19 +223,19 @@
"map-stream": "0.0.7",
"mocha": "10.2.0",
"object-hash": "3.0.0",
"open": "10.0.1",
"open": "10.0.2",
"pinst": "3.0.0",
"prettier": "3.1.1",
"rollup": "2.79.1",
"rollup-plugin-string": "3.0.0",
"rollup-plugin-terser": "7.0.2",
"rollup-plugin-visualizer": "5.11.0",
"rollup-plugin-visualizer": "5.12.0",
"serve-handler": "6.1.5",
"sinon": "17.0.1",
"source-map-url": "0.4.1",
"systemjs": "6.14.2",
"tar": "6.2.0",
"terser-webpack-plugin": "5.3.9",
"terser-webpack-plugin": "5.3.10",
"ts-lit-plugin": "2.0.1",
"typescript": "5.3.3",
"vinyl-buffer": "1.0.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 = "20231228.0"
version = "20240101.0"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"
Expand Down
18 changes: 16 additions & 2 deletions src/components/ha-date-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export interface datePickerDialogParams {
max?: string;
locale?: string;
firstWeekday?: number;
onChange: (value: string) => void;
canClear?: boolean;
onChange: (value: string | undefined) => void;
}

const showDatePickerDialog = (
Expand Down Expand Up @@ -49,6 +50,8 @@ export class HaDateInput extends LitElement {

@property() public helper?: string;

@property({ type: Boolean }) public canClear?: boolean;

render() {
return html`<ha-textfield
.label=${this.label}
Expand All @@ -58,6 +61,7 @@ export class HaDateInput extends LitElement {
helperPersistent
readonly
@click=${this._openDialog}
@keydown=${this._keyDown}
.value=${this.value
? formatDateNumeric(
new Date(`${this.value.split("T")[0]}T00:00:00`),
Expand All @@ -82,13 +86,23 @@ export class HaDateInput extends LitElement {
min: this.min || "1970-01-01",
max: this.max,
value: this.value,
canClear: this.canClear,
onChange: (value) => this._valueChanged(value),
locale: this.locale.language,
firstWeekday: firstWeekdayIndex(this.locale),
});
}

private _valueChanged(value: string) {
private _keyDown(ev: KeyboardEvent) {
if (!this.canClear) {
return;
}
if (["Backspace", "Delete"].includes(ev.key)) {
this._valueChanged(undefined);
}
}

private _valueChanged(value: string | undefined) {
if (this.value !== value) {
this.value = value;
fireEvent(this, "change");
Expand Down
14 changes: 14 additions & 0 deletions src/components/ha-dialog-date-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ export class HaDialogDatePicker extends LitElement {
@datepicker-value-updated=${this._valueChanged}
.firstDayOfWeek=${this._params.firstWeekday}
></app-datepicker>
${this._params.canClear
? html`<mwc-button
slot="secondaryAction"
@click=${this._clear}
class="warning"
>
${this.hass.localize("ui.dialogs.date-picker.clear")}
</mwc-button>`
: nothing}
<mwc-button slot="secondaryAction" @click=${this._setToday}>
${this.hass.localize("ui.dialogs.date-picker.today")}
</mwc-button>
Expand All @@ -66,6 +75,11 @@ export class HaDialogDatePicker extends LitElement {
this._value = ev.detail.value;
}

private _clear() {
this._params?.onChange(undefined);
this.closeDialog();
}

private _setToday() {
const today = new Date();
this._value = format(today, "yyyy-MM-dd");
Expand Down
2 changes: 1 addition & 1 deletion src/components/media-player/ha-browse-media-tts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class BrowseMediaTTS extends LitElement {
this.hass.localize(
"ui.components.media-browser.tts.example_message",
{
name: this.hass.user?.name || "",
name: this.hass.user?.name || "Alice",
}
)}
>
Expand Down
14 changes: 11 additions & 3 deletions src/components/trace/ha-trace-path-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class HaTracePathDetails extends LitElement {

if (result?.enabled === false) {
return html`${this.hass!.localize(
"ui.panel.config.automation.trace.path.disabled_node"
"ui.panel.config.automation.trace.path.disabled_step"
)}`;
}

Expand Down Expand Up @@ -208,11 +208,19 @@ export class HaTracePathDetails extends LitElement {
const paths = this.trace.trace;
const data: ActionTraceStep[] = paths[this.selected.path];

if (data === undefined) {
return html`<div class="padded-box">
${this.hass!.localize(
"ui.panel.config.automation.trace.path.step_not_executed"
)}
</div>`;
}

return html`
<div class="padded-box">
${data.map(
(trace, idx) => html`
${idx > 0
${data.length > 1
? html`<p>
${this.hass!.localize(
"ui.panel.config.automation.trace.path.iteration",
Expand Down Expand Up @@ -240,7 +248,7 @@ export class HaTracePathDetails extends LitElement {
if (index === -1) {
return html`<div class="padded-box">
${this.hass!.localize(
"ui.panel.config.automation.trace.path.node_not_tracked"
"ui.panel.config.automation.trace.path.step_not_executed"
)}
</div>`;
}
Expand Down
8 changes: 4 additions & 4 deletions src/data/todo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export interface TodoItem {
uid: string;
summary: string;
status: TodoItemStatus;
description?: string;
due?: string;
description?: string | null;
due?: string | null;
}

export const enum TodoListEntityFeature {
Expand Down Expand Up @@ -83,9 +83,9 @@ export const updateItem = (
item: item.uid,
rename: item.summary,
status: item.status,
description: item.description || undefined,
description: item.description || null,
due_datetime: item.due?.includes("T") ? item.due : undefined,
due_date: item.due?.includes("T") ? undefined : item.due || undefined,
due_date: item.due?.includes("T") ? undefined : item.due || null,
},
{ entity_id }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { HomeAssistant } from "../../../../../types";
import "../ha-automation-action";
import type { ActionElement } from "../ha-automation-action-row";

import { isTemplate } from "../../../../../common/string/has-template";
import type { LocalizeFunc } from "../../../../../common/translations/localize";
import "../../../../../components/ha-form/ha-form";
import type { SchemaUnion } from "../../../../../components/ha-form/types";
Expand All @@ -32,7 +33,12 @@ export class HaRepeatAction extends LitElement implements ActionElement {
}

private _schema = memoizeOne(
(localize: LocalizeFunc, type: string, reOrderMode: boolean) =>
(
localize: LocalizeFunc,
type: string,
reOrderMode: boolean,
template: boolean
) =>
[
{
name: "type",
Expand All @@ -53,7 +59,9 @@ export class HaRepeatAction extends LitElement implements ActionElement {
{
name: "count",
required: true,
selector: { number: { mode: "box", min: 1 } },
selector: template
? ({ template: {} } as const)
: ({ number: { mode: "box", min: 1 } } as const),
},
] as const)
: []),
Expand Down Expand Up @@ -89,10 +97,13 @@ export class HaRepeatAction extends LitElement implements ActionElement {
const schema = this._schema(
this.hass.localize,
type ?? "count",
this.reOrderMode
this.reOrderMode,
"count" in action && typeof action.count === "string"
? isTemplate(action.count)
: false
);
const data = { ...action, type };
return html` <ha-form
return html`<ha-form
.hass=${this.hass}
.data=${data}
.schema=${schema}
Expand Down
51 changes: 25 additions & 26 deletions src/panels/config/automation/add-automation-element-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
): ListItem[] => {
if (type === "action" && isService(group)) {
const result = this._services(localize, services, manifests, group);
if (group === "service_media_player") {
if (group === `${SERVICE_PREFIX}media_player`) {
result.unshift(this._convertToItem("play_media", {}, type, localize));
}
return result;
Expand Down Expand Up @@ -254,31 +254,29 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
return [];
}
const result: ListItem[] = [];
Object.keys(services)
.sort()
.forEach((domain) => {
const manifest = manifests[domain];
if (
(type === undefined &&
manifest?.integration_type === "entity" &&
!ENTITY_DOMAINS_OTHER.has(domain)) ||
(type === "helper" && manifest?.integration_type === "helper") ||
(type === "other" &&
(ENTITY_DOMAINS_OTHER.has(domain) ||
!["helper", "entity"].includes(
manifest?.integration_type || ""
)))
) {
result.push({
group: true,
icon: domainIcon(domain),
key: `${SERVICE_PREFIX}${domain}`,
name: domainToName(localize, domain, manifest),
description: "",
});
}
});
return result;
Object.keys(services).forEach((domain) => {
const manifest = manifests[domain];
if (
(type === undefined &&
manifest?.integration_type === "entity" &&
!ENTITY_DOMAINS_OTHER.has(domain)) ||
(type === "helper" && manifest?.integration_type === "helper") ||
(type === "other" &&
(ENTITY_DOMAINS_OTHER.has(domain) ||
!["helper", "entity"].includes(manifest?.integration_type || "")))
) {
result.push({
group: true,
icon: domainIcon(domain),
key: `${SERVICE_PREFIX}${domain}`,
name: domainToName(localize, domain, manifest),
description: "",
});
}
});
return result.sort((a, b) =>
stringCompare(a.name, b.name, this.hass.locale.language)
);
}
);

Expand Down Expand Up @@ -515,6 +513,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
}

private _back() {
this._dialog!.scrollToPos(0, 0);
if (this._filter) {
this._filter = "";
return;
Expand Down
3 changes: 2 additions & 1 deletion src/panels/config/automation/ha-automation-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ class HaAutomationPicker extends LitElement {
</p>
<p>
${this.hass.localize(
"ui.panel.config.automation.picker.empty_text_2"
"ui.panel.config.automation.picker.empty_text_2",
{ user: this.hass.user?.name || "Alice" }
)}
</p>
<a
Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/automation/manual-automation-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class HaManualAutomationEditor extends LitElement {
? html`<p>
${this.hass.localize(
"ui.panel.config.automation.editor.conditions.description",
{ user: this.hass.user?.name }
{ user: this.hass.user?.name || "Alice" }
)}
</p>`
: nothing}
Expand Down
10 changes: 7 additions & 3 deletions src/panels/config/integrations/dialog-add-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,17 +340,21 @@ class AddIntegrationDialog extends LitElement {
!("integrations" in integration) &&
!this._flowsInProgress?.length
) {
return "What type of device is it?";
return this.hass.localize(
"ui.panel.config.integrations.what_device_type"
);
}
if (
integration &&
!integration?.iot_standards &&
!("integrations" in integration) &&
this._flowsInProgress?.length
) {
return "Want to add these discovered devices?";
return this.hass.localize(
"ui.panel.config.integrations.confirm_add_discovered"
);
}
return "What do you want to add?";
return this.hass.localize("ui.panel.config.integrations.what_to_add");
}

private _renderIntegration(
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/scene/ha-scene-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ export class HaSceneEditor extends SubscribeMixin(
if (
!entity.device_id ||
entity.entity_category ||
entity.hidden_by ||
SCENE_IGNORED_DOMAINS.includes(computeDomain(entity.entity_id))
) {
continue;
Expand Down
Loading

0 comments on commit aa94ec7

Please sign in to comment.