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",
|
"searchForMessageBundle": "Search for message bundle",
|
||||||
"addMessageBundle": "Add message bundle",
|
"addMessageBundle": "Add message bundle",
|
||||||
"addMessageBundleSuccess": "Success! The message bundle has been added.",
|
"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}}",
|
"rowEditBtnAriaLabel": "Edit {{messageBundle}}",
|
||||||
"rowSaveBtnAriaLabel": "Save edits for {{messageBundle}}",
|
"rowSaveBtnAriaLabel": "Save edits for {{messageBundle}}",
|
||||||
"rowCancelBtnAriaLabel": "Cancel edits for {{messageBundle}}",
|
"rowCancelBtnAriaLabel": "Cancel edits for {{messageBundle}}",
|
||||||
|
|
|
@ -61,6 +61,7 @@ export enum RowEditAction {
|
||||||
Save = "save",
|
Save = "save",
|
||||||
Cancel = "cancel",
|
Cancel = "cancel",
|
||||||
Edit = "edit",
|
Edit = "edit",
|
||||||
|
Delete = "delete",
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BundleForm = {
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
{addMessageBundleModalOpen && (
|
{addMessageBundleModalOpen && (
|
||||||
|
@ -578,6 +593,15 @@ export const LocalizationTab = ({ save, realm }: LocalizationTabProps) => {
|
||||||
onRowEdit={(_, type, _b, rowIndex, validation) =>
|
onRowEdit={(_, type, _b, rowIndex, validation) =>
|
||||||
updateEditableRows(type, rowIndex, validation)
|
updateEditableRows(type, rowIndex, validation)
|
||||||
}
|
}
|
||||||
|
actions={[
|
||||||
|
{
|
||||||
|
title: t("common:delete"),
|
||||||
|
onClick: (_, row) =>
|
||||||
|
deleteKey(
|
||||||
|
(tableRows[row].cells?.[0] as IRowCell).props.value
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<TableHeader />
|
<TableHeader />
|
||||||
<TableBody />
|
<TableBody />
|
||||||
|
|
Loading…
Reference in a new issue