Expand trigger/condition/row when menu item changes editor (#13424)

This commit is contained in:
Paulus Schoutsen 2022-08-20 14:29:43 -04:00 committed by GitHub
parent 52a1594969
commit 209ba79823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 22 deletions

View File

@ -254,11 +254,6 @@ export default class HaAutomationActionRow extends LitElement {
)}
`
: ""}
<h2>
${this.hass.localize(
"ui.panel.config.automation.editor.edit_yaml"
)}
</h2>
<ha-yaml-editor
.hass=${this.hass}
.defaultValue=${this.action}
@ -307,6 +302,7 @@ export default class HaAutomationActionRow extends LitElement {
break;
case 1:
this._switchYamlMode();
this.expand();
break;
case 2:
fireEvent(this, "duplicate");

View File

@ -50,11 +50,6 @@ export default class HaAutomationConditionEditor extends LitElement {
)}
`
: ""}
<h2>
${this.hass.localize(
"ui.panel.config.automation.editor.edit_yaml"
)}
</h2>
<ha-yaml-editor
.hass=${this.hass}
.defaultValue=${this.condition}

View File

@ -2,7 +2,7 @@ import { ActionDetail } from "@material/mwc-list/mwc-list-foundation";
import "@material/mwc-list/mwc-list-item";
import { mdiDotsVertical } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { customElement, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
import { fireEvent } from "../../../../common/dom/fire_event";
import { handleStructError } from "../../../../common/structs/handle-errors";
@ -21,7 +21,6 @@ import { haStyle } from "../../../../resources/styles";
import { HomeAssistant } from "../../../../types";
import "./ha-automation-condition-editor";
import { validateConfig } from "../../../../data/config";
import { HaYamlEditor } from "../../../../components/ha-yaml-editor";
import { describeCondition } from "../../../../data/automation_i18n";
export interface ConditionElement extends LitElement {
@ -65,8 +64,6 @@ export default class HaAutomationConditionRow extends LitElement {
@state() private _warnings?: string[];
@query("ha-yaml-editor") private _yamlEditor?: HaYamlEditor;
protected render() {
if (!this.condition) {
return html``;
@ -191,6 +188,7 @@ export default class HaAutomationConditionRow extends LitElement {
switch (ev.detail.index) {
case 0:
this._switchYamlMode();
this.expand();
break;
case 1:
fireEvent(this, "duplicate");
@ -208,9 +206,6 @@ export default class HaAutomationConditionRow extends LitElement {
const enabled = !(this.condition.enabled ?? true);
const value = { ...this.condition, enabled };
fireEvent(this, "value-changed", { value });
if (this._yamlMode) {
this._yamlEditor?.setValue(value);
}
}
private _onDelete() {

View File

@ -195,11 +195,6 @@ export default class HaAutomationTriggerRow extends LitElement {
)}
`
: ""}
<h2>
${this.hass.localize(
"ui.panel.config.automation.editor.edit_yaml"
)}
</h2>
<ha-yaml-editor
.hass=${this.hass}
.defaultValue=${this.trigger}
@ -337,6 +332,7 @@ export default class HaAutomationTriggerRow extends LitElement {
break;
case 1:
this._switchYamlMode();
this.expand();
break;
case 2:
fireEvent(this, "duplicate");