Added missing delete action (#3645)
This commit is contained in:
parent
a66caf954e
commit
c401fa6eee
2 changed files with 26 additions and 0 deletions
|
@ -316,6 +316,8 @@
|
|||
"searchForMessageBundle": "Search for message bundle",
|
||||
"addMessageBundle": "Add message bundle",
|
||||
"addMessageBundleSuccess": "Success! The message bundle has been added.",
|
||||
"deleteMessageBundleSuccess": "Successfully removed the message from the bundle",
|
||||
"deleteMessageBundleError": "Error removing the message from the bundle, {{error}}",
|
||||
"rowEditBtnAriaLabel": "Edit {{messageBundle}}",
|
||||
"rowSaveBtnAriaLabel": "Save edits for {{messageBundle}}",
|
||||
"rowCancelBtnAriaLabel": "Cancel edits for {{messageBundle}}",
|
||||
|
|
|
@ -61,6 +61,7 @@ export enum RowEditAction {
|
|||
Save = "save",
|
||||
Cancel = "cancel",
|
||||
Edit = "edit",
|
||||
Delete = "delete",
|
||||
}
|
||||
|
||||
export type BundleForm = {
|
||||
|
@ -332,6 +333,20 @@ export const LocalizationTab = ({ save, realm }: LocalizationTabProps) => {
|
|||
}
|
||||
};
|
||||
|
||||
const deleteKey = async (key: string) => {
|
||||
try {
|
||||
await adminClient.realms.deleteRealmLocalizationTexts({
|
||||
realm: currentRealm!,
|
||||
selectedLocale: selectMenuLocale,
|
||||
key,
|
||||
});
|
||||
refreshTable();
|
||||
addAlert(t("deleteMessageBundleSuccess"));
|
||||
} catch (error) {
|
||||
addError("realm-settings:deleteMessageBundleError", error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{addMessageBundleModalOpen && (
|
||||
|
@ -578,6 +593,15 @@ export const LocalizationTab = ({ save, realm }: LocalizationTabProps) => {
|
|||
onRowEdit={(_, type, _b, rowIndex, validation) =>
|
||||
updateEditableRows(type, rowIndex, validation)
|
||||
}
|
||||
actions={[
|
||||
{
|
||||
title: t("common:delete"),
|
||||
onClick: (_, row) =>
|
||||
deleteKey(
|
||||
(tableRows[row].cells?.[0] as IRowCell).props.value
|
||||
),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<TableHeader />
|
||||
<TableBody />
|
||||
|
|
Loading…
Reference in a new issue