Add button to purge rooms to room list
Add button (BulkDeleteButton) to delete rooms with no local users: - purge rooms `POST /_synapse/admin/v1/purge_room` (https://github.com/matrix-org/synapse/blob/master/docs/admin_api/purge_room.md)
This commit is contained in:
parent
009ce803e2
commit
e27ae35e12
@ -1,12 +1,36 @@
|
||||
import React from "react";
|
||||
import { Datagrid, List, TextField, Pagination } from "react-admin";
|
||||
import React, { Fragment } from "react";
|
||||
import {
|
||||
Datagrid,
|
||||
List,
|
||||
TextField,
|
||||
Pagination,
|
||||
BulkDeleteButton,
|
||||
useTranslate,
|
||||
} from "react-admin";
|
||||
|
||||
const RoomPagination = props => (
|
||||
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
||||
);
|
||||
|
||||
const RoomBulkActionButtons = props => {
|
||||
const translate = useTranslate();
|
||||
return (
|
||||
<Fragment>
|
||||
<BulkDeleteButton
|
||||
{...props}
|
||||
label="resources.rooms.action.purge"
|
||||
title={translate("resources.rooms.helper.purge")}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
|
||||
export const RoomList = props => (
|
||||
<List {...props} pagination={<RoomPagination />}>
|
||||
<List
|
||||
{...props}
|
||||
pagination={<RoomPagination />}
|
||||
bulkActionButtons={<RoomBulkActionButtons />}
|
||||
>
|
||||
<Datagrid>
|
||||
<TextField source="room_id" />
|
||||
<TextField source="name" />
|
||||
|
@ -54,6 +54,13 @@ export default {
|
||||
canonical_alias: "Alias",
|
||||
joined_members: "Mitglieder",
|
||||
},
|
||||
helper: {
|
||||
purge:
|
||||
"Alle lokalen Benutzer müssen den Raum verlassen haben, bevor er entfernt werden kann.",
|
||||
},
|
||||
action: {
|
||||
purge: "Säubere Raum",
|
||||
},
|
||||
},
|
||||
connections: {
|
||||
name: "Verbindungen",
|
||||
|
@ -54,6 +54,13 @@ export default {
|
||||
canonical_alias: "Alias",
|
||||
joined_members: "Members",
|
||||
},
|
||||
helper: {
|
||||
purge:
|
||||
"All local users must have left the room before it can be removed.",
|
||||
},
|
||||
action: {
|
||||
purge: "Purge room",
|
||||
},
|
||||
},
|
||||
connections: {
|
||||
name: "Connections",
|
||||
|
@ -53,6 +53,11 @@ const resourceMap = {
|
||||
total: json => {
|
||||
return json.total_rooms;
|
||||
},
|
||||
delete: id => ({
|
||||
endpoint: "/_synapse/admin/v1/purge_room",
|
||||
body: { room_id: id },
|
||||
method: "POST",
|
||||
}),
|
||||
},
|
||||
connections: {
|
||||
path: "/_synapse/admin/v1/whois",
|
||||
|
Loading…
Reference in New Issue
Block a user