From 7f92e1a3c0074fa978558bb61cea15e05f4ccd73 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Thu, 11 Feb 2021 21:14:02 +0100 Subject: [PATCH] Add new list with information about users' media (#89) --- src/App.js | 7 ++++++ src/components/statistics.js | 42 ++++++++++++++++++++++++++++++++++++ src/i18n/de.js | 7 ++++++ src/i18n/en.js | 7 ++++++ src/synapse/dataProvider.js | 11 ++++++++++ 5 files changed, 74 insertions(+) create mode 100644 src/components/statistics.js diff --git a/src/App.js b/src/App.js index d5c9bfd..ec240a5 100644 --- a/src/App.js +++ b/src/App.js @@ -8,6 +8,8 @@ import { RoomList, RoomShow } from "./components/rooms"; import { ReportList, ReportShow } from "./components/EventReports"; import LoginPage from "./components/LoginPage"; import UserIcon from "@material-ui/icons/Group"; +import EqualizerIcon from "@material-ui/icons/Equalizer"; +import { UserMediaStatsList } from "./components/statistics"; import RoomIcon from "@material-ui/icons/ViewList"; import ReportIcon from "@material-ui/icons/Warning"; import { ImportFeature } from "./components/ImportFeature"; @@ -43,6 +45,11 @@ const App = () => ( icon={UserIcon} /> + ( + +); + +const UserMediaStatsFilter = props => ( + + + +); + +export const UserMediaStatsList = props => { + return ( + } + pagination={} + sort={{ field: "media_length", order: "DESC" }} + bulkActionButtons={false} + > + "/users/" + id + "/media"}> + + + + + + + ); +}; diff --git a/src/i18n/de.js b/src/i18n/de.js index 4402a50..f20ef18 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -266,6 +266,13 @@ export default { 'Sendet eine Serverbenachrichtigung an die ausgewählten Nutzer. Hierfür muss das Feature "Server Notices" auf dem Server aktiviert sein.', }, }, + user_media_statistics: { + name: "Dateien je Benutzer", + fields: { + media_count: "Anzahl der Dateien", + media_length: "Größe der Dateien", + }, + }, }, ra: { ...germanMessages.ra, diff --git a/src/i18n/en.js b/src/i18n/en.js index 74a1e9c..bb3ac3b 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -263,5 +263,12 @@ export default { 'Sends a server notice to the selected users. The feature "Server Notices" has to be activated at the server.', }, }, + user_media_statistics: { + name: "Users' media", + fields: { + media_count: "Media count", + media_length: "Media length", + }, + }, }, }; diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 2a664c4..d928462 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -174,6 +174,17 @@ const resourceMap = { method: "POST", }), }, + user_media_statistics: { + path: "/_synapse/admin/v1/statistics/users/media", + map: usms => ({ + ...usms, + id: usms.user_id, + }), + data: "users", + total: json => { + return json.total; + }, + }, }; function filterNullValues(key, value) {