mirror of
https://github.com/UA-Fediland/synapse-admin.git
synced 2024-11-22 14:31:27 +00:00
Add new list with information about users' media (#89)
This commit is contained in:
parent
ea59d0dd02
commit
7f92e1a3c0
5 changed files with 74 additions and 0 deletions
|
@ -8,6 +8,8 @@ import { RoomList, RoomShow } from "./components/rooms";
|
||||||
import { ReportList, ReportShow } from "./components/EventReports";
|
import { ReportList, ReportShow } from "./components/EventReports";
|
||||||
import LoginPage from "./components/LoginPage";
|
import LoginPage from "./components/LoginPage";
|
||||||
import UserIcon from "@material-ui/icons/Group";
|
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 RoomIcon from "@material-ui/icons/ViewList";
|
||||||
import ReportIcon from "@material-ui/icons/Warning";
|
import ReportIcon from "@material-ui/icons/Warning";
|
||||||
import { ImportFeature } from "./components/ImportFeature";
|
import { ImportFeature } from "./components/ImportFeature";
|
||||||
|
@ -43,6 +45,11 @@ const App = () => (
|
||||||
icon={UserIcon}
|
icon={UserIcon}
|
||||||
/>
|
/>
|
||||||
<Resource name="rooms" list={RoomList} show={RoomShow} icon={RoomIcon} />
|
<Resource name="rooms" list={RoomList} show={RoomShow} icon={RoomIcon} />
|
||||||
|
<Resource
|
||||||
|
name="user_media_statistics"
|
||||||
|
list={UserMediaStatsList}
|
||||||
|
icon={EqualizerIcon}
|
||||||
|
/>
|
||||||
<Resource
|
<Resource
|
||||||
name="reports"
|
name="reports"
|
||||||
list={ReportList}
|
list={ReportList}
|
||||||
|
|
42
src/components/statistics.js
Normal file
42
src/components/statistics.js
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import React from "react";
|
||||||
|
import {
|
||||||
|
Datagrid,
|
||||||
|
Filter,
|
||||||
|
List,
|
||||||
|
NumberField,
|
||||||
|
TextField,
|
||||||
|
SearchInput,
|
||||||
|
Pagination,
|
||||||
|
} from "react-admin";
|
||||||
|
|
||||||
|
const UserMediaStatsPagination = props => (
|
||||||
|
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
||||||
|
);
|
||||||
|
|
||||||
|
const UserMediaStatsFilter = props => (
|
||||||
|
<Filter {...props}>
|
||||||
|
<SearchInput source="search_term" alwaysOn />
|
||||||
|
</Filter>
|
||||||
|
);
|
||||||
|
|
||||||
|
export const UserMediaStatsList = props => {
|
||||||
|
return (
|
||||||
|
<List
|
||||||
|
{...props}
|
||||||
|
filters={<UserMediaStatsFilter />}
|
||||||
|
pagination={<UserMediaStatsPagination />}
|
||||||
|
sort={{ field: "media_length", order: "DESC" }}
|
||||||
|
bulkActionButtons={false}
|
||||||
|
>
|
||||||
|
<Datagrid rowClick={(id, basePath, record) => "/users/" + id + "/media"}>
|
||||||
|
<TextField source="user_id" label="resources.users.fields.id" />
|
||||||
|
<TextField
|
||||||
|
source="displayname"
|
||||||
|
label="resources.users.fields.displayname"
|
||||||
|
/>
|
||||||
|
<NumberField source="media_count" />
|
||||||
|
<NumberField source="media_length" />
|
||||||
|
</Datagrid>
|
||||||
|
</List>
|
||||||
|
);
|
||||||
|
};
|
|
@ -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.',
|
'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: {
|
ra: {
|
||||||
...germanMessages.ra,
|
...germanMessages.ra,
|
||||||
|
|
|
@ -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.',
|
'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",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -174,6 +174,17 @@ const resourceMap = {
|
||||||
method: "POST",
|
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) {
|
function filterNullValues(key, value) {
|
||||||
|
|
Loading…
Reference in a new issue