Reload application credentials after single delete (#21216)

Reload application credentials after delete
This commit is contained in:
Simon Lamon 2024-06-28 14:46:27 +02:00 committed by GitHub
parent 4a1087c969
commit d33cf4f199
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,7 +107,7 @@ export class HaConfigApplicationCredentials extends LitElement {
path: mdiDelete, path: mdiDelete,
warning: true, warning: true,
label: this.hass.localize("ui.common.delete"), label: this.hass.localize("ui.common.delete"),
action: () => this._removeCredential(credential), action: () => this._deleteCredential(credential),
}, },
]} ]}
> >
@ -160,7 +160,7 @@ export class HaConfigApplicationCredentials extends LitElement {
<div class="header-btns" slot="selection-bar"> <div class="header-btns" slot="selection-bar">
${!this.narrow ${!this.narrow
? html` ? html`
<mwc-button @click=${this._removeSelected} class="warning" <mwc-button @click=${this._deleteSelected} class="warning"
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.application_credentials.picker.remove_selected.button" "ui.panel.config.application_credentials.picker.remove_selected.button"
)}</mwc-button )}</mwc-button
@ -170,7 +170,7 @@ export class HaConfigApplicationCredentials extends LitElement {
<ha-icon-button <ha-icon-button
class="warning" class="warning"
id="remove-btn" id="remove-btn"
@click=${this._removeSelected} @click=${this._deleteSelected}
.path=${mdiDelete} .path=${mdiDelete}
.label=${this.hass.localize("ui.common.remove")} .label=${this.hass.localize("ui.common.remove")}
></ha-icon-button> ></ha-icon-button>
@ -202,7 +202,7 @@ export class HaConfigApplicationCredentials extends LitElement {
this._selected = ev.detail.value; this._selected = ev.detail.value;
} }
private _removeCredential = async (credential) => { private _deleteCredential = async (credential) => {
const confirm = await showConfirmationDialog(this, { const confirm = await showConfirmationDialog(this, {
title: this.hass.localize( title: this.hass.localize(
`ui.panel.config.application_credentials.picker.remove.confirm_title` `ui.panel.config.application_credentials.picker.remove.confirm_title`
@ -218,9 +218,10 @@ export class HaConfigApplicationCredentials extends LitElement {
return; return;
} }
await deleteApplicationCredential(this.hass, credential.id); await deleteApplicationCredential(this.hass, credential.id);
await this._fetchApplicationCredentials();
}; };
private _removeSelected() { private _deleteSelected() {
showConfirmationDialog(this, { showConfirmationDialog(this, {
title: this.hass.localize( title: this.hass.localize(
`ui.panel.config.application_credentials.picker.remove_selected.confirm_title`, `ui.panel.config.application_credentials.picker.remove_selected.confirm_title`,
@ -252,7 +253,7 @@ export class HaConfigApplicationCredentials extends LitElement {
return; return;
} }
this._dataTable.clearSelection(); this._dataTable.clearSelection();
this._fetchApplicationCredentials(); await this._fetchApplicationCredentials();
}, },
}); });
} }