Merge tag '0.5.0' into amp.chat
Change-Id: I410e194bc7b153c69e00f40a4486a46924cd510a
This commit is contained in:
commit
fb8cff3e3e
@ -1,5 +1,5 @@
|
|||||||
# Builder
|
# Builder
|
||||||
FROM node:10-alpine as builder
|
FROM node:current as builder
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
This project is built using [react-admin](https://marmelab.com/react-admin/).
|
This project is built using [react-admin](https://marmelab.com/react-admin/).
|
||||||
|
|
||||||
It needs at least Synapse v1.15.0 for all functions to work as expected!
|
It needs at least Synapse v1.18.0 for all functions to work as expected!
|
||||||
|
|
||||||
## Step-By-Step install:
|
## Step-By-Step install:
|
||||||
|
|
||||||
@ -29,3 +29,8 @@ Steps for 2):
|
|||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
![Screenshots](./screenshots.jpg)
|
![Screenshots](./screenshots.jpg)
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
- Use `yarn test` to run all style, lint and unit tests
|
||||||
|
- Use `yarn fix` to fix the coding style
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "synapse-admin",
|
"name": "synapse-admin",
|
||||||
"version": "AMP/2020.07",
|
"version": "AMP/2020.08",
|
||||||
"description": "Admin GUI for the Matrix.org server Synapse",
|
"description": "Admin GUI for the Matrix.org server Synapse",
|
||||||
"author": "Awesome Technologies Innovationslabor GmbH",
|
"author": "Awesome Technologies Innovationslabor GmbH",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
@ -18,6 +18,7 @@
|
|||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-config-prettier": "^6.10.1",
|
"eslint-config-prettier": "^6.10.1",
|
||||||
"eslint-plugin-prettier": "^3.1.2",
|
"eslint-plugin-prettier": "^3.1.2",
|
||||||
|
"jest-fetch-mock": "^3.0.3",
|
||||||
"prettier": "^2.0.0"
|
"prettier": "^2.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -49,6 +49,7 @@ const App = () => (
|
|||||||
/>
|
/>
|
||||||
<Resource name="connections" />
|
<Resource name="connections" />
|
||||||
<Resource name="devices" />
|
<Resource name="devices" />
|
||||||
|
<Resource name="room_members" />
|
||||||
<Resource name="servernotices" />
|
<Resource name="servernotices" />
|
||||||
</Admin>
|
</Admin>
|
||||||
);
|
);
|
||||||
|
@ -11,6 +11,8 @@ import {
|
|||||||
List,
|
List,
|
||||||
Pagination,
|
Pagination,
|
||||||
ReferenceArrayInput,
|
ReferenceArrayInput,
|
||||||
|
ReferenceField,
|
||||||
|
ReferenceManyField,
|
||||||
SelectField,
|
SelectField,
|
||||||
Show,
|
Show,
|
||||||
Tab,
|
Tab,
|
||||||
@ -201,6 +203,34 @@ export const RoomShow = props => {
|
|||||||
/>
|
/>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
||||||
|
<Tab label="synapseadmin.rooms.tabs.members" icon={<UserIcon />}>
|
||||||
|
<ReferenceManyField
|
||||||
|
reference="room_members"
|
||||||
|
target="room_id"
|
||||||
|
addLabel={false}
|
||||||
|
>
|
||||||
|
<Datagrid
|
||||||
|
style={{ width: "100%" }}
|
||||||
|
rowClick={(id, basePath, record) => "/users/" + id}
|
||||||
|
>
|
||||||
|
<TextField
|
||||||
|
source="id"
|
||||||
|
sortable={false}
|
||||||
|
label="resources.users.fields.id"
|
||||||
|
/>
|
||||||
|
<ReferenceField
|
||||||
|
label="resources.users.fields.displayname"
|
||||||
|
source="id"
|
||||||
|
reference="users"
|
||||||
|
sortable={false}
|
||||||
|
link=""
|
||||||
|
>
|
||||||
|
<TextField source="displayname" sortable={false} />
|
||||||
|
</ReferenceField>
|
||||||
|
</Datagrid>
|
||||||
|
</ReferenceManyField>
|
||||||
|
</Tab>
|
||||||
|
|
||||||
<Tab
|
<Tab
|
||||||
label="synapseadmin.rooms.tabs.permission"
|
label="synapseadmin.rooms.tabs.permission"
|
||||||
icon={<VisibilityIcon />}
|
icon={<VisibilityIcon />}
|
||||||
|
@ -295,7 +295,10 @@ export const UserEdit = props => {
|
|||||||
return (
|
return (
|
||||||
<Edit {...props} title={<UserTitle />}>
|
<Edit {...props} title={<UserTitle />}>
|
||||||
<TabbedForm toolbar={<UserEditToolbar />}>
|
<TabbedForm toolbar={<UserEditToolbar />}>
|
||||||
<FormTab label="resources.users.name" icon={<PersonPinIcon />}>
|
<FormTab
|
||||||
|
label={translate("resources.users.name", { smart_count: 1 })}
|
||||||
|
icon={<PersonPinIcon />}
|
||||||
|
>
|
||||||
<AvatarField
|
<AvatarField
|
||||||
source="avatar_src"
|
source="avatar_src"
|
||||||
sortable={false}
|
sortable={false}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { configure } from "enzyme";
|
import { configure } from "enzyme";
|
||||||
import Adapter from "enzyme-adapter-react-16";
|
import Adapter from "enzyme-adapter-react-16";
|
||||||
|
import fetchMock from "jest-fetch-mock";
|
||||||
|
|
||||||
configure({ adapter: new Adapter() });
|
configure({ adapter: new Adapter() });
|
||||||
|
fetchMock.enableMocks();
|
||||||
|
@ -111,6 +111,15 @@ const resourceMap = {
|
|||||||
}),
|
}),
|
||||||
data: "connections",
|
data: "connections",
|
||||||
},
|
},
|
||||||
|
room_members: {
|
||||||
|
map: m => ({
|
||||||
|
id: m,
|
||||||
|
}),
|
||||||
|
reference: id => ({
|
||||||
|
endpoint: `/_synapse/admin/v1/rooms/${id}/members`,
|
||||||
|
}),
|
||||||
|
data: "members",
|
||||||
|
},
|
||||||
servernotices: {
|
servernotices: {
|
||||||
map: n => ({ id: n.event_id }),
|
map: n => ({ id: n.event_id }),
|
||||||
create: data => ({
|
create: data => ({
|
||||||
|
78
src/synapse/dataProvider.test.js
Normal file
78
src/synapse/dataProvider.test.js
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
import dataProvider from "./dataProvider";
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fetch.resetMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("dataProvider", () => {
|
||||||
|
localStorage.setItem("base_url", "http://localhost");
|
||||||
|
localStorage.setItem("access_token", "access_token");
|
||||||
|
|
||||||
|
it("fetches all users", async () => {
|
||||||
|
fetch.mockResponseOnce(
|
||||||
|
JSON.stringify({
|
||||||
|
users: [
|
||||||
|
{
|
||||||
|
name: "user_id1",
|
||||||
|
password_hash: "password_hash1",
|
||||||
|
is_guest: 0,
|
||||||
|
admin: 0,
|
||||||
|
user_type: null,
|
||||||
|
deactivated: 0,
|
||||||
|
displayname: "User One",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "user_id2",
|
||||||
|
password_hash: "password_hash2",
|
||||||
|
is_guest: 0,
|
||||||
|
admin: 1,
|
||||||
|
user_type: null,
|
||||||
|
deactivated: 0,
|
||||||
|
displayname: "User Two",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
next_token: "100",
|
||||||
|
total: 200,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const users = await dataProvider.getList("users", {
|
||||||
|
pagination: { page: 1, perPage: 5 },
|
||||||
|
sort: { field: "title", order: "ASC" },
|
||||||
|
filter: { author_id: 12 },
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(users["data"][0]["id"]).toEqual("user_id1");
|
||||||
|
expect(users["total"]).toEqual(200);
|
||||||
|
expect(fetch).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("fetches one user", async () => {
|
||||||
|
fetch.mockResponseOnce(
|
||||||
|
JSON.stringify({
|
||||||
|
name: "user_id1",
|
||||||
|
password: "user_password",
|
||||||
|
displayname: "User",
|
||||||
|
threepids: [
|
||||||
|
{
|
||||||
|
medium: "email",
|
||||||
|
address: "user@mail_1.com",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
medium: "email",
|
||||||
|
address: "user@mail_2.com",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
avatar_url: "mxc://localhost/user1",
|
||||||
|
admin: false,
|
||||||
|
deactivated: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const user = await dataProvider.getOne("users", { id: "user_id1" });
|
||||||
|
|
||||||
|
expect(user["data"]["id"]).toEqual("user_id1");
|
||||||
|
expect(user["data"]["displayname"]).toEqual("User");
|
||||||
|
expect(fetch).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user