Fix cancel button in automation row alias rename dialog (#16810)

This commit is contained in:
karwosts 2023-06-07 02:27:50 -07:00 committed by GitHub
parent 2767f866f3
commit d7c3ff3e9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 31 deletions

View File

@ -524,17 +524,19 @@ export default class HaAutomationActionRow extends LitElement {
defaultValue: this.action.alias,
confirmText: this.hass.localize("ui.common.submit"),
});
const value = { ...this.action };
if (!alias) {
delete value.alias;
} else {
value.alias = alias;
}
fireEvent(this, "value-changed", {
value,
});
if (this._yamlMode) {
this._yamlEditor?.setValue(value);
if (alias !== null) {
const value = { ...this.action };
if (alias === "") {
delete value.alias;
} else {
value.alias = alias;
}
fireEvent(this, "value-changed", {
value,
});
if (this._yamlMode) {
this._yamlEditor?.setValue(value);
}
}
}

View File

@ -471,16 +471,17 @@ export default class HaAutomationConditionRow extends LitElement {
defaultValue: this.condition.alias,
confirmText: this.hass.localize("ui.common.submit"),
});
const value = { ...this.condition };
if (!alias) {
delete value.alias;
} else {
value.alias = alias;
if (alias !== null) {
const value = { ...this.condition };
if (alias === "") {
delete value.alias;
} else {
value.alias = alias;
}
fireEvent(this, "value-changed", {
value,
});
}
fireEvent(this, "value-changed", {
value,
});
}
public expand() {

View File

@ -581,17 +581,19 @@ export default class HaAutomationTriggerRow extends LitElement {
confirmText: this.hass.localize("ui.common.submit"),
});
const value = { ...this.trigger };
if (!alias) {
delete value.alias;
} else {
value.alias = alias;
}
fireEvent(this, "value-changed", {
value,
});
if (this._yamlMode) {
this._yamlEditor?.setValue(value);
if (alias !== null) {
const value = { ...this.trigger };
if (alias === "") {
delete value.alias;
} else {
value.alias = alias;
}
fireEvent(this, "value-changed", {
value,
});
if (this._yamlMode) {
this._yamlEditor?.setValue(value);
}
}
}