Allow deletion of event reports (#462)

* feat: Allow event reports to get deleted
* chore: Change german translation of reports name to be more fitting
This commit is contained in:
Steffo 2024-02-07 16:34:50 +01:00 committed by GitHub
parent 3116b4e07a
commit 9d26a1ce3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 34 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import React from "react";
import {
Datagrid,
DateField,
DeleteButton,
List,
NumberField,
Pagination,
@ -10,6 +11,8 @@ import {
Tab,
TabbedShowLayout,
TextField,
TopToolbar,
useRecordContext,
useTranslate,
} from "react-admin";
import PageviewIcon from "@mui/icons-material/Pageview";
@ -32,7 +35,7 @@ const ReportPagination = () => (
export const ReportShow = props => {
const translate = useTranslate();
return (
<Show {...props}>
<Show {...props} actions={<ReportShowActions />}>
<TabbedShowLayout>
<Tab
label={translate("synapseadmin.reports.tabs.basic", {
@ -99,6 +102,21 @@ export const ReportShow = props => {
);
};
const ReportShowActions = () => {
const record = useRecordContext();
return (
<TopToolbar>
<DeleteButton
record={record}
mutationMode="pessimistic"
confirmTitle="resources.reports.action.erase.title"
confirmContent="resources.reports.action.erase.content"
/>
</TopToolbar>
);
};
export const ReportList = props => (
<List
{...props}

View File

@ -188,7 +188,7 @@ const de = {
},
},
reports: {
name: "Ereignisbericht |||| Ereignisberichte",
name: "Gemeldetes Ereignis |||| Gemeldete Ereignisse",
fields: {
id: "ID",
received_ts: "Meldezeit",
@ -210,6 +210,13 @@ const de = {
},
},
},
action: {
erase: {
title: "Gemeldetes Event löschen",
content:
"Sind Sie sicher dass Sie das gemeldete Event löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.",
},
},
},
connections: {
name: "Verbindungen",

View File

@ -207,6 +207,13 @@ const en = {
},
},
},
action: {
erase: {
title: "Delete reported event",
content:
"Are you sure you want to delete the reported event? This cannot be undone.",
},
},
},
connections: {
name: "Connections",