Skip to content

Commit

Permalink
Use original id to remove entity (#4829)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten committed Feb 10, 2020
1 parent e7e8dff commit 2c006e9
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/panels/config/entities/entity-registry-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down

0 comments on commit 2c006e9

Please sign in to comment.