mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Add support for automation description (#3723)
* Add support for automation annotation * Update label and add placeholder * Rename annotation to description * Adress review comments, fix lint errors
This commit is contained in:
parent
145259e82f
commit
eee0c2e53f
@ -21,7 +21,11 @@ class HaTextarea extends PolymerElement {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<paper-textarea label="[[label]]" value="{{value}}"></paper-textarea>
|
<paper-textarea
|
||||||
|
label="[[label]]"
|
||||||
|
placeholder="[[placeholder]]"
|
||||||
|
value="{{value}}"
|
||||||
|
></paper-textarea>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,6 +33,7 @@ class HaTextarea extends PolymerElement {
|
|||||||
return {
|
return {
|
||||||
name: String,
|
name: String,
|
||||||
label: String,
|
label: String,
|
||||||
|
placeholder: String,
|
||||||
value: {
|
value: {
|
||||||
type: String,
|
type: String,
|
||||||
notify: true,
|
notify: true,
|
||||||
|
@ -13,6 +13,7 @@ export interface AutomationEntity extends HassEntityBase {
|
|||||||
|
|
||||||
export interface AutomationConfig {
|
export interface AutomationConfig {
|
||||||
alias: string;
|
alias: string;
|
||||||
|
description: string;
|
||||||
trigger: any[];
|
trigger: any[];
|
||||||
condition?: any[];
|
condition?: any[];
|
||||||
action: any[];
|
action: any[];
|
||||||
|
@ -183,6 +183,7 @@ class HaAutomationEditor extends LitElement {
|
|||||||
alias: this.hass.localize(
|
alias: this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.default_name"
|
"ui.panel.config.automation.editor.default_name"
|
||||||
),
|
),
|
||||||
|
description: "",
|
||||||
trigger: [{ platform: "state" }],
|
trigger: [{ platform: "state" }],
|
||||||
condition: [],
|
condition: [],
|
||||||
action: [{ service: "" }],
|
action: [{ service: "" }],
|
||||||
|
@ -3,6 +3,7 @@ import { h, Component } from "preact";
|
|||||||
import "@polymer/paper-input/paper-input";
|
import "@polymer/paper-input/paper-input";
|
||||||
import "../ha-config-section";
|
import "../ha-config-section";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
|
import "../../../components/ha-textarea";
|
||||||
|
|
||||||
import Trigger from "./trigger/index";
|
import Trigger from "./trigger/index";
|
||||||
import Condition from "./condition/index";
|
import Condition from "./condition/index";
|
||||||
@ -38,7 +39,7 @@ export default class Automation extends Component<any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public render({ automation, isWide, hass, localize }) {
|
public render({ automation, isWide, hass, localize }) {
|
||||||
const { alias, trigger, condition, action } = automation;
|
const { alias, description, trigger, condition, action } = automation;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@ -55,6 +56,17 @@ export default class Automation extends Component<any> {
|
|||||||
value={alias}
|
value={alias}
|
||||||
onvalue-changed={this.onChange}
|
onvalue-changed={this.onChange}
|
||||||
/>
|
/>
|
||||||
|
<ha-textarea
|
||||||
|
label={localize(
|
||||||
|
"ui.panel.config.automation.editor.description.label"
|
||||||
|
)}
|
||||||
|
placeholder={localize(
|
||||||
|
"ui.panel.config.automation.editor.description.placeholder"
|
||||||
|
)}
|
||||||
|
name="description"
|
||||||
|
value={description}
|
||||||
|
onvalue-changed={this.onChange}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</ha-card>
|
</ha-card>
|
||||||
</ha-config-section>
|
</ha-config-section>
|
||||||
|
@ -699,13 +699,17 @@
|
|||||||
"add_automation": "Add automation"
|
"add_automation": "Add automation"
|
||||||
},
|
},
|
||||||
"editor": {
|
"editor": {
|
||||||
"introduction": "Use automations to bring your home alive",
|
"introduction": "Use automations to bring your home alive.",
|
||||||
"default_name": "New Automation",
|
"default_name": "New Automation",
|
||||||
"load_error_not_editable": "Only automations in automations.yaml are editable.",
|
"load_error_not_editable": "Only automations in automations.yaml are editable.",
|
||||||
"load_error_unknown": "Error loading automation ({err_no}).",
|
"load_error_unknown": "Error loading automation ({err_no}).",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
"unsaved_confirm": "You have unsaved changes. Are you sure you want to leave?",
|
"unsaved_confirm": "You have unsaved changes. Are you sure you want to leave?",
|
||||||
"alias": "Name",
|
"alias": "Name",
|
||||||
|
"description": {
|
||||||
|
"label": "Description",
|
||||||
|
"placeholder": "Optional description"
|
||||||
|
},
|
||||||
"triggers": {
|
"triggers": {
|
||||||
"header": "Triggers",
|
"header": "Triggers",
|
||||||
"introduction": "Triggers are what starts the processing of an automation rule. It is possible to specify multiple triggers for the same rule. Once a trigger starts, Home Assistant will validate the conditions, if any, and call the action.",
|
"introduction": "Triggers are what starts the processing of an automation rule. It is possible to specify multiple triggers for the same rule. Once a trigger starts, Home Assistant will validate the conditions, if any, and call the action.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user