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