From c6ecb5f2172dc128e1d8d3ca10bce181c8ab1e3a Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Wed, 11 Feb 2026 09:38:17 +0000 Subject: [PATCH] Migrate mqtt device info dialog to wa (#29564) Migrate config-devices dialog(s) to wa --- .../mqtt/dialog-mqtt-device-debug-info.ts | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts index 5671d905b5..ec3b51c58d 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts @@ -3,9 +3,11 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import { computeDeviceNameDisplay } from "../../../../../../common/entity/compute_device_name"; import { computeStateName } from "../../../../../../common/entity/compute_state_name"; -import "../../../../../../components/ha-dialog"; +import { fireEvent } from "../../../../../../common/dom/fire_event"; +import "../../../../../../components/ha-dialog-footer"; import "../../../../../../components/ha-formfield"; import "../../../../../../components/ha-switch"; +import "../../../../../../components/ha-wa-dialog"; import "../../../../../../components/ha-button"; import type { HaSwitch } from "../../../../../../components/ha-switch"; import type { MQTTDeviceDebugInfo } from "../../../../../../data/mqtt"; @@ -24,6 +26,8 @@ class DialogMQTTDeviceDebugInfo extends LitElement { @state() private _debugInfo?: MQTTDeviceDebugInfo; + @state() private _open = false; + @state() private _showAsYaml = true; @state() private _showDeserialized = true; @@ -32,6 +36,7 @@ class DialogMQTTDeviceDebugInfo extends LitElement { params: MQTTDeviceDebugInfoDialogParams ): Promise { this._params = params; + this._open = true; fetchMQTTDebugInfo(this.hass, params.device.id).then((results) => { this._debugInfo = results; }); @@ -43,13 +48,15 @@ class DialogMQTTDeviceDebugInfo extends LitElement { } return html` -

${this.hass!.localize( @@ -65,7 +72,7 @@ class DialogMQTTDeviceDebugInfo extends LitElement { @@ -107,16 +114,23 @@ class DialogMQTTDeviceDebugInfo extends LitElement { )} `} - - ${this.hass!.localize("ui.common.close")} - - + + + ${this.hass!.localize("ui.common.close")} + + + `; } private _close(): void { + this._open = false; + } + + private _dialogClosed(): void { this._params = undefined; this._debugInfo = undefined; + fireEvent(this, "dialog-closed", { dialog: this.localName }); } private _showAsYamlChanged(ev: Event): void { @@ -233,16 +247,6 @@ class DialogMQTTDeviceDebugInfo extends LitElement { return [ haStyleDialog, css` - ha-dialog { - --mdc-dialog-max-width: 95vw; - --mdc-dialog-min-width: min(640px, 95vw); - } - @media all and (max-width: 450px), all and (max-height: 500px) { - ha-dialog { - --mdc-dialog-min-width: 100vw; - --mdc-dialog-max-width: 100vw; - } - } ha-switch { margin: 16px; }