mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-03 22:47:47 +00:00
Review updates
This commit is contained in:
parent
4526a46a56
commit
101e9323a7
@ -602,7 +602,7 @@ export const describeTrigger = (
|
|||||||
|
|
||||||
// Persistent Notification Trigger
|
// Persistent Notification Trigger
|
||||||
if (trigger.platform === "persistent_notification") {
|
if (trigger.platform === "persistent_notification") {
|
||||||
return "When a persistent_notification is updated";
|
return "When a persistent notification is updated";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Device Trigger
|
// Device Trigger
|
||||||
|
@ -10,7 +10,31 @@ import { PersistentNotificationTrigger } from "../../../../../data/automation";
|
|||||||
import { HomeAssistant } from "../../../../../types";
|
import { HomeAssistant } from "../../../../../types";
|
||||||
import { handleChangeEvent } from "../ha-automation-trigger-row";
|
import { handleChangeEvent } from "../ha-automation-trigger-row";
|
||||||
|
|
||||||
const SUPPORTED_UPDATE_TYPES = ["added", "removed", "current", "updated"];
|
const SUPPORTED_UPDATE_TYPES: {
|
||||||
|
value: string;
|
||||||
|
label: string;
|
||||||
|
}[] = [
|
||||||
|
{
|
||||||
|
value: "added",
|
||||||
|
label:
|
||||||
|
"ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.added",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "removed",
|
||||||
|
label:
|
||||||
|
"ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.removed",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "current",
|
||||||
|
label:
|
||||||
|
"ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.current",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "updated",
|
||||||
|
label:
|
||||||
|
"ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.updated",
|
||||||
|
},
|
||||||
|
];
|
||||||
const DEFAULT_UPDATE_TYPES = ["added", "removed"];
|
const DEFAULT_UPDATE_TYPES = ["added", "removed"];
|
||||||
const DEFAULT_NOTIFICATION_ID = "";
|
const DEFAULT_NOTIFICATION_ID = "";
|
||||||
|
|
||||||
@ -30,10 +54,8 @@ export class HaPersistentNotificationTrigger extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
const {
|
const { update_type: updateTypes, notification_id: notificationId } =
|
||||||
update_type: updateTypes,
|
this.trigger;
|
||||||
notification_id: notificationId,
|
|
||||||
} = this.trigger;
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="form">
|
<div class="form">
|
||||||
@ -55,16 +77,18 @@ export class HaPersistentNotificationTrigger extends LitElement {
|
|||||||
(update_type) => html`
|
(update_type) => html`
|
||||||
<ha-check-list-item
|
<ha-check-list-item
|
||||||
left
|
left
|
||||||
.value=${update_type}
|
.value=${update_type.value}
|
||||||
@request-selected=${this._updateTypeChanged}
|
@request-selected=${this._updateTypeChanged}
|
||||||
.selected=${updateTypes!.includes(update_type)}
|
.selected=${updateTypes!.includes(update_type.value)}
|
||||||
>
|
>
|
||||||
${update_type}
|
${update_type.label}
|
||||||
</ha-check-list-item>
|
</ha-check-list-item>
|
||||||
</ha-formfield>
|
</ha-formfield>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
)}
|
)}
|
||||||
|
</ha-formfield>
|
||||||
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,9 +104,11 @@ export class HaPersistentNotificationTrigger extends LitElement {
|
|||||||
if (selected === this.trigger.update_type?.includes(updateType)) {
|
if (selected === this.trigger.update_type?.includes(updateType)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateTypes = this.trigger.update_type ?? [];
|
const updateTypes = this.trigger.update_type ?? [];
|
||||||
const newUpdateTypes = [...updateTypes];
|
const newUpdateTypes = this.trigger.update_type
|
||||||
|
? [...this.trigger.update_type]
|
||||||
|
: [];
|
||||||
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
newUpdateTypes.push(updateType);
|
newUpdateTypes.push(updateType);
|
||||||
|
@ -2328,7 +2328,13 @@
|
|||||||
"persistent_notification": {
|
"persistent_notification": {
|
||||||
"label": "Persistent notification",
|
"label": "Persistent notification",
|
||||||
"notification_id": "Notification Id",
|
"notification_id": "Notification Id",
|
||||||
"update_type": "Update type"
|
"update_type": "Update type",
|
||||||
|
"update_types": {
|
||||||
|
"added": "added",
|
||||||
|
"removed": "removed",
|
||||||
|
"current": "current",
|
||||||
|
"updated": "updated"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"sun": {
|
"sun": {
|
||||||
"label": "Sun",
|
"label": "Sun",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user