diff --git a/apps/admin-ui/public/resources/en/realm-settings.json b/apps/admin-ui/public/resources/en/realm-settings.json index c9bd64788a..bd02109621 100644 --- a/apps/admin-ui/public/resources/en/realm-settings.json +++ b/apps/admin-ui/public/resources/en/realm-settings.json @@ -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}}", diff --git a/apps/admin-ui/src/realm-settings/LocalizationTab.tsx b/apps/admin-ui/src/realm-settings/LocalizationTab.tsx index b6f58ca72a..23b69b4ad2 100644 --- a/apps/admin-ui/src/realm-settings/LocalizationTab.tsx +++ b/apps/admin-ui/src/realm-settings/LocalizationTab.tsx @@ -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 + ), + }, + ]} >