mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 17:56:46 +00:00
Convert Automation Action Choose to HA Form (#11597)
* Convert Auatomation Action Choose to HA Form * remove log * Remove Import
This commit is contained in:
parent
6a51e2aaad
commit
9eea17b793
@ -10,8 +10,8 @@ import { Condition } from "../../../../../data/automation";
|
|||||||
import { Action, ChooseAction } from "../../../../../data/script";
|
import { Action, ChooseAction } from "../../../../../data/script";
|
||||||
import { haStyle } from "../../../../../resources/styles";
|
import { haStyle } from "../../../../../resources/styles";
|
||||||
import { HomeAssistant } from "../../../../../types";
|
import { HomeAssistant } from "../../../../../types";
|
||||||
import "../ha-automation-action";
|
|
||||||
import { ActionElement } from "../ha-automation-action-row";
|
import { ActionElement } from "../ha-automation-action-row";
|
||||||
|
import "../../../../../components/ha-form/ha-form";
|
||||||
|
|
||||||
@customElement("ha-automation-action-choose")
|
@customElement("ha-automation-action-choose")
|
||||||
export class HaChooseAction extends LitElement implements ActionElement {
|
export class HaChooseAction extends LitElement implements ActionElement {
|
||||||
@ -61,12 +61,13 @@ export class HaChooseAction extends LitElement implements ActionElement {
|
|||||||
"ui.panel.config.automation.editor.actions.type.choose.sequence"
|
"ui.panel.config.automation.editor.actions.type.choose.sequence"
|
||||||
)}:
|
)}:
|
||||||
</h3>
|
</h3>
|
||||||
<ha-automation-action
|
<ha-form
|
||||||
.actions=${option.sequence}
|
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.schema=${[{ name: "sequence", selector: { action: {} } }]}
|
||||||
|
.data=${option}
|
||||||
.idx=${idx}
|
.idx=${idx}
|
||||||
@value-changed=${this._actionChanged}
|
@value-changed=${this._actionChanged}
|
||||||
></ha-automation-action>
|
></ha-form>
|
||||||
</div>
|
</div>
|
||||||
</ha-card>`
|
</ha-card>`
|
||||||
)}
|
)}
|
||||||
@ -107,7 +108,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
|
|||||||
|
|
||||||
private _actionChanged(ev: CustomEvent) {
|
private _actionChanged(ev: CustomEvent) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
const value = ev.detail.value as Action[];
|
const value = ev.detail.value.sequence as Action[];
|
||||||
const index = (ev.target as any).idx;
|
const index = (ev.target as any).idx;
|
||||||
const choose = this.action.choose
|
const choose = this.action.choose
|
||||||
? [...ensureArray(this.action.choose)]
|
? [...ensureArray(this.action.choose)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user