Merge branch 'master' into delete_functions
This commit is contained in:
commit
f2d64a5d4a
@ -6,5 +6,6 @@
|
||||
"singleQuote": false,
|
||||
"trailingComma": "es5",
|
||||
"bracketSpacing": true,
|
||||
"jsxBracketSameLine": false
|
||||
"jsxBracketSameLine": false,
|
||||
"arrowParens": "avoid",
|
||||
}
|
||||
|
16
package.json
16
package.json
@ -10,22 +10,22 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "^5.1.1",
|
||||
"@testing-library/react": "^9.4.0",
|
||||
"@testing-library/user-event": "^8.1.0",
|
||||
"@testing-library/react": "^10.0.2",
|
||||
"@testing-library/user-event": "^10.0.1",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.2",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-prettier": "^6.10.0",
|
||||
"eslint-config-prettier": "^6.10.1",
|
||||
"eslint-plugin-prettier": "^3.1.2",
|
||||
"prettier": "^1.19.1"
|
||||
"prettier": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"prop-types": "^15.7.2",
|
||||
"ra-language-german": "^2.1.2",
|
||||
"react": "^16.12.0",
|
||||
"react-admin": "^3.1.3",
|
||||
"react-dom": "^16.12.0",
|
||||
"react-scripts": "^3.3.0"
|
||||
"react": "^16.13.1",
|
||||
"react-admin": "^3.4.0",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-scripts": "^3.4.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
|
@ -36,6 +36,7 @@ const App = () => (
|
||||
icon={UserIcon}
|
||||
/>
|
||||
<Resource name="rooms" list={RoomList} icon={RoomIcon} />
|
||||
<Resource name="connections" />
|
||||
</Admin>
|
||||
);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { Fragment } from "react";
|
||||
import { Datagrid, List, TextField, BulkDeleteButton } from "react-admin";
|
||||
import { Datagrid, List, TextField, BulkDeleteButton, Pagination } from "react-admin";
|
||||
|
||||
const RoomBulkActionButtons = props => (
|
||||
<Fragment>
|
||||
@ -7,8 +7,16 @@ const RoomBulkActionButtons = props => (
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
const RoomPagination = props => (
|
||||
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
||||
);
|
||||
|
||||
export const RoomList = props => (
|
||||
<List {...props} bulkActionButtons={<RoomBulkActionButtons />}>
|
||||
<List
|
||||
{...props}
|
||||
pagination={<RoomPagination />}
|
||||
bulkActionButtons={<RoomBulkActionButtons />}
|
||||
>
|
||||
<Datagrid>
|
||||
<TextField source="room_id" />
|
||||
<TextField source="name" />
|
||||
|
@ -1,11 +1,19 @@
|
||||
import React, { Fragment } 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,14 +21,20 @@ import {
|
||||
TextField,
|
||||
TextInput,
|
||||
ReferenceField,
|
||||
SelectInput,
|
||||
regex,
|
||||
Toolbar,
|
||||
SaveButton,
|
||||
DeleteButton,
|
||||
ListButton,
|
||||
BulkDeleteButton,
|
||||
Pagination,
|
||||
} from "react-admin";
|
||||
|
||||
const UserPagination = props => (
|
||||
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
||||
);
|
||||
|
||||
const UserFilter = props => (
|
||||
<Filter {...props}>
|
||||
<BooleanInput source="guests" alwaysOn />
|
||||
@ -60,6 +74,7 @@ export const UserList = props => (
|
||||
filters={<UserFilter />}
|
||||
filterDefaultValues={{ guests: true, deactivated: false }}
|
||||
bulkActionButtons={<UserBulkActionButtons />}
|
||||
pagination={<UserPagination />}
|
||||
>
|
||||
<Datagrid rowClick="edit">
|
||||
<ReferenceField
|
||||
@ -100,18 +115,80 @@ 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 toolbar={<UserEditToolbar />}>
|
||||
<TextInput source="id" disabled />
|
||||
<TextInput source="displayname" />
|
||||
<PasswordInput source="password" autoComplete="new-password" />
|
||||
<BooleanInput source="admin" />
|
||||
<BooleanInput source="deactivated" />
|
||||
</SimpleForm>
|
||||
<TabbedForm toolbar={<UserEditToolbar>
|
||||
<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"
|
||||
helperText="resources.users.helper.deactivate"
|
||||
/>
|
||||
<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>
|
||||
);
|
||||
|
@ -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,13 @@ export default {
|
||||
user_id: "Suche Benutzer",
|
||||
displayname: "Anzeigename",
|
||||
password: "Passwort",
|
||||
avatar_url: "Avatar URL",
|
||||
medium: "Medium",
|
||||
threepids: "3PIDs",
|
||||
address: "Adresse",
|
||||
},
|
||||
helper: {
|
||||
deactivate: "Deaktivierte Nutzer können nicht wieder aktiviert werden.",
|
||||
},
|
||||
action: {
|
||||
deactivate: "Deaktiviere Benutzer",
|
||||
@ -45,5 +55,13 @@ export default {
|
||||
purge: "Säubere Raum",
|
||||
},
|
||||
},
|
||||
connections: {
|
||||
name: "Verbindungen",
|
||||
fields: {
|
||||
last_seen: "Datum",
|
||||
ip: "IP-Adresse",
|
||||
user_agent: "User Agent",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -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,13 @@ export default {
|
||||
user_id: "Search user",
|
||||
displayname: "Displayname",
|
||||
password: "Password",
|
||||
avatar_url: "Avatar URL",
|
||||
medium: "Medium",
|
||||
threepids: "3PIDs",
|
||||
address: "Address",
|
||||
},
|
||||
helper: {
|
||||
deactivate: "Deactivated users cannot be reactivated",
|
||||
},
|
||||
action: {
|
||||
deactivate: "Deactivate user",
|
||||
@ -45,5 +55,13 @@ export default {
|
||||
purge: "Säubere Raum",
|
||||
},
|
||||
},
|
||||
connections: {
|
||||
name: "Connections",
|
||||
fields: {
|
||||
last_seen: "Date",
|
||||
ip: "IP address",
|
||||
user_agent: "User agent",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -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;
|
||||
},
|
||||
delete_path: "/_synapse/admin/v1/deactivate",
|
||||
},
|
||||
@ -44,6 +46,14 @@ const resourceMap = {
|
||||
},
|
||||
delete_path: "/_synapse/admin/v1/purge_room",
|
||||
},
|
||||
connections: {
|
||||
path: "/_synapse/admin/v1/whois",
|
||||
map: c => ({
|
||||
...c,
|
||||
id: c.user_id,
|
||||
}),
|
||||
data: "connections",
|
||||
},
|
||||
};
|
||||
|
||||
function filterNullValues(key, value) {
|
||||
@ -133,13 +143,7 @@ const dataProvider = {
|
||||
|
||||
return jsonClient(url).then(({ headers, json }) => ({
|
||||
data: json,
|
||||
total: parseInt(
|
||||
headers
|
||||
.get("content-range")
|
||||
.split("/")
|
||||
.pop(),
|
||||
10
|
||||
),
|
||||
total: parseInt(headers.get("content-range").split("/").pop(), 10),
|
||||
}));
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user