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:
parent
b184954ffa
commit
425c210cfc
@ -4,6 +4,7 @@ import {
|
|||||||
BooleanField,
|
BooleanField,
|
||||||
BulkDeleteWithConfirmButton,
|
BulkDeleteWithConfirmButton,
|
||||||
Datagrid,
|
Datagrid,
|
||||||
|
DeleteButton,
|
||||||
Filter,
|
Filter,
|
||||||
List,
|
List,
|
||||||
Pagination,
|
Pagination,
|
||||||
@ -15,6 +16,7 @@ import {
|
|||||||
Tab,
|
Tab,
|
||||||
TabbedShowLayout,
|
TabbedShowLayout,
|
||||||
TextField,
|
TextField,
|
||||||
|
TopToolbar,
|
||||||
useTranslate,
|
useTranslate,
|
||||||
} from "react-admin";
|
} from "react-admin";
|
||||||
import get from "lodash/get";
|
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 => {
|
export const RoomShow = props => {
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
return (
|
return (
|
||||||
<Show {...props} title={<RoomTitle />}>
|
<Show {...props} actions={<RoomShowActions />} title={<RoomTitle />}>
|
||||||
<TabbedShowLayout>
|
<TabbedShowLayout>
|
||||||
<Tab label="synapseadmin.rooms.tabs.basic" icon={<ViewListIcon />}>
|
<Tab label="synapseadmin.rooms.tabs.basic" icon={<ViewListIcon />}>
|
||||||
<TextField source="room_id" />
|
<TextField source="room_id" />
|
||||||
|
Loading…
Reference in New Issue
Block a user