Show room members in room detail view

Change-Id: I7d82f728de0e503d4834f6815bde000c7a0204a3
This commit is contained in:
Michael Albert 2020-08-06 21:43:19 +02:00 committed by Manuel Stahl
parent 1f56bac356
commit 7c9a87bc86
4 changed files with 42 additions and 1 deletions

View file

@ -4,7 +4,7 @@
This project is built using [react-admin](https://marmelab.com/react-admin/). This project is built using [react-admin](https://marmelab.com/react-admin/).
It needs at least Synapse v1.15.0 for all functions to work as expected! It needs at least Synapse v1.18.0 for all functions to work as expected!
## Step-By-Step install: ## Step-By-Step install:

View file

@ -38,6 +38,7 @@ const App = () => (
<Resource name="rooms" list={RoomList} show={RoomShow} icon={RoomIcon} /> <Resource name="rooms" list={RoomList} show={RoomShow} icon={RoomIcon} />
<Resource name="connections" /> <Resource name="connections" />
<Resource name="devices" /> <Resource name="devices" />
<Resource name="room_members" />
<Resource name="servernotices" /> <Resource name="servernotices" />
</Admin> </Admin>
); );

View file

@ -6,6 +6,8 @@ import {
Filter, Filter,
List, List,
Pagination, Pagination,
ReferenceField,
ReferenceManyField,
SelectField, SelectField,
Show, Show,
Tab, Tab,
@ -18,6 +20,7 @@ import { Tooltip, Typography, Chip } from "@material-ui/core";
import HttpsIcon from "@material-ui/icons/Https"; import HttpsIcon from "@material-ui/icons/Https";
import NoEncryptionIcon from "@material-ui/icons/NoEncryption"; import NoEncryptionIcon from "@material-ui/icons/NoEncryption";
import PageviewIcon from "@material-ui/icons/Pageview"; import PageviewIcon from "@material-ui/icons/Pageview";
import UserIcon from "@material-ui/icons/Group";
import ViewListIcon from "@material-ui/icons/ViewList"; import ViewListIcon from "@material-ui/icons/ViewList";
import VisibilityIcon from "@material-ui/icons/Visibility"; import VisibilityIcon from "@material-ui/icons/Visibility";
@ -92,6 +95,34 @@ export const RoomShow = props => {
/> />
</Tab> </Tab>
<Tab label="synapseadmin.rooms.tabs.members" icon={<UserIcon />}>
<ReferenceManyField
reference="room_members"
target="room_id"
addLabel={false}
>
<Datagrid
style={{ width: "100%" }}
rowClick={(id, basePath, record) => "/users/" + id}
>
<TextField
source="id"
sortable={false}
label="resources.users.fields.id"
/>
<ReferenceField
label="resources.users.fields.displayname"
source="id"
reference="users"
sortable={false}
link=""
>
<TextField source="displayname" sortable={false} />
</ReferenceField>
</Datagrid>
</ReferenceManyField>
</Tab>
<Tab <Tab
label="synapseadmin.rooms.tabs.permission" label="synapseadmin.rooms.tabs.permission"
icon={<VisibilityIcon />} icon={<VisibilityIcon />}

View file

@ -88,6 +88,15 @@ const resourceMap = {
}), }),
data: "connections", data: "connections",
}, },
room_members: {
map: m => ({
id: m,
}),
reference: id => ({
endpoint: `/_synapse/admin/v1/rooms/${id}/members`,
}),
data: "members",
},
servernotices: { servernotices: {
map: n => ({ id: n.event_id }), map: n => ({ id: n.event_id }),
create: data => ({ create: data => ({