From 7ef6bc05c626d46b0c94d9a7dfc9001fbee4ab8f Mon Sep 17 00:00:00 2001 From: dklimpel <5740567+dklimpel@users.noreply.github.com> Date: Sat, 28 Mar 2020 21:25:34 +0100 Subject: [PATCH] Add list of client connections per user (#26) List the result of GET /_synapse/admin/v1/whois/. --- src/App.js | 1 + src/components/users.js | 79 ++++++++++++++++++++++++++++--------- src/i18n/de.js | 9 +++++ src/i18n/en.js | 9 +++++ src/synapse/dataProvider.js | 8 ++++ 5 files changed, 87 insertions(+), 19 deletions(-) diff --git a/src/App.js b/src/App.js index ce37344..238d13b 100644 --- a/src/App.js +++ b/src/App.js @@ -36,6 +36,7 @@ const App = () => ( icon={UserIcon} /> + ); diff --git a/src/components/users.js b/src/components/users.js index 4f9c6f9..c027d01 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -1,13 +1,19 @@ import React from "react"; +import PersonPinIcon from "@material-ui/icons/PersonPin"; +import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent"; import { ArrayInput, + ArrayField, Datagrid, + DateField, Create, Edit, List, Filter, SimpleForm, SimpleFormIterator, + TabbedForm, + FormTab, BooleanField, BooleanInput, ImageField, @@ -94,24 +100,59 @@ export const UserCreate = props => ( export const UserEdit = props => ( - - - - - - - - - - - - - + + }> + + + + + + + + + + + + + } + > + + + + + + + + + + + ); diff --git a/src/i18n/de.js b/src/i18n/de.js index f469455..3a66110 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -14,6 +14,7 @@ export default { }, resources: { users: { + backtolist: "Zurück zur Liste", name: "Benutzer", email: "E-Mail", msisdn: "Telefon", @@ -44,5 +45,13 @@ export default { joined_members: "Mitglieder", }, }, + connections: { + name: "Verbindungen", + fields: { + last_seen: "Datum", + ip: "IP-Adresse", + user_agent: "User Agent", + }, + }, }, }; diff --git a/src/i18n/en.js b/src/i18n/en.js index a56d196..cc665b5 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -14,6 +14,7 @@ export default { }, resources: { users: { + backtolist: "Back to list", name: "User |||| Users", email: "Email", msisdn: "Phone", @@ -44,5 +45,13 @@ export default { joined_members: "Members", }, }, + connections: { + name: "Connections", + fields: { + last_seen: "Date", + ip: "IP address", + user_agent: "User agent", + }, + }, }, }; diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index e6fe273..10259dd 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -44,6 +44,14 @@ const resourceMap = { return json.total_rooms; }, }, + connections: { + path: "/_synapse/admin/v1/whois", + map: c => ({ + ...c, + id: c.user_id, + }), + data: "connections", + }, }; function filterNullValues(key, value) {