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, defaultValue: this.action.alias,
confirmText: this.hass.localize("ui.common.submit"), confirmText: this.hass.localize("ui.common.submit"),
}); });
const value = { ...this.action }; if (alias !== null) {
if (!alias) { const value = { ...this.action };
delete value.alias; if (alias === "") {
} else { delete value.alias;
value.alias = alias; } else {
} value.alias = alias;
fireEvent(this, "value-changed", { }
value, fireEvent(this, "value-changed", {
}); value,
if (this._yamlMode) { });
this._yamlEditor?.setValue(value); if (this._yamlMode) {
this._yamlEditor?.setValue(value);
}
} }
} }

View File

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

View File

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