mirror of
https://github.com/home-assistant/frontend.git
synced 2026-02-08 09:18:29 +00:00
Compare commits
1 Commits
dev
...
migrate-di
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5dfbfe5d0b |
@@ -3,10 +3,11 @@ import { html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
import type { HassDialog } from "../../../../../dialogs/make-dialog-manager";
|
||||
import { createCloseHeading } from "../../../../../components/ha-dialog";
|
||||
import type { HomeAssistant } from "../../../../../types";
|
||||
import type { SSDPDiscoveryInfoDialogParams } from "./show-dialog-ssdp-discovery-info";
|
||||
import "../../../../../components/ha-button";
|
||||
import "../../../../../components/ha-dialog-footer";
|
||||
import "../../../../../components/ha-wa-dialog";
|
||||
import { showToast } from "../../../../../util/toast";
|
||||
import { copyToClipboard } from "../../../../../common/util/copy-clipboard";
|
||||
import { showSSDPRawDataDialog } from "./show-dialog-ssdp-raw-data";
|
||||
@@ -17,16 +18,22 @@ class DialogSSDPDiscoveryInfo extends LitElement implements HassDialog {
|
||||
|
||||
@state() private _params?: SSDPDiscoveryInfoDialogParams;
|
||||
|
||||
@state() private _open = false;
|
||||
|
||||
public async showDialog(
|
||||
params: SSDPDiscoveryInfoDialogParams
|
||||
): 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> {
|
||||
@@ -56,13 +63,13 @@ class DialogSSDPDiscoveryInfo extends LitElement implements HassDialog {
|
||||
}
|
||||
|
||||
return html`
|
||||
<ha-dialog
|
||||
open
|
||||
@closed=${this.closeDialog}
|
||||
.heading=${createCloseHeading(
|
||||
this.hass,
|
||||
this.hass.localize("ui.panel.config.ssdp.discovery_information")
|
||||
<ha-wa-dialog
|
||||
.hass=${this.hass}
|
||||
.open=${this._open}
|
||||
header-title=${this.hass.localize(
|
||||
"ui.panel.config.ssdp.discovery_information"
|
||||
)}
|
||||
@closed=${this._dialogClosed}
|
||||
>
|
||||
<p>
|
||||
<b>${this.hass.localize("ui.panel.config.ssdp.name")}</b>:
|
||||
@@ -113,15 +120,16 @@ class DialogSSDPDiscoveryInfo extends LitElement implements HassDialog {
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<ha-button
|
||||
appearance="plain"
|
||||
slot="secondaryAction"
|
||||
@click=${this._copyToClipboard}
|
||||
>
|
||||
${this.hass.localize("ui.panel.config.ssdp.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.ssdp.copy_to_clipboard")}
|
||||
</ha-button>
|
||||
</ha-dialog-footer>
|
||||
</ha-wa-dialog>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import type { TemplateResult } from "lit";
|
||||
import { dump } from "js-yaml";
|
||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
import type { HassDialog } from "../../../../../dialogs/make-dialog-manager";
|
||||
import { createCloseHeading } from "../../../../../components/ha-dialog";
|
||||
import type { HomeAssistant } from "../../../../../types";
|
||||
import "../../../../../components/ha-code-editor";
|
||||
import "../../../../../components/ha-wa-dialog";
|
||||
|
||||
export interface SSDPRawDataDialogParams {
|
||||
key: string;
|
||||
@@ -19,14 +19,20 @@ class DialogSSDPRawData extends LitElement implements HassDialog {
|
||||
|
||||
@state() private _params?: SSDPRawDataDialogParams;
|
||||
|
||||
@state() private _open = false;
|
||||
|
||||
public async showDialog(params: SSDPRawDataDialogParams): 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;
|
||||
}
|
||||
|
||||
protected render(): TemplateResult | typeof nothing {
|
||||
@@ -35,13 +41,11 @@ class DialogSSDPRawData extends LitElement implements HassDialog {
|
||||
}
|
||||
|
||||
return html`
|
||||
<ha-dialog
|
||||
open
|
||||
@closed=${this.closeDialog}
|
||||
.heading=${createCloseHeading(
|
||||
this.hass,
|
||||
`${this.hass.localize("ui.panel.config.ssdp.raw_data_title")}: ${this._params.key}`
|
||||
)}
|
||||
<ha-wa-dialog
|
||||
.hass=${this.hass}
|
||||
.open=${this._open}
|
||||
header-title=${`${this.hass.localize("ui.panel.config.ssdp.raw_data_title")}: ${this._params.key}`}
|
||||
@closed=${this._dialogClosed}
|
||||
>
|
||||
<ha-code-editor
|
||||
mode="yaml"
|
||||
@@ -50,7 +54,7 @@ class DialogSSDPRawData extends LitElement implements HassDialog {
|
||||
read-only
|
||||
autofocus
|
||||
></ha-code-editor>
|
||||
</ha-dialog>
|
||||
</ha-wa-dialog>
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user