mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-16 22:40:55 +00:00
Compare commits
1 Commits
copilot/fi
...
revert-rev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74db7f5868 |
@@ -5,7 +5,8 @@ import { fireEvent } from "../../../../common/dom/fire_event";
|
|||||||
import { computeDeviceNameDisplay } from "../../../../common/entity/compute_device_name";
|
import { computeDeviceNameDisplay } from "../../../../common/entity/compute_device_name";
|
||||||
import "../../../../components/ha-alert";
|
import "../../../../components/ha-alert";
|
||||||
import "../../../../components/ha-area-picker";
|
import "../../../../components/ha-area-picker";
|
||||||
import "../../../../components/ha-dialog";
|
import "../../../../components/ha-wa-dialog";
|
||||||
|
import "../../../../components/ha-dialog-footer";
|
||||||
import "../../../../components/ha-button";
|
import "../../../../components/ha-button";
|
||||||
import "../../../../components/ha-labels-picker";
|
import "../../../../components/ha-labels-picker";
|
||||||
import type { HaSwitch } from "../../../../components/ha-switch";
|
import type { HaSwitch } from "../../../../components/ha-switch";
|
||||||
@@ -19,6 +20,8 @@ import type { DeviceRegistryDetailDialogParams } from "./show-dialog-device-regi
|
|||||||
class DialogDeviceRegistryDetail extends LitElement {
|
class DialogDeviceRegistryDetail extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@state() private _open = false;
|
||||||
|
|
||||||
@state() private _nameByUser!: string;
|
@state() private _nameByUser!: string;
|
||||||
|
|
||||||
@state() private _error?: string;
|
@state() private _error?: string;
|
||||||
@@ -42,10 +45,15 @@ class DialogDeviceRegistryDetail extends LitElement {
|
|||||||
this._areaId = this._params.device.area_id || "";
|
this._areaId = this._params.device.area_id || "";
|
||||||
this._labels = this._params.device.labels || [];
|
this._labels = this._params.device.labels || [];
|
||||||
this._disabledBy = this._params.device.disabled_by;
|
this._disabledBy = this._params.device.disabled_by;
|
||||||
|
this._open = true;
|
||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog(): void {
|
||||||
|
this._open = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _dialogClosed(): void {
|
||||||
this._error = "";
|
this._error = "";
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
@@ -57,10 +65,12 @@ class DialogDeviceRegistryDetail extends LitElement {
|
|||||||
}
|
}
|
||||||
const device = this._params.device;
|
const device = this._params.device;
|
||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-wa-dialog
|
||||||
open
|
.hass=${this.hass}
|
||||||
@closed=${this.closeDialog}
|
.open=${this._open}
|
||||||
.heading=${computeDeviceNameDisplay(device, this.hass)}
|
header-title=${computeDeviceNameDisplay(device, this.hass)}
|
||||||
|
prevent-scrim-close
|
||||||
|
@closed=${this._dialogClosed}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
${this._error
|
${this._error
|
||||||
@@ -68,6 +78,7 @@ class DialogDeviceRegistryDetail extends LitElement {
|
|||||||
: ""}
|
: ""}
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<ha-textfield
|
<ha-textfield
|
||||||
|
autofocus
|
||||||
.value=${this._nameByUser}
|
.value=${this._nameByUser}
|
||||||
@input=${this._nameChanged}
|
@input=${this._nameChanged}
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
@@ -75,7 +86,6 @@ class DialogDeviceRegistryDetail extends LitElement {
|
|||||||
)}
|
)}
|
||||||
.placeholder=${device.name || ""}
|
.placeholder=${device.name || ""}
|
||||||
.disabled=${this._submitting}
|
.disabled=${this._submitting}
|
||||||
dialogInitialFocus
|
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-area-picker
|
<ha-area-picker
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@@ -131,22 +141,25 @@ class DialogDeviceRegistryDetail extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ha-button
|
|
||||||
slot="secondaryAction"
|
<ha-dialog-footer slot="footer">
|
||||||
@click=${this.closeDialog}
|
<ha-button
|
||||||
.disabled=${this._submitting}
|
slot="secondaryAction"
|
||||||
appearance="plain"
|
@click=${this.closeDialog}
|
||||||
>
|
.disabled=${this._submitting}
|
||||||
${this.hass.localize("ui.common.cancel")}
|
appearance="plain"
|
||||||
</ha-button>
|
>
|
||||||
<ha-button
|
${this.hass.localize("ui.common.cancel")}
|
||||||
slot="primaryAction"
|
</ha-button>
|
||||||
@click=${this._updateEntry}
|
<ha-button
|
||||||
.disabled=${this._submitting}
|
slot="primaryAction"
|
||||||
>
|
@click=${this._updateEntry}
|
||||||
${this.hass.localize("ui.dialogs.device-registry-detail.update")}
|
.disabled=${this._submitting}
|
||||||
</ha-button>
|
>
|
||||||
</ha-dialog>
|
${this.hass.localize("ui.dialogs.device-registry-detail.update")}
|
||||||
|
</ha-button>
|
||||||
|
</ha-dialog-footer>
|
||||||
|
</ha-wa-dialog>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user