mirror of
https://github.com/UA-Fediland/synapse-admin.git
synced 2024-11-26 00:03:17 +00:00
Add list of client connections per user (#26)
List the result of GET /_synapse/admin/v1/whois/<user_id>.
This commit is contained in:
parent
dfc643a10f
commit
7ef6bc05c6
5 changed files with 87 additions and 19 deletions
|
@ -36,6 +36,7 @@ const App = () => (
|
||||||
icon={UserIcon}
|
icon={UserIcon}
|
||||||
/>
|
/>
|
||||||
<Resource name="rooms" list={RoomList} icon={RoomIcon} />
|
<Resource name="rooms" list={RoomList} icon={RoomIcon} />
|
||||||
|
<Resource name="connections" />
|
||||||
</Admin>
|
</Admin>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import PersonPinIcon from "@material-ui/icons/PersonPin";
|
||||||
|
import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent";
|
||||||
import {
|
import {
|
||||||
ArrayInput,
|
ArrayInput,
|
||||||
|
ArrayField,
|
||||||
Datagrid,
|
Datagrid,
|
||||||
|
DateField,
|
||||||
Create,
|
Create,
|
||||||
Edit,
|
Edit,
|
||||||
List,
|
List,
|
||||||
Filter,
|
Filter,
|
||||||
SimpleForm,
|
SimpleForm,
|
||||||
SimpleFormIterator,
|
SimpleFormIterator,
|
||||||
|
TabbedForm,
|
||||||
|
FormTab,
|
||||||
BooleanField,
|
BooleanField,
|
||||||
BooleanInput,
|
BooleanInput,
|
||||||
ImageField,
|
ImageField,
|
||||||
|
@ -94,7 +100,8 @@ export const UserCreate = props => (
|
||||||
|
|
||||||
export const UserEdit = props => (
|
export const UserEdit = props => (
|
||||||
<Edit {...props}>
|
<Edit {...props}>
|
||||||
<SimpleForm>
|
<TabbedForm>
|
||||||
|
<FormTab label="resources.users.name" icon={<PersonPinIcon />}>
|
||||||
<TextInput source="id" disabled />
|
<TextInput source="id" disabled />
|
||||||
<TextInput source="displayname" />
|
<TextInput source="displayname" />
|
||||||
<PasswordInput source="password" autoComplete="new-password" />
|
<PasswordInput source="password" autoComplete="new-password" />
|
||||||
|
@ -112,6 +119,40 @@ export const UserEdit = props => (
|
||||||
<TextInput source="address" />
|
<TextInput source="address" />
|
||||||
</SimpleFormIterator>
|
</SimpleFormIterator>
|
||||||
</ArrayInput>
|
</ArrayInput>
|
||||||
</SimpleForm>
|
</FormTab>
|
||||||
|
<FormTab
|
||||||
|
label="resources.connections.name"
|
||||||
|
icon={<SettingsInputComponentIcon />}
|
||||||
|
>
|
||||||
|
<ReferenceField reference="connections" source="id" addLabel={false}>
|
||||||
|
<ArrayField
|
||||||
|
source="devices[].sessions[0].connections"
|
||||||
|
label="resources.connections.name"
|
||||||
|
>
|
||||||
|
<Datagrid style={{ width: "100%" }}>
|
||||||
|
<TextField source="ip" sortable={false} />
|
||||||
|
<DateField
|
||||||
|
source="last_seen"
|
||||||
|
showTime
|
||||||
|
options={{
|
||||||
|
year: "numeric",
|
||||||
|
month: "2-digit",
|
||||||
|
day: "2-digit",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
second: "2-digit",
|
||||||
|
}}
|
||||||
|
sortable={false}
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
source="user_agent"
|
||||||
|
sortable={false}
|
||||||
|
style={{ width: "100%" }}
|
||||||
|
/>
|
||||||
|
</Datagrid>
|
||||||
|
</ArrayField>
|
||||||
|
</ReferenceField>
|
||||||
|
</FormTab>
|
||||||
|
</TabbedForm>
|
||||||
</Edit>
|
</Edit>
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,6 +14,7 @@ export default {
|
||||||
},
|
},
|
||||||
resources: {
|
resources: {
|
||||||
users: {
|
users: {
|
||||||
|
backtolist: "Zurück zur Liste",
|
||||||
name: "Benutzer",
|
name: "Benutzer",
|
||||||
email: "E-Mail",
|
email: "E-Mail",
|
||||||
msisdn: "Telefon",
|
msisdn: "Telefon",
|
||||||
|
@ -44,5 +45,13 @@ export default {
|
||||||
joined_members: "Mitglieder",
|
joined_members: "Mitglieder",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
connections: {
|
||||||
|
name: "Verbindungen",
|
||||||
|
fields: {
|
||||||
|
last_seen: "Datum",
|
||||||
|
ip: "IP-Adresse",
|
||||||
|
user_agent: "User Agent",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,6 +14,7 @@ export default {
|
||||||
},
|
},
|
||||||
resources: {
|
resources: {
|
||||||
users: {
|
users: {
|
||||||
|
backtolist: "Back to list",
|
||||||
name: "User |||| Users",
|
name: "User |||| Users",
|
||||||
email: "Email",
|
email: "Email",
|
||||||
msisdn: "Phone",
|
msisdn: "Phone",
|
||||||
|
@ -44,5 +45,13 @@ export default {
|
||||||
joined_members: "Members",
|
joined_members: "Members",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
connections: {
|
||||||
|
name: "Connections",
|
||||||
|
fields: {
|
||||||
|
last_seen: "Date",
|
||||||
|
ip: "IP address",
|
||||||
|
user_agent: "User agent",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,6 +44,14 @@ const resourceMap = {
|
||||||
return json.total_rooms;
|
return json.total_rooms;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
connections: {
|
||||||
|
path: "/_synapse/admin/v1/whois",
|
||||||
|
map: c => ({
|
||||||
|
...c,
|
||||||
|
id: c.user_id,
|
||||||
|
}),
|
||||||
|
data: "connections",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function filterNullValues(key, value) {
|
function filterNullValues(key, value) {
|
||||||
|
|
Loading…
Reference in a new issue