mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 18:06:36 +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,
|
fetchApplicationCredentials,
|
||||||
} from "../../../data/application_credential";
|
} from "../../../data/application_credential";
|
||||||
import { domainToName } from "../../../data/integration";
|
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 "../../../layouts/hass-tabs-subpage-data-table";
|
||||||
import type { HaTabsSubpageDataTable } from "../../../layouts/hass-tabs-subpage-data-table";
|
import type { HaTabsSubpageDataTable } from "../../../layouts/hass-tabs-subpage-data-table";
|
||||||
import { HomeAssistant, Route } from "../../../types";
|
import { HomeAssistant, Route } from "../../../types";
|
||||||
@ -171,11 +174,24 @@ export class HaConfigApplicationCredentials extends LitElement {
|
|||||||
confirmText: this.hass.localize("ui.common.remove"),
|
confirmText: this.hass.localize("ui.common.remove"),
|
||||||
dismissText: this.hass.localize("ui.common.cancel"),
|
dismissText: this.hass.localize("ui.common.cancel"),
|
||||||
confirm: async () => {
|
confirm: async () => {
|
||||||
await Promise.all(
|
try {
|
||||||
this._selected.map(async (applicationCredential) => {
|
await Promise.all(
|
||||||
await deleteApplicationCredential(this.hass, applicationCredential);
|
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._dataTable.clearSelection();
|
||||||
this._fetchApplicationCredentials();
|
this._fetchApplicationCredentials();
|
||||||
},
|
},
|
||||||
|
@ -2895,7 +2895,8 @@
|
|||||||
"remove_selected": {
|
"remove_selected": {
|
||||||
"button": "Remove selected",
|
"button": "Remove selected",
|
||||||
"confirm_title": "Do you want to remove {number} {number, plural,\n one {credential}\n other {credentialss}\n}?",
|
"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"
|
"selected": "{number} selected"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user