Add delete button to room detail page (#97)

* Add delete button to room detail page

* Add confirmation dialog for room deletion
This commit is contained in:
Dirk Klimpel 2021-02-11 20:24:17 +01:00 committed by GitHub
parent b184954ffa
commit 425c210cfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@ import {
BooleanField,
BulkDeleteWithConfirmButton,
Datagrid,
DeleteButton,
Filter,
List,
Pagination,
@ -15,6 +16,7 @@ import {
Tab,
TabbedShowLayout,
TextField,
TopToolbar,
useTranslate,
} from "react-admin";
import get from "lodash/get";
@ -70,10 +72,26 @@ const RoomTitle = ({ record }) => {
);
};
const RoomShowActions = ({ basePath, data, resource }) => {
const translate = useTranslate();
return (
<TopToolbar>
<DeleteButton
basePath={basePath}
record={data}
resource={resource}
undoable={false}
confirmTitle={translate("synapseadmin.rooms.delete.title")}
confirmContent={translate("synapseadmin.rooms.delete.message")}
/>
</TopToolbar>
);
};
export const RoomShow = props => {
const translate = useTranslate();
return (
<Show {...props} title={<RoomTitle />}>
<Show {...props} actions={<RoomShowActions />} title={<RoomTitle />}>
<TabbedShowLayout>
<Tab label="synapseadmin.rooms.tabs.basic" icon={<ViewListIcon />}>
<TextField source="room_id" />