mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-10 19:40:25 +00:00
Improve automation save timeout (#27584)
* Improve automation save timeout * junk * fix error handling * fix error handling * translate fix * Fix typo
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
|
||||
export const loadAutomationSaveTimeoutDialog = () =>
|
||||
import("./dialog-automation-save-timeout");
|
||||
|
||||
export interface AutomationSaveTimeoutDialogParams {
|
||||
onClose?: () => void;
|
||||
savedPromise: Promise<any>;
|
||||
type: "automation" | "script";
|
||||
}
|
||||
|
||||
export const showAutomationSaveTimeoutDialog = (
|
||||
element: HTMLElement,
|
||||
dialogParams: AutomationSaveTimeoutDialogParams
|
||||
) =>
|
||||
new Promise<void>((resolve) => {
|
||||
const origClose = dialogParams.onClose;
|
||||
fireEvent(element, "show-dialog", {
|
||||
dialogTag: "ha-dialog-automation-save-timeout",
|
||||
dialogImport: loadAutomationSaveTimeoutDialog,
|
||||
dialogParams: {
|
||||
...dialogParams,
|
||||
onClose: () => {
|
||||
resolve();
|
||||
if (origClose) {
|
||||
origClose();
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user