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}
/>
<Resource name="rooms" list={RoomList} icon={RoomIcon} />
<Resource name="connections" />
</Admin>
);

View File

@ -1,11 +1,19 @@
import React, { cloneElement } 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,
@ -13,6 +21,7 @@ import {
TextField,
TextInput,
ReferenceField,
SelectInput,
regex,
CreateButton,
ExportButton,
@ -117,18 +126,77 @@ export const UserCreate = props => (
<TextInput source="displayname" />
<PasswordInput source="password" autoComplete="new-password" />
<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>
</Create>
);
export const UserEdit = props => (
<Edit {...props}>
<SimpleForm>
<TabbedForm>
<FormTab label="resources.users.name" icon={<PersonPinIcon />}>
<TextInput source="id" disabled />
<TextInput source="displayname" />
<PasswordInput source="password" autoComplete="new-password" />
<BooleanInput source="admin" />
<BooleanInput source="deactivated" />
</SimpleForm>
<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>
);

View File

@ -14,7 +14,10 @@ export default {
},
resources: {
users: {
backtolist: "Zurück zur Liste",
name: "Benutzer",
email: "E-Mail",
msisdn: "Telefon",
fields: {
avatar: "Avatar",
id: "Benutzer-ID",
@ -27,6 +30,10 @@ export default {
user_id: "Suche Benutzer",
displayname: "Anzeigename",
password: "Passwort",
avatar_url: "Avatar URL",
medium: "Medium",
threepids: "3PIDs",
address: "Adresse",
},
},
rooms: {
@ -38,5 +45,13 @@ export default {
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: {
users: {
backtolist: "Back to list",
name: "User |||| Users",
email: "Email",
msisdn: "Phone",
fields: {
avatar: "Avatar",
id: "User-ID",
@ -27,6 +30,10 @@ export default {
user_id: "Search user",
displayname: "Displayname",
password: "Password",
avatar_url: "Avatar URL",
medium: "Medium",
threepids: "3PIDs",
address: "Address",
},
},
rooms: {
@ -38,5 +45,13 @@ export default {
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",
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: {
@ -42,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) {

2274
yarn.lock

File diff suppressed because it is too large Load Diff