mirror of
https://github.com/home-assistant/frontend.git
synced 2026-02-10 19:36:12 +00:00
Compare commits
1 Commits
migrate-di
...
migrate-di
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0285fffe21 |
@@ -4,7 +4,7 @@ import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
import type { HassDialog } from "../../../../../dialogs/make-dialog-manager";
|
||||
import type { HomeAssistant } from "../../../../../types";
|
||||
import type { DialogThreadDatasetParams } from "./show-dialog-thread-dataset";
|
||||
import "../../../../../components/ha-wa-dialog";
|
||||
import { createCloseHeading } from "../../../../../components/ha-dialog";
|
||||
|
||||
@customElement("ha-dialog-thread-dataset")
|
||||
class DialogThreadDataset extends LitElement implements HassDialog {
|
||||
@@ -12,22 +12,16 @@ class DialogThreadDataset extends LitElement implements HassDialog {
|
||||
|
||||
@state() private _params?: DialogThreadDatasetParams;
|
||||
|
||||
@state() private _open = false;
|
||||
|
||||
public async showDialog(
|
||||
params: DialogThreadDatasetParams
|
||||
): Promise<Promise<void>> {
|
||||
this._params = params;
|
||||
this._open = true;
|
||||
}
|
||||
|
||||
public closeDialog() {
|
||||
this._open = false;
|
||||
}
|
||||
|
||||
private _dialogClosed() {
|
||||
this._params = undefined;
|
||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||
return true;
|
||||
}
|
||||
|
||||
protected render() {
|
||||
@@ -43,11 +37,10 @@ class DialogThreadDataset extends LitElement implements HassDialog {
|
||||
dataset.extended_pan_id &&
|
||||
otbrInfo.active_dataset_tlvs?.includes(dataset.extended_pan_id);
|
||||
|
||||
return html`<ha-wa-dialog
|
||||
.hass=${this.hass}
|
||||
.open=${this._open}
|
||||
header-title=${network.name}
|
||||
@closed=${this._dialogClosed}
|
||||
return html`<ha-dialog
|
||||
open
|
||||
@closed=${this.closeDialog}
|
||||
.heading=${createCloseHeading(this.hass, network.name)}
|
||||
>
|
||||
<div>
|
||||
Network name: ${dataset.network_name}<br />
|
||||
@@ -61,7 +54,7 @@ class DialogThreadDataset extends LitElement implements HassDialog {
|
||||
Active dataset TLVs: ${otbrInfo.active_dataset_tlvs}`
|
||||
: nothing}
|
||||
</div>
|
||||
</ha-wa-dialog>`;
|
||||
</ha-dialog>`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,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 type { HassDialog } from "../../../../../dialogs/make-dialog-manager";
|
||||
import type { HomeAssistant } from "../../../../../types";
|
||||
import { showToast } from "../../../../../util/toast";
|
||||
@@ -16,16 +17,22 @@ class DialogZeroconfDiscoveryInfo extends LitElement implements HassDialog {
|
||||
|
||||
@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 +52,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 +101,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>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user