From 2eec2ded131cce1980d2e830e452da8aa111ab96 Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Fri, 13 Feb 2026 12:48:17 +0000 Subject: [PATCH] Migrate matter config dialogs to wa (#29605) Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com> --- .../matter/dialog-matter-add-device.ts | 70 ++++++++----------- .../matter/dialog-matter-manage-fabrics.ts | 27 ++++--- ...dialog-matter-open-commissioning-window.ts | 55 +++++++++------ .../matter/dialog-matter-ping-node.ts | 55 +++++++++------ .../matter/dialog-matter-reinterview-node.ts | 56 +++++++++------ 5 files changed, 146 insertions(+), 117 deletions(-) diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts index 1a171c86dc..d246290d5b 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts @@ -1,14 +1,12 @@ -import { mdiClose } from "@mdi/js"; import type { UnsubscribeFunc } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { dynamicElement } from "../../../../../common/dom/dynamic-element-directive"; import { fireEvent } from "../../../../../common/dom/fire_event"; -import "../../../../../components/ha-dialog-header"; -import "../../../../../components/ha-icon-button"; +import "../../../../../components/ha-dialog-footer"; import "../../../../../components/ha-icon-button-arrow-prev"; import "../../../../../components/ha-button"; -import "../../../../../components/ha-dialog"; +import "../../../../../components/ha-wa-dialog"; import { commissionMatterDevice, redirectOnNewMatterDevice, @@ -75,6 +73,10 @@ class DialogMatterAddDevice extends LitElement { public closeDialog(): void { this._open = false; + } + + private _dialogClosed(): void { + this._open = false; this._step = "main"; this._pairingCode = ""; this._unsub?.(); @@ -171,35 +173,29 @@ class DialogMatterAddDevice extends LitElement { const actions = this._renderActions(); return html` - - - ${hasBackStep - ? html` - - ` - : html` - - `} - ${title} - - ${this._renderStep()} ${actions} - + ${hasBackStep + ? html` + + ` + : nothing} + ${this._renderStep()} + ${actions === nothing + ? nothing + : html` + ${actions} + `} + `; } @@ -209,21 +205,13 @@ class DialogMatterAddDevice extends LitElement { :host { --horizontal-padding: 24px; } - ha-dialog { + ha-wa-dialog { --dialog-content-padding: 0; } - ha-dialog { - --mdc-dialog-min-width: 450px; - --mdc-dialog-max-width: 450px; - } @media all and (max-width: 450px), all and (max-height: 500px) { :host { --horizontal-padding: 16px; } - ha-dialog { - --mdc-dialog-min-width: 100vw; - --mdc-dialog-max-width: 100vw; - } } .loading { padding: 24px; diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts index 7bd3a6d38b..0929b0331d 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts @@ -3,11 +3,10 @@ import type { CSSResultGroup } from "lit"; import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; -import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-list"; import "../../../../../components/ha-list-item"; -import "../../../../../components/ha-qr-code"; import "../../../../../components/ha-spinner"; +import "../../../../../components/ha-wa-dialog"; import type { MatterFabricData, MatterNodeDiagnostics, @@ -32,10 +31,13 @@ class DialogMatterManageFabrics extends LitElement { @state() private _nodeDiagnostics?: MatterNodeDiagnostics; + @state() private _open = false; + public async showDialog( params: MatterManageFabricsDialogParams ): Promise { this.device_id = params.device_id; + this._open = true; this._fetchNodeDetails(); } @@ -45,14 +47,13 @@ class DialogMatterManageFabrics extends LitElement { } return html` -

${this.hass.localize("ui.panel.config.matter.manage_fabrics.fabrics")} @@ -81,7 +82,7 @@ class DialogMatterManageFabrics extends LitElement { : html`

`} -
+ `; } @@ -140,6 +141,10 @@ class DialogMatterManageFabrics extends LitElement { } public closeDialog(): void { + this._open = false; + } + + private _dialogClosed(): void { this.device_id = undefined; this._nodeDiagnostics = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName }); @@ -149,7 +154,7 @@ class DialogMatterManageFabrics extends LitElement { return [ haStyleDialog, css` - ha-dialog { + ha-wa-dialog { --dialog-content-padding: 0; --mdc-list-side-padding: 24px; --mdc-list-side-padding-right: 16px; diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts index e72cf36ca3..5758e173e0 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts @@ -5,7 +5,8 @@ import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { copyToClipboard } from "../../../../../common/util/copy-clipboard"; import "../../../../../components/ha-button"; -import { createCloseHeading } from "../../../../../components/ha-dialog"; +import "../../../../../components/ha-dialog-footer"; +import "../../../../../components/ha-wa-dialog"; import "../../../../../components/ha-qr-code"; import "../../../../../components/ha-spinner"; import { domainToName } from "../../../../../data/integration"; @@ -26,10 +27,13 @@ class DialogMatterOpenCommissioningWindow extends LitElement { @state() private _commissionParams?: MatterCommissioningParameters; + @state() private _open = false; + public async showDialog( params: MatterOpenCommissioningWindowDialogParams ): Promise { this.device_id = params.device_id; + this._open = true; } protected render() { @@ -38,15 +42,13 @@ class DialogMatterOpenCommissioningWindow extends LitElement { } return html` - ${this._commissionParams ? html` @@ -90,11 +92,6 @@ class DialogMatterOpenCommissioningWindow extends LitElement { > - - ${this.hass.localize( - "ui.panel.config.matter.open_commissioning_window.copy_code" - )} - ` : this._status === "started" ? html` @@ -110,9 +107,6 @@ class DialogMatterOpenCommissioningWindow extends LitElement {

- - ${this.hass.localize("ui.common.close")} - ` : this._status === "failed" ? html` @@ -129,9 +123,6 @@ class DialogMatterOpenCommissioningWindow extends LitElement {

- - ${this.hass.localize("ui.common.close")} - ` : html`

@@ -151,13 +142,31 @@ class DialogMatterOpenCommissioningWindow extends LitElement { "ui.panel.config.matter.open_commissioning_window.prevent_misuse_description" )}

+ `} + + ${this._commissionParams + ? html` + + ${this.hass.localize( + "ui.panel.config.matter.open_commissioning_window.copy_code" + )} + + ` + : this._status === "started" || this._status === "failed" + ? html` + + ${this.hass.localize("ui.common.close")} + + ` + : html` ${this.hass.localize( "ui.panel.config.matter.open_commissioning_window.start_commissioning" )} `} -
+ + `; } @@ -186,6 +195,10 @@ class DialogMatterOpenCommissioningWindow extends LitElement { } public closeDialog(): void { + this._open = false; + } + + private _dialogClosed(): void { this.device_id = undefined; this._status = undefined; this._commissionParams = undefined; diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts index 638b02ea90..b651ea74d1 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts @@ -4,11 +4,12 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { copyToClipboard } from "../../../../../common/util/copy-clipboard"; -import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-list"; import "../../../../../components/ha-button"; +import "../../../../../components/ha-dialog-footer"; import "../../../../../components/ha-list-item"; import "../../../../../components/ha-spinner"; +import "../../../../../components/ha-wa-dialog"; import { pingMatterNode } from "../../../../../data/matter"; import { haStyle, haStyleDialog } from "../../../../../resources/styles"; import type { HomeAssistant } from "../../../../../types"; @@ -28,8 +29,11 @@ class DialogMatterPingNode extends LitElement { success: boolean, ][]; + @state() private _open = false; + public async showDialog(params: MatterPingNodeDialogParams): Promise { this.device_id = params.device_id; + this._open = true; } private async _copyIpToClipboard(ev) { @@ -46,13 +50,13 @@ class DialogMatterPingNode extends LitElement { } return html` - ${this._status === "failed" ? html` @@ -71,9 +75,6 @@ class DialogMatterPingNode extends LitElement {

- - ${this.hass.localize("ui.common.close")} - ` : this._pingResultEntries ? html` @@ -98,9 +99,6 @@ class DialogMatterPingNode extends LitElement { ` )} - - ${this.hass.localize("ui.common.close")} - ` : this._status === "started" ? html` @@ -116,9 +114,6 @@ class DialogMatterPingNode extends LitElement {

- - ${this.hass.localize("ui.common.close")} - ` : html`

@@ -133,13 +128,25 @@ class DialogMatterPingNode extends LitElement { )}

- - ${this.hass.localize( - "ui.panel.config.matter.ping_node.start_ping" - )} - `} -
+ + ${this._status === "failed" || + this._pingResultEntries || + this._status === "started" + ? html` + + ${this.hass.localize("ui.common.close")} + + ` + : html` + + ${this.hass.localize( + "ui.panel.config.matter.ping_node.start_ping" + )} + + `} + + `; } @@ -162,6 +169,10 @@ class DialogMatterPingNode extends LitElement { } public closeDialog(): void { + this._open = false; + } + + private _dialogClosed(): void { this.device_id = undefined; this._status = undefined; this._pingResultEntries = undefined; diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts index dc4c24a0c6..44704263e4 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts @@ -5,7 +5,8 @@ import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-button"; import "../../../../../components/ha-spinner"; -import { createCloseHeading } from "../../../../../components/ha-dialog"; +import "../../../../../components/ha-dialog-footer"; +import "../../../../../components/ha-wa-dialog"; import { interviewMatterNode } from "../../../../../data/matter"; import { haStyleDialog } from "../../../../../resources/styles"; import type { HomeAssistant } from "../../../../../types"; @@ -19,10 +20,13 @@ class DialogMatterReinterviewNode extends LitElement { @state() private _status?: string; + @state() private _open = false; + public async showDialog( params: MatterReinterviewNodeDialogParams ): Promise { this.device_id = params.device_id; + this._open = true; } protected render() { @@ -31,13 +35,13 @@ class DialogMatterReinterviewNode extends LitElement { } return html` - ${!this._status ? html` @@ -53,11 +57,6 @@ class DialogMatterReinterviewNode extends LitElement { )}

- - ${this.hass.localize( - "ui.panel.config.matter.reinterview_node.start_reinterview" - )} - ` : this._status === "started" ? html` @@ -78,9 +77,6 @@ class DialogMatterReinterviewNode extends LitElement {

- - ${this.hass.localize("ui.common.close")} - ` : this._status === "failed" ? html` @@ -97,9 +93,6 @@ class DialogMatterReinterviewNode extends LitElement {

- - ${this.hass.localize("ui.common.close")} - ` : this._status === "finished" ? html` @@ -116,12 +109,27 @@ class DialogMatterReinterviewNode extends LitElement {

- - ${this.hass.localize("ui.common.close")} - ` : nothing} -
+ + ${!this._status + ? html` + + ${this.hass.localize( + "ui.panel.config.matter.reinterview_node.start_reinterview" + )} + + ` + : html` + + ${this.hass.localize("ui.common.close")} + + `} + + `; } @@ -139,6 +147,10 @@ class DialogMatterReinterviewNode extends LitElement { } public closeDialog(): void { + this._open = false; + } + + private _dialogClosed(): void { this.device_id = undefined; this._status = undefined; fireEvent(this, "dialog-closed", { dialog: this.localName });