mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Do not clear alias when editing automation action, condition or trigger (#18114)
This commit is contained in:
parent
32bc8bd01d
commit
d7f1e9d091
@ -391,7 +391,10 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
></ha-yaml-editor>
|
></ha-yaml-editor>
|
||||||
`
|
`
|
||||||
: html`
|
: html`
|
||||||
<div @ui-mode-not-available=${this._handleUiModeNotAvailable}>
|
<div
|
||||||
|
@ui-mode-not-available=${this._handleUiModeNotAvailable}
|
||||||
|
@value-changed=${this._onUiChanged}
|
||||||
|
>
|
||||||
${dynamicElement(`ha-automation-action-${type}`, {
|
${dynamicElement(`ha-automation-action-${type}`, {
|
||||||
hass: this.hass,
|
hass: this.hass,
|
||||||
action: this.action,
|
action: this.action,
|
||||||
@ -530,6 +533,15 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
fireEvent(this, "value-changed", { value: ev.detail.value });
|
fireEvent(this, "value-changed", { value: ev.detail.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _onUiChanged(ev: CustomEvent) {
|
||||||
|
ev.stopPropagation();
|
||||||
|
const value = {
|
||||||
|
...(this.action.alias ? { alias: this.action.alias } : {}),
|
||||||
|
...ev.detail.value,
|
||||||
|
};
|
||||||
|
fireEvent(this, "value-changed", { value });
|
||||||
|
}
|
||||||
|
|
||||||
private _switchUiMode() {
|
private _switchUiMode() {
|
||||||
this._warnings = undefined;
|
this._warnings = undefined;
|
||||||
this._yamlMode = false;
|
this._yamlMode = false;
|
||||||
|
@ -54,6 +54,7 @@ export class HaSceneAction extends LitElement implements ActionElement {
|
|||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
fireEvent(this, "value-changed", {
|
fireEvent(this, "value-changed", {
|
||||||
value: {
|
value: {
|
||||||
|
...this.action,
|
||||||
service: "scene.turn_on",
|
service: "scene.turn_on",
|
||||||
target: {
|
target: {
|
||||||
entity_id: ev.detail.value,
|
entity_id: ev.detail.value,
|
||||||
|
@ -51,6 +51,7 @@ export class HaPlayMediaAction extends LitElement implements ActionElement {
|
|||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
fireEvent(this, "value-changed", {
|
fireEvent(this, "value-changed", {
|
||||||
value: {
|
value: {
|
||||||
|
...this.action,
|
||||||
service: "media_player.play_media",
|
service: "media_player.play_media",
|
||||||
target: { entity_id: ev.detail.value.entity_id },
|
target: { entity_id: ev.detail.value.entity_id },
|
||||||
data: {
|
data: {
|
||||||
|
@ -62,7 +62,7 @@ export default class HaAutomationConditionEditor extends LitElement {
|
|||||||
></ha-yaml-editor>
|
></ha-yaml-editor>
|
||||||
`
|
`
|
||||||
: html`
|
: html`
|
||||||
<div>
|
<div @value-changed=${this._onUiChanged}>
|
||||||
${dynamicElement(
|
${dynamicElement(
|
||||||
`ha-automation-condition-${condition.condition}`,
|
`ha-automation-condition-${condition.condition}`,
|
||||||
{
|
{
|
||||||
@ -86,6 +86,15 @@ export default class HaAutomationConditionEditor extends LitElement {
|
|||||||
fireEvent(this, "value-changed", { value: ev.detail.value, yaml: true });
|
fireEvent(this, "value-changed", { value: ev.detail.value, yaml: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _onUiChanged(ev: CustomEvent) {
|
||||||
|
ev.stopPropagation();
|
||||||
|
const value = {
|
||||||
|
...(this.condition.alias ? { alias: this.condition.alias } : {}),
|
||||||
|
...ev.detail.value,
|
||||||
|
};
|
||||||
|
fireEvent(this, "value-changed", { value });
|
||||||
|
}
|
||||||
|
|
||||||
static styles = haStyle;
|
static styles = haStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,10 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
</ha-textfield>
|
</ha-textfield>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
<div @ui-mode-not-available=${this._handleUiModeNotAvailable}>
|
<div
|
||||||
|
@ui-mode-not-available=${this._handleUiModeNotAvailable}
|
||||||
|
@value-changed=${this._onUiChanged}
|
||||||
|
>
|
||||||
${dynamicElement(
|
${dynamicElement(
|
||||||
`ha-automation-trigger-${this.trigger.platform}`,
|
`ha-automation-trigger-${this.trigger.platform}`,
|
||||||
{
|
{
|
||||||
@ -562,6 +565,15 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
fireEvent(this, "value-changed", { value: ev.detail.value });
|
fireEvent(this, "value-changed", { value: ev.detail.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _onUiChanged(ev: CustomEvent) {
|
||||||
|
ev.stopPropagation();
|
||||||
|
const value = {
|
||||||
|
...(this.trigger.alias ? { alias: this.trigger.alias } : {}),
|
||||||
|
...ev.detail.value,
|
||||||
|
};
|
||||||
|
fireEvent(this, "value-changed", { value });
|
||||||
|
}
|
||||||
|
|
||||||
private _switchUiMode() {
|
private _switchUiMode() {
|
||||||
this._warnings = undefined;
|
this._warnings = undefined;
|
||||||
this._yamlMode = false;
|
this._yamlMode = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user