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; }