From 41cabde393aabbcdc2e67b154832bc21a6abf0c8 Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Tue, 9 Dec 2025 07:28:44 +0000 Subject: [PATCH] Migrate dialog-download-decrypted-backup to ha-wa-dialog (#28442) * Migrate dialog-download-decrypted-backup.ts from ha-md-dialog to ha-wa-dialog * Fixes from other migrations --- .../dialog-download-decrypted-backup.ts | 141 ++++++++---------- 1 file changed, 60 insertions(+), 81 deletions(-) diff --git a/src/panels/config/backup/dialogs/dialog-download-decrypted-backup.ts b/src/panels/config/backup/dialogs/dialog-download-decrypted-backup.ts index 17b3a44288..747bdc8bb0 100644 --- a/src/panels/config/backup/dialogs/dialog-download-decrypted-backup.ts +++ b/src/panels/config/backup/dialogs/dialog-download-decrypted-backup.ts @@ -1,18 +1,12 @@ -import { mdiClose } from "@mdi/js"; import type { CSSResultGroup } from "lit"; import { LitElement, css, html, nothing } from "lit"; -import { customElement, property, query, state } from "lit/decorators"; +import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; -import "../../../../components/ha-dialog-header"; -import "../../../../components/ha-icon-button"; -import "../../../../components/ha-icon-next"; -import "../../../../components/ha-md-dialog"; -import type { HaMdDialog } from "../../../../components/ha-md-dialog"; -import "../../../../components/ha-md-list"; -import "../../../../components/ha-md-list-item"; -import "../../../../components/ha-svg-icon"; -import "../../../../components/ha-password-field"; import "../../../../components/ha-alert"; +import "../../../../components/ha-button"; +import "../../../../components/ha-dialog-footer"; +import "../../../../components/ha-wa-dialog"; +import "../../../../components/ha-password-field"; import { canDecryptBackupOnDownload, getPreferredAgentForDownload, @@ -27,102 +21,96 @@ import type { DownloadDecryptedBackupDialogParams } from "./show-dialog-download class DialogDownloadDecryptedBackup extends LitElement implements HassDialog { @property({ attribute: false }) public hass!: HomeAssistant; - @state() private _opened = false; + @state() private _open = false; @state() private _params?: DownloadDecryptedBackupDialogParams; - @query("ha-md-dialog") private _dialog?: HaMdDialog; - @state() private _encryptionKey = ""; @state() private _error = ""; public showDialog(params: DownloadDecryptedBackupDialogParams): void { - this._opened = true; + this._open = true; this._params = params; } public closeDialog() { - this._dialog?.close(); + this._open = false; return true; } private _dialogClosed() { - if (this._opened) { + if (this._open) { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - this._opened = false; + this._open = false; this._params = undefined; this._encryptionKey = ""; this._error = ""; } protected render() { - if (!this._opened || !this._params) { + if (!this._params) { return nothing; } return html` - - - - - ${this.hass.localize( - "ui.panel.config.backup.dialogs.download.title" - )} - - + +

+ ${this.hass.localize( + "ui.panel.config.backup.dialogs.download.description" + )} +

+

+ ${this.hass.localize( + "ui.panel.config.backup.dialogs.download.download_backup_encrypted", + { + download_it_encrypted: html``, + } + )} +

-
-

- ${this.hass.localize( - "ui.panel.config.backup.dialogs.download.description" - )} -

-

- ${this.hass.localize( - "ui.panel.config.backup.dialogs.download.download_backup_encrypted", - { - download_it_encrypted: html``, - } - )} -

+ - - - ${this._error - ? html`${this._error}` - : nothing} -
-
- + ${this._error + ? html`${this._error}` + : nothing} + + ${this.hass.localize("ui.common.cancel")} - + ${this.hass.localize( "ui.panel.config.backup.dialogs.download.download" )} -
-
+ + `; } @@ -191,17 +179,8 @@ class DialogDownloadDecryptedBackup extends LitElement implements HassDialog { haStyle, haStyleDialog, css` - ha-md-dialog { - --dialog-content-padding: 8px 24px; - max-width: 500px; - } - @media all and (max-width: 450px), all and (max-height: 500px) { - ha-md-dialog { - max-width: none; - } - div[slot="content"] { - margin-top: 0; - } + ha-wa-dialog { + --dialog-content-padding: var(--ha-space-2) var(--ha-space-6); } button.link {