Fix updating entity id in entity-registry-dialog (#3962)

This commit is contained in:
Bram Kragten 2019-10-08 12:27:29 +02:00 committed by GitHub
parent ef51f29e28
commit 0f7a3887a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,7 @@ class DialogEntityRegistryDetail extends LitElement {
@property() private _error?: string; @property() private _error?: string;
@property() private _params?: EntityRegistryDetailDialogParams; @property() private _params?: EntityRegistryDetailDialogParams;
@property() private _submitting?: boolean; @property() private _submitting?: boolean;
private _origEntityId!: string;
public async showDialog( public async showDialog(
params: EntityRegistryDetailDialogParams params: EntityRegistryDetailDialogParams
@ -44,6 +45,7 @@ class DialogEntityRegistryDetail extends LitElement {
this._error = undefined; this._error = undefined;
this._name = this._params.entry.name || ""; this._name = this._params.entry.name || "";
this._platform = this._params.entry.platform; this._platform = this._params.entry.platform;
this._origEntityId = this._params.entry.entity_id;
this._entityId = this._params.entry.entity_id; this._entityId = this._params.entry.entity_id;
this._disabledBy = this._params.entry.disabled_by; this._disabledBy = this._params.entry.disabled_by;
await this.updateComplete; await this.updateComplete;
@ -170,7 +172,7 @@ class DialogEntityRegistryDetail extends LitElement {
private async _updateEntry(): Promise<void> { private async _updateEntry(): Promise<void> {
this._submitting = true; this._submitting = true;
try { try {
await updateEntityRegistryEntry(this.hass!, this._entityId, { await updateEntityRegistryEntry(this.hass!, this._origEntityId, {
name: this._name.trim() || null, name: this._name.trim() || null,
disabled_by: this._disabledBy, disabled_by: this._disabledBy,
new_entity_id: this._entityId.trim(), new_entity_id: this._entityId.trim(),