1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-02-15 07:25:54 +00:00

Migrate zeroconf discovery info dialog to wa (#29579)

* Migrate config-zeroconf dialog(s) to wa

* Cleanup
This commit is contained in:
Aidan Timson
2026-02-11 17:06:58 +00:00
committed by GitHub
parent 2e350d24f5
commit 432e8fc0d7

View File

@@ -4,28 +4,34 @@ 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 type { HassDialog } from "../../../../../dialogs/make-dialog-manager";
import "../../../../../components/ha-dialog-footer";
import "../../../../../components/ha-wa-dialog";
import type { HomeAssistant } from "../../../../../types";
import { showToast } from "../../../../../util/toast";
import type { ZeroconfDiscoveryInfoDialogParams } from "./show-dialog-zeroconf-discovery-info";
@customElement("dialog-zeroconf-device-info")
class DialogZeroconfDiscoveryInfo extends LitElement implements HassDialog {
class DialogZeroconfDiscoveryInfo extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@state() private _params?: ZeroconfDiscoveryInfoDialogParams;
@state() private _open = false;
public async showDialog(
params: ZeroconfDiscoveryInfoDialogParams
): Promise<void> {
this._params = params;
this._open = true;
}
public closeDialog(): boolean {
public closeDialog(): void {
this._open = false;
}
private _dialogClosed(): void {
this._params = undefined;
fireEvent(this, "dialog-closed", { dialog: this.localName });
return true;
}
private async _copyToClipboard(): Promise<void> {
@@ -45,13 +51,13 @@ class DialogZeroconfDiscoveryInfo extends LitElement implements HassDialog {
}
return html`
<ha-dialog
open
@closed=${this.closeDialog}
.heading=${createCloseHeading(
this.hass,
this.hass.localize("ui.panel.config.zeroconf.discovery_information")
<ha-wa-dialog
.hass=${this.hass}
.open=${this._open}
header-title=${this.hass.localize(
"ui.panel.config.zeroconf.discovery_information"
)}
@closed=${this._dialogClosed}
>
<p>
<b>${this.hass.localize("ui.panel.config.zeroconf.name")}</b>:
@@ -94,16 +100,16 @@ class DialogZeroconfDiscoveryInfo extends LitElement implements HassDialog {
)}
</tbody>
</table>
<ha-button
appearance="plain"
slot="secondaryAction"
@click=${this._copyToClipboard}
>${this.hass.localize(
"ui.panel.config.zeroconf.copy_to_clipboard"
)}</ha-button
>
</ha-dialog>
<ha-dialog-footer slot="footer">
<ha-button
slot="primaryAction"
appearance="plain"
@click=${this._copyToClipboard}
>
${this.hass.localize("ui.panel.config.zeroconf.copy_to_clipboard")}
</ha-button>
</ha-dialog-footer>
</ha-wa-dialog>
`;
}
}