From 6e4b0275755cd8afdad016d2277c37cc7e80c937 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 18 Feb 2022 16:34:17 -0800 Subject: [PATCH] Change words for trigger condition (#11733) --- .../types/ha-automation-condition-trigger.ts | 22 +++++++++---------- src/translations/en.json | 6 ++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-trigger.ts b/src/panels/config/automation/condition/types/ha-automation-condition-trigger.ts index 4b81afc26b..eb5e04fb78 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-trigger.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-trigger.ts @@ -18,7 +18,7 @@ export class HaTriggerCondition extends LitElement { @property({ attribute: false }) public condition!: TriggerCondition; - @state() private _triggers?: Trigger | Trigger[]; + @state() private _triggers: Trigger[] = []; private _unsub?: UnsubscribeFunc; @@ -44,7 +44,8 @@ export class HaTriggerCondition extends LitElement { protected render() { const { id } = this.condition; - if (!this._triggers) { + + if (!this._triggers.length) { return this.hass.localize( "ui.panel.config.automation.editor.conditions.type.trigger.no_triggers" ); @@ -56,20 +57,19 @@ export class HaTriggerCondition extends LitElement { .value=${id} @selected=${this._triggerPicked} > - ${ensureArray(this._triggers).map((trigger) => - trigger.id - ? html` - - ${trigger.id} - - ` - : "" + ${this._triggers.map( + (trigger) => + html` + ${trigger.id} + ` )} `; } private _automationUpdated(config?: AutomationConfig) { - this._triggers = config?.trigger; + this._triggers = config?.trigger + ? ensureArray(config.trigger).filter((t) => t.id) + : []; } private _triggerPicked(ev) { diff --git a/src/translations/en.json b/src/translations/en.json index b7bb981739..4dc5490f83 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1799,9 +1799,9 @@ } }, "trigger": { - "label": "Trigger", - "no_triggers": "No triggers available", - "id": "Trigger ID" + "label": "Triggered by", + "no_triggers": "No triggers have an ID set. You can set an ID using the trigger menu button.", + "id": "Trigger" }, "zone": { "label": "[%key:ui::panel::config::automation::editor::triggers::type::zone::label%]",