mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Add response UI to stop action (#17045)
This commit is contained in:
parent
c3c062cc29
commit
6b4300950d
@ -19,7 +19,7 @@ export class HaStopAction extends LitElement implements ActionElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
const { error, stop } = this.action;
|
const { error, stop, response_variable } = this.action;
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-textfield
|
<ha-textfield
|
||||||
@ -30,6 +30,14 @@ export class HaStopAction extends LitElement implements ActionElement {
|
|||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
@change=${this._stopChanged}
|
@change=${this._stopChanged}
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
|
<ha-textfield
|
||||||
|
.label=${this.hass.localize(
|
||||||
|
"ui.panel.config.automation.editor.actions.type.stop.response_variable"
|
||||||
|
)}
|
||||||
|
.value=${response_variable || ""}
|
||||||
|
.disabled=${this.disabled}
|
||||||
|
@change=${this._responseChanged}
|
||||||
|
></ha-textfield>
|
||||||
<ha-formfield
|
<ha-formfield
|
||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
@ -45,14 +53,21 @@ export class HaStopAction extends LitElement implements ActionElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _stopChanged(ev: CustomEvent) {
|
private _stopChanged(ev: Event) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
fireEvent(this, "value-changed", {
|
fireEvent(this, "value-changed", {
|
||||||
value: { ...this.action, stop: (ev.target as any).value },
|
value: { ...this.action, stop: (ev.target as any).value },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _errorChanged(ev: CustomEvent) {
|
private _responseChanged(ev: Event) {
|
||||||
|
ev.stopPropagation();
|
||||||
|
fireEvent(this, "value-changed", {
|
||||||
|
value: { ...this.action, response_variable: (ev.target as any).value },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private _errorChanged(ev: Event) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
fireEvent(this, "value-changed", {
|
fireEvent(this, "value-changed", {
|
||||||
value: { ...this.action, error: (ev.target as any).checked },
|
value: { ...this.action, error: (ev.target as any).checked },
|
||||||
|
@ -2652,6 +2652,7 @@
|
|||||||
"stop": {
|
"stop": {
|
||||||
"label": "Stop",
|
"label": "Stop",
|
||||||
"stop": "Reason for stopping",
|
"stop": "Reason for stopping",
|
||||||
|
"response_variable": "The name of the variable to use as response",
|
||||||
"error": "Stop because of an unexpected error"
|
"error": "Stop because of an unexpected error"
|
||||||
},
|
},
|
||||||
"parallel": {
|
"parallel": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user