Use original id to remove entity (#4829)

This commit is contained in:
Bram Kragten 2020-02-11 00:17:29 +01:00 committed by GitHub
parent e7e8dff0ec
commit 2c006e99f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,26 +177,27 @@ export class EntityRegistrySettings extends LitElement {
}
}
private async _deleteEntry(): Promise<void> {
private async _confirmDeleteEntry(): Promise<void> {
if (
!(await showConfirmationDialog(this, {
text: this.hass.localize(
"ui.dialogs.entity_registry.editor.confirm_delete"
),
}))
) {
return;
}
this._submitting = true;
try {
await removeEntityRegistryEntry(this.hass!, this._entityId);
await removeEntityRegistryEntry(this.hass!, this._origEntityId);
fireEvent(this as HTMLElement, "close-dialog");
} finally {
this._submitting = false;
}
}
private _confirmDeleteEntry(): void {
showConfirmationDialog(this, {
text: this.hass.localize(
"ui.dialogs.entity_registry.editor.confirm_delete"
),
confirm: () => this._deleteEntry(),
});
}
private _disabledByChanged(ev: Event): void {
this._disabledBy = (ev.target as HaSwitch).checked ? null : "user";
}