mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-26 14:27:20 +00:00
Tweak displayed action/condition/trigger names (#13445)
This commit is contained in:
parent
44422086d7
commit
c0051aeb68
@ -1,7 +1,11 @@
|
||||
import { Condition, Trigger } from "./automation";
|
||||
|
||||
export const describeTrigger = (trigger: Trigger) =>
|
||||
`${trigger.platform || "Unknown"} trigger`;
|
||||
export const describeTrigger = (trigger: Trigger) => {
|
||||
if (trigger.alias) {
|
||||
return trigger.alias;
|
||||
}
|
||||
return `${trigger.platform || "Unknown"} trigger`;
|
||||
};
|
||||
|
||||
export const describeCondition = (condition: Condition) => {
|
||||
if (condition.alias) {
|
||||
|
@ -39,6 +39,7 @@ import "./types/ha-automation-action-stop";
|
||||
import "./types/ha-automation-action-wait_for_trigger";
|
||||
import "./types/ha-automation-action-wait_template";
|
||||
import { ACTION_TYPES } from "../../../../data/action";
|
||||
import { capitalizeFirstLetter } from "../../../../common/string/capitalize-first-letter";
|
||||
|
||||
const getType = (action: Action | undefined) => {
|
||||
if (!action) {
|
||||
@ -145,7 +146,9 @@ export default class HaAutomationActionRow extends LitElement {
|
||||
: ""}
|
||||
<ha-expansion-panel
|
||||
leftChevron
|
||||
.header=${this.action.alias || describeAction(this.hass, this.action)}
|
||||
.header=${capitalizeFirstLetter(
|
||||
describeAction(this.hass, this.action)
|
||||
)}
|
||||
>
|
||||
${this.index !== 0
|
||||
? html`
|
||||
|
@ -22,6 +22,7 @@ import { HomeAssistant } from "../../../../types";
|
||||
import "./ha-automation-condition-editor";
|
||||
import { validateConfig } from "../../../../data/config";
|
||||
import { describeCondition } from "../../../../data/automation_i18n";
|
||||
import { capitalizeFirstLetter } from "../../../../common/string/capitalize-first-letter";
|
||||
|
||||
export interface ConditionElement extends LitElement {
|
||||
condition: Condition;
|
||||
@ -80,7 +81,7 @@ export default class HaAutomationConditionRow extends LitElement {
|
||||
|
||||
<ha-expansion-panel
|
||||
leftChevron
|
||||
.header=${this.condition.alias || describeCondition(this.condition)}
|
||||
.header=${capitalizeFirstLetter(describeCondition(this.condition))}
|
||||
>
|
||||
<ha-progress-button slot="icons" @click=${this._testCondition}>
|
||||
${this.hass.localize(
|
||||
|
@ -40,6 +40,7 @@ import "./types/ha-automation-trigger-time_pattern";
|
||||
import "./types/ha-automation-trigger-webhook";
|
||||
import "./types/ha-automation-trigger-zone";
|
||||
import { describeTrigger } from "../../../../data/automation_i18n";
|
||||
import { capitalizeFirstLetter } from "../../../../common/string/capitalize-first-letter";
|
||||
|
||||
export interface TriggerElement extends LitElement {
|
||||
trigger: Trigger;
|
||||
@ -110,7 +111,7 @@ export default class HaAutomationTriggerRow extends LitElement {
|
||||
|
||||
<ha-expansion-panel
|
||||
leftChevron
|
||||
.header=${this.trigger.alias || describeTrigger(this.trigger)}
|
||||
.header=${capitalizeFirstLetter(describeTrigger(this.trigger))}
|
||||
>
|
||||
<ha-button-menu
|
||||
slot="icons"
|
||||
|
Loading…
x
Reference in New Issue
Block a user