mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-08 18:39:40 +00:00
* Improve automation save timeout * junk * fix error handling * fix error handling * translate fix * Fix typo
32 lines
852 B
TypeScript
32 lines
852 B
TypeScript
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();
|
|
}
|
|
},
|
|
},
|
|
});
|
|
});
|