mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 21:37:21 +00:00
Add error handling for application credentials removal (#12686)
This commit is contained in:
parent
f6411dce66
commit
788f76ab9c
@ -19,7 +19,10 @@ import {
|
||||
fetchApplicationCredentials,
|
||||
} from "../../../data/application_credential";
|
||||
import { domainToName } from "../../../data/integration";
|
||||
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
|
||||
import {
|
||||
showAlertDialog,
|
||||
showConfirmationDialog,
|
||||
} from "../../../dialogs/generic/show-dialog-box";
|
||||
import "../../../layouts/hass-tabs-subpage-data-table";
|
||||
import type { HaTabsSubpageDataTable } from "../../../layouts/hass-tabs-subpage-data-table";
|
||||
import { HomeAssistant, Route } from "../../../types";
|
||||
@ -171,11 +174,24 @@ export class HaConfigApplicationCredentials extends LitElement {
|
||||
confirmText: this.hass.localize("ui.common.remove"),
|
||||
dismissText: this.hass.localize("ui.common.cancel"),
|
||||
confirm: async () => {
|
||||
await Promise.all(
|
||||
this._selected.map(async (applicationCredential) => {
|
||||
await deleteApplicationCredential(this.hass, applicationCredential);
|
||||
})
|
||||
);
|
||||
try {
|
||||
await Promise.all(
|
||||
this._selected.map(async (applicationCredential) => {
|
||||
await deleteApplicationCredential(
|
||||
this.hass,
|
||||
applicationCredential
|
||||
);
|
||||
})
|
||||
);
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.application_credentials.picker.remove_selected.error_title"
|
||||
),
|
||||
text: err.message,
|
||||
});
|
||||
return;
|
||||
}
|
||||
this._dataTable.clearSelection();
|
||||
this._fetchApplicationCredentials();
|
||||
},
|
||||
|
@ -2895,7 +2895,8 @@
|
||||
"remove_selected": {
|
||||
"button": "Remove selected",
|
||||
"confirm_title": "Do you want to remove {number} {number, plural,\n one {credential}\n other {credentialss}\n}?",
|
||||
"confirm_text": "Application Credentials in use by an integration may not be removed."
|
||||
"confirm_text": "Application Credentials in use by an integration may not be removed.",
|
||||
"error_title": "Removing Application Credential failed"
|
||||
},
|
||||
"selected": "{number} selected"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user