mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Expand trigger/condition/row when menu item changes editor (#13424)
This commit is contained in:
parent
52a1594969
commit
209ba79823
@ -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
|
<ha-yaml-editor
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.defaultValue=${this.action}
|
.defaultValue=${this.action}
|
||||||
@ -307,6 +302,7 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this._switchYamlMode();
|
this._switchYamlMode();
|
||||||
|
this.expand();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
fireEvent(this, "duplicate");
|
fireEvent(this, "duplicate");
|
||||||
|
@ -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
|
<ha-yaml-editor
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.defaultValue=${this.condition}
|
.defaultValue=${this.condition}
|
||||||
|
@ -2,7 +2,7 @@ import { ActionDetail } from "@material/mwc-list/mwc-list-foundation";
|
|||||||
import "@material/mwc-list/mwc-list-item";
|
import "@material/mwc-list/mwc-list-item";
|
||||||
import { mdiDotsVertical } from "@mdi/js";
|
import { mdiDotsVertical } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement } from "lit";
|
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 { classMap } from "lit/directives/class-map";
|
||||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
import { handleStructError } from "../../../../common/structs/handle-errors";
|
import { handleStructError } from "../../../../common/structs/handle-errors";
|
||||||
@ -21,7 +21,6 @@ import { haStyle } from "../../../../resources/styles";
|
|||||||
import { HomeAssistant } from "../../../../types";
|
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 { HaYamlEditor } from "../../../../components/ha-yaml-editor";
|
|
||||||
import { describeCondition } from "../../../../data/automation_i18n";
|
import { describeCondition } from "../../../../data/automation_i18n";
|
||||||
|
|
||||||
export interface ConditionElement extends LitElement {
|
export interface ConditionElement extends LitElement {
|
||||||
@ -65,8 +64,6 @@ export default class HaAutomationConditionRow extends LitElement {
|
|||||||
|
|
||||||
@state() private _warnings?: string[];
|
@state() private _warnings?: string[];
|
||||||
|
|
||||||
@query("ha-yaml-editor") private _yamlEditor?: HaYamlEditor;
|
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (!this.condition) {
|
if (!this.condition) {
|
||||||
return html``;
|
return html``;
|
||||||
@ -191,6 +188,7 @@ export default class HaAutomationConditionRow extends LitElement {
|
|||||||
switch (ev.detail.index) {
|
switch (ev.detail.index) {
|
||||||
case 0:
|
case 0:
|
||||||
this._switchYamlMode();
|
this._switchYamlMode();
|
||||||
|
this.expand();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
fireEvent(this, "duplicate");
|
fireEvent(this, "duplicate");
|
||||||
@ -208,9 +206,6 @@ export default class HaAutomationConditionRow extends LitElement {
|
|||||||
const enabled = !(this.condition.enabled ?? true);
|
const enabled = !(this.condition.enabled ?? true);
|
||||||
const value = { ...this.condition, enabled };
|
const value = { ...this.condition, enabled };
|
||||||
fireEvent(this, "value-changed", { value });
|
fireEvent(this, "value-changed", { value });
|
||||||
if (this._yamlMode) {
|
|
||||||
this._yamlEditor?.setValue(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onDelete() {
|
private _onDelete() {
|
||||||
|
@ -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
|
<ha-yaml-editor
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.defaultValue=${this.trigger}
|
.defaultValue=${this.trigger}
|
||||||
@ -337,6 +332,7 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this._switchYamlMode();
|
this._switchYamlMode();
|
||||||
|
this.expand();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
fireEvent(this, "duplicate");
|
fireEvent(this, "duplicate");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user