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
|
||||
if (trigger.platform === "persistent_notification") {
|
||||
return "When a persistent_notification is updated";
|
||||
return "When a persistent notification is updated";
|
||||
}
|
||||
|
||||
// Device Trigger
|
||||
|
@ -10,7 +10,31 @@ import { PersistentNotificationTrigger } from "../../../../../data/automation";
|
||||
import { HomeAssistant } from "../../../../../types";
|
||||
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_NOTIFICATION_ID = "";
|
||||
|
||||
@ -30,10 +54,8 @@ export class HaPersistentNotificationTrigger extends LitElement {
|
||||
}
|
||||
|
||||
protected render() {
|
||||
const {
|
||||
update_type: updateTypes,
|
||||
notification_id: notificationId,
|
||||
} = this.trigger;
|
||||
const { update_type: updateTypes, notification_id: notificationId } =
|
||||
this.trigger;
|
||||
|
||||
return html`
|
||||
<div class="form">
|
||||
@ -55,16 +77,18 @@ export class HaPersistentNotificationTrigger extends LitElement {
|
||||
(update_type) => html`
|
||||
<ha-check-list-item
|
||||
left
|
||||
.value=${update_type}
|
||||
.value=${update_type.value}
|
||||
@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-formfield>
|
||||
</div>
|
||||
`
|
||||
)}
|
||||
)}
|
||||
</ha-formfield>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
@ -82,7 +106,9 @@ export class HaPersistentNotificationTrigger extends LitElement {
|
||||
}
|
||||
|
||||
const updateTypes = this.trigger.update_type ?? [];
|
||||
const newUpdateTypes = [...updateTypes];
|
||||
const newUpdateTypes = this.trigger.update_type
|
||||
? [...this.trigger.update_type]
|
||||
: [];
|
||||
|
||||
if (selected) {
|
||||
newUpdateTypes.push(updateType);
|
||||
|
@ -2328,7 +2328,13 @@
|
||||
"persistent_notification": {
|
||||
"label": "Persistent notification",
|
||||
"notification_id": "Notification Id",
|
||||
"update_type": "Update type"
|
||||
"update_type": "Update type",
|
||||
"update_types": {
|
||||
"added": "added",
|
||||
"removed": "removed",
|
||||
"current": "current",
|
||||
"updated": "updated"
|
||||
}
|
||||
},
|
||||
"sun": {
|
||||
"label": "Sun",
|
||||
|
Loading…
x
Reference in New Issue
Block a user