Merge branch 'master' into increase_export

This commit is contained in:
Dirk Klimpel 2020-03-30 11:42:34 +02:00 committed by GitHub
commit 5792d55a97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1445 additions and 954 deletions

View File

@ -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>
); );

View File

@ -1,11 +1,19 @@
import React, { cloneElement } from "react"; import React, { cloneElement } from "react";
import PersonPinIcon from "@material-ui/icons/PersonPin";
import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent";
import { import {
ArrayInput,
ArrayField,
Datagrid, Datagrid,
DateField,
Create, Create,
Edit, Edit,
List, List,
Filter, Filter,
SimpleForm, SimpleForm,
SimpleFormIterator,
TabbedForm,
FormTab,
BooleanField, BooleanField,
BooleanInput, BooleanInput,
ImageField, ImageField,
@ -13,6 +21,7 @@ import {
TextField, TextField,
TextInput, TextInput,
ReferenceField, ReferenceField,
SelectInput,
regex, regex,
CreateButton, CreateButton,
ExportButton, ExportButton,
@ -117,18 +126,77 @@ export const UserCreate = props => (
<TextInput source="displayname" /> <TextInput source="displayname" />
<PasswordInput source="password" autoComplete="new-password" /> <PasswordInput source="password" autoComplete="new-password" />
<BooleanInput source="admin" /> <BooleanInput source="admin" />
<ArrayInput source="threepids">
<SimpleFormIterator>
<SelectInput
source="medium"
choices={[
{ id: "email", name: "resources.users.email" },
{ id: "msisdn", name: "resources.users.msisdn" },
]}
/>
<TextInput source="address" />
</SimpleFormIterator>
</ArrayInput>
</SimpleForm> </SimpleForm>
</Create> </Create>
); );
export const UserEdit = props => ( export const UserEdit = props => (
<Edit {...props}> <Edit {...props}>
<SimpleForm> <TabbedForm>
<TextInput source="id" disabled /> <FormTab label="resources.users.name" icon={<PersonPinIcon />}>
<TextInput source="displayname" /> <TextInput source="id" disabled />
<PasswordInput source="password" autoComplete="new-password" /> <TextInput source="displayname" />
<BooleanInput source="admin" /> <PasswordInput source="password" autoComplete="new-password" />
<BooleanInput source="deactivated" /> <BooleanInput source="admin" />
</SimpleForm> <BooleanInput source="deactivated" />
<ArrayInput source="threepids">
<SimpleFormIterator>
<SelectInput
source="medium"
choices={[
{ id: "email", name: "resources.users.email" },
{ id: "msisdn", name: "resources.users.msisdn" },
]}
/>
<TextInput source="address" />
</SimpleFormIterator>
</ArrayInput>
</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>
); );

View File

@ -14,7 +14,10 @@ export default {
}, },
resources: { resources: {
users: { users: {
backtolist: "Zurück zur Liste",
name: "Benutzer", name: "Benutzer",
email: "E-Mail",
msisdn: "Telefon",
fields: { fields: {
avatar: "Avatar", avatar: "Avatar",
id: "Benutzer-ID", id: "Benutzer-ID",
@ -27,6 +30,10 @@ export default {
user_id: "Suche Benutzer", user_id: "Suche Benutzer",
displayname: "Anzeigename", displayname: "Anzeigename",
password: "Passwort", password: "Passwort",
avatar_url: "Avatar URL",
medium: "Medium",
threepids: "3PIDs",
address: "Adresse",
}, },
}, },
rooms: { rooms: {
@ -38,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",
},
},
}, },
}; };

View File

@ -14,7 +14,10 @@ export default {
}, },
resources: { resources: {
users: { users: {
backtolist: "Back to list",
name: "User |||| Users", name: "User |||| Users",
email: "Email",
msisdn: "Phone",
fields: { fields: {
avatar: "Avatar", avatar: "Avatar",
id: "User-ID", id: "User-ID",
@ -27,6 +30,10 @@ export default {
user_id: "Search user", user_id: "Search user",
displayname: "Displayname", displayname: "Displayname",
password: "Password", password: "Password",
avatar_url: "Avatar URL",
medium: "Medium",
threepids: "3PIDs",
address: "Address",
}, },
}, },
rooms: { rooms: {
@ -38,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",
},
},
}, },
}; };

View File

@ -26,7 +26,9 @@ const resourceMap = {
}), }),
data: "users", data: "users",
total: (json, from, perPage) => { total: (json, from, perPage) => {
return json.next_token ? parseInt(json.next_token, 10) + perPage : from + json.users.length; return json.next_token
? parseInt(json.next_token, 10) + perPage
: from + json.users.length;
}, },
}, },
rooms: { rooms: {
@ -42,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) {

2274
yarn.lock

File diff suppressed because it is too large Load Diff