From f913677dfeec49265d50fa36a9bb2910dccfb7ac Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Wed, 11 Feb 2026 16:21:31 +0000 Subject: [PATCH] Migrate storage config dialogs to wa (#29576) Migrate config-storage dialog(s) to wa --- .../config/storage/dialog-mount-view.ts | 103 ++++++++---------- .../config/storage/dialog-move-datadisk.ts | 67 +++++++----- 2 files changed, 88 insertions(+), 82 deletions(-) diff --git a/src/panels/config/storage/dialog-mount-view.ts b/src/panels/config/storage/dialog-mount-view.ts index 4590df946f..df6a44bad4 100644 --- a/src/panels/config/storage/dialog-mount-view.ts +++ b/src/panels/config/storage/dialog-mount-view.ts @@ -1,4 +1,4 @@ -import { mdiClose, mdiHelpCircle } from "@mdi/js"; +import { mdiHelpCircle } from "@mdi/js"; import type { CSSResultGroup } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; @@ -8,9 +8,11 @@ import type { LocalizeFunc } from "../../../common/translations/localize"; import { computeRTLDirection } from "../../../common/util/compute_rtl"; import "../../../components/buttons/ha-progress-button"; import type { HaProgressButton } from "../../../components/buttons/ha-progress-button"; +import "../../../components/ha-dialog-footer"; import "../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../components/ha-form/types"; import "../../../components/ha-icon-button"; +import "../../../components/ha-wa-dialog"; import { extractApiErrorMessage } from "../../../data/hassio/common"; import type { SupervisorMountRequestParams } from "../../../data/supervisor/mounts"; import { @@ -169,12 +171,15 @@ class ViewMountDialog extends LitElement { @state() private _reloadMounts?: () => void; + @state() private _open = false; + public async showDialog( dialogParams: MountViewDialogParams ): Promise> { this._data = dialogParams.mount; this._existing = dialogParams.mount !== undefined; this._reloadMounts = dialogParams.reloadMounts; + this._open = true; if ( dialogParams.mount?.type === "cifs" && dialogParams.mount.version && @@ -185,6 +190,10 @@ class ViewMountDialog extends LitElement { } public closeDialog(): void { + this._open = false; + } + + private _dialogClosed(): void { this._data = undefined; this._waiting = undefined; this._error = undefined; @@ -201,56 +210,39 @@ class ViewMountDialog extends LitElement { return nothing; } return html` - - - - ${this._existing - ? this.hass.localize( - "ui.panel.config.storage.network_mounts.update_title" - ) - : this.hass.localize( - "ui.panel.config.storage.network_mounts.add_title" - )} - - - - - + + + ${this._error ? html`${this._error}` : nothing} - ${this._existing - ? html` - ${this.hass.localize("ui.common.delete")} - ` - : nothing} - -
+ + ${this._existing + ? html` + ${this.hass.localize("ui.common.delete")} + ` + : nothing} ${this.hass.localize("ui.common.cancel")} @@ -299,8 +290,8 @@ class ViewMountDialog extends LitElement { "ui.panel.config.storage.network_mounts.connect" )} -
-
+ + `; } diff --git a/src/panels/config/storage/dialog-move-datadisk.ts b/src/panels/config/storage/dialog-move-datadisk.ts index 8da2a3c758..bc92d5828c 100644 --- a/src/panels/config/storage/dialog-move-datadisk.ts +++ b/src/panels/config/storage/dialog-move-datadisk.ts @@ -4,10 +4,11 @@ import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-button"; -import "../../../components/ha-dialog"; +import "../../../components/ha-dialog-footer"; import "../../../components/ha-select"; import type { HaSelectSelectEvent } from "../../../components/ha-select"; import "../../../components/ha-spinner"; +import "../../../components/ha-wa-dialog"; import { extractApiErrorMessage, ignoreSupervisorError, @@ -49,10 +50,13 @@ class MoveDatadiskDialog extends LitElement { @state() private _moving = false; + @state() private _open = false; + public async showDialog( dialogParams: MoveDatadiskDialogParams ): Promise> { this._hostInfo = dialogParams.hostInfo; + this._open = true; try { this._osInfo = await fetchHassioHassOsInfo(this.hass); @@ -83,6 +87,13 @@ class MoveDatadiskDialog extends LitElement { } public closeDialog(): void { + this._open = false; + if (!this._hostInfo || !this._osInfo || !this._disks) { + this._dialogClosed(); + } + } + + private _dialogClosed(): void { this._selectedDevice = undefined; this._disks = undefined; this._moving = false; @@ -97,15 +108,13 @@ class MoveDatadiskDialog extends LitElement { } return html` - ${this._moving ? html` @@ -127,6 +136,7 @@ class MoveDatadiskDialog extends LitElement {

- - - ${this.hass.localize("ui.panel.config.storage.datadisk.cancel")} - - - - ${this.hass.localize("ui.panel.config.storage.datadisk.move")} - `} -
+ ${this._moving + ? nothing + : html` + + + ${this.hass.localize( + "ui.panel.config.storage.datadisk.cancel" + )} + + + ${this.hass.localize("ui.panel.config.storage.datadisk.move")} + + + `} + `; }