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