mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Don't save new automation when save dialog is cancelled (#18655)
This commit is contained in:
parent
b35e5abd83
commit
08a7a10e1c
@ -697,7 +697,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
this._mode = "yaml";
|
||||
}
|
||||
|
||||
private async _promptAutomationAlias(): Promise<void> {
|
||||
private async _promptAutomationAlias(): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
showAutomationRenameDialog(this, {
|
||||
config: this._config!,
|
||||
@ -705,9 +705,9 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
this._config = config;
|
||||
this._dirty = true;
|
||||
this.requestUpdate();
|
||||
resolve();
|
||||
resolve(true);
|
||||
},
|
||||
onClose: () => resolve(),
|
||||
onClose: () => resolve(false),
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -730,7 +730,10 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
private async _saveAutomation(): Promise<void> {
|
||||
const id = this.automationId || String(Date.now());
|
||||
if (!this.automationId) {
|
||||
await this._promptAutomationAlias();
|
||||
const saved = await this._promptAutomationAlias();
|
||||
if (!saved) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this._validationErrors = undefined;
|
||||
|
Loading…
x
Reference in New Issue
Block a user