+
+
+
+ ${heading}
+
+
+
+
+
+
+ Use automatic backup settings
+
+ Trigger a backup using the configured settings for automatic backups
+
+
+
+
+
+
+ Create a manual backup
+
+ Create a backup with custom settings (e.g. specific add-ons,
+ database, etc.)
+
+
+
+
+
+
+ `;
+ }
+
+ private async _manual() {
+ this._params!.submit?.("manual");
+ this.closeDialog();
+ }
+
+ private async _automatic() {
+ this._params!.submit?.("automatic");
+ this.closeDialog();
+ }
+
+ static get styles(): CSSResultGroup {
+ return [
+ haStyle,
+ haStyleDialog,
+ css`
+ ha-md-dialog {
+ --dialog-content-padding: 0;
+ max-width: 500px;
+ }
+ div[slot="content"] {
+ margin-top: -16px;
+ }
+ @media all and (max-width: 450px), all and (max-height: 500px) {
+ ha-md-dialog {
+ max-width: none;
+ }
+ div[slot="content"] {
+ margin-top: 0;
+ }
+ }
+
+ ha-md-list {
+ background: none;
+ }
+ ha-md-list-item {
+ }
+ ha-icon-next {
+ width: 24px;
+ }
+ `,
+ ];
+ }
+}
+
+declare global {
+ interface HTMLElementTagNameMap {
+ "ha-dialog-new-backup": DialogNewBackup;
+ }
+}
diff --git a/src/panels/config/backup/dialogs/show-dialog-generate-backup.ts b/src/panels/config/backup/dialogs/show-dialog-generate-backup.ts
index 79bd55a3b3..05ef818ed8 100644
--- a/src/panels/config/backup/dialogs/show-dialog-generate-backup.ts
+++ b/src/panels/config/backup/dialogs/show-dialog-generate-backup.ts
@@ -1,7 +1,7 @@
import { fireEvent } from "../../../../common/dom/fire_event";
export interface GenerateBackupDialogParams {
- submit?: (response: { slug: string }) => void;
+ submit?: (response: { backup_id: string }) => void;
cancel?: () => void;
}
@@ -12,7 +12,7 @@ export const showGenerateBackupDialog = (
element: HTMLElement,
params: GenerateBackupDialogParams
) =>
- new Promise<{ slug: string } | null>((resolve) => {
+ new Promise<{ backup_id: string } | null>((resolve) => {
const origCancel = params.cancel;
const origSubmit = params.submit;
fireEvent(element, "show-dialog", {
diff --git a/src/panels/config/backup/dialogs/show-dialog-new-backup.ts b/src/panels/config/backup/dialogs/show-dialog-new-backup.ts
new file mode 100644
index 0000000000..a084bd4f11
--- /dev/null
+++ b/src/panels/config/backup/dialogs/show-dialog-new-backup.ts
@@ -0,0 +1,37 @@
+import { fireEvent } from "../../../../common/dom/fire_event";
+
+export type NewBackupType = "automatic" | "manual";
+export interface NewBackupDialogParams {
+ submit?: (type: NewBackupType) => void;
+ cancel?: () => void;
+}
+
+export const loadNewBackupDialog = () => import("./dialog-new-backup");
+
+export const showNewBackupDialog = (
+ element: HTMLElement,
+ params: NewBackupDialogParams
+) =>
+ new Promise