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 { import {
Datagrid, Datagrid,
DateField, DateField,
DeleteButton,
List, List,
NumberField, NumberField,
Pagination, Pagination,
@ -10,6 +11,8 @@ import {
Tab, Tab,
TabbedShowLayout, TabbedShowLayout,
TextField, TextField,
TopToolbar,
useRecordContext,
useTranslate, useTranslate,
} from "react-admin"; } from "react-admin";
import PageviewIcon from "@mui/icons-material/Pageview"; import PageviewIcon from "@mui/icons-material/Pageview";
@ -32,7 +35,7 @@ const ReportPagination = () => (
export const ReportShow = props => { export const ReportShow = props => {
const translate = useTranslate(); const translate = useTranslate();
return ( return (
<Show {...props}> <Show {...props} actions={<ReportShowActions />}>
<TabbedShowLayout> <TabbedShowLayout>
<Tab <Tab
label={translate("synapseadmin.reports.tabs.basic", { 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 => ( export const ReportList = props => (
<List <List
{...props} {...props}

View File

@ -188,7 +188,7 @@ const de = {
}, },
}, },
reports: { reports: {
name: "Ereignisbericht |||| Ereignisberichte", name: "Gemeldetes Ereignis |||| Gemeldete Ereignisse",
fields: { fields: {
id: "ID", id: "ID",
received_ts: "Meldezeit", 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: { connections: {
name: "Verbindungen", 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: { connections: {
name: "Connections", name: "Connections",