Merge branch 'fed_api' of git://github.com/dklimpel/synapse-admin into dklimpel-fed_api
This commit is contained in:
commit
edf810e035
48
README.md
48
README.md
@ -1,11 +1,8 @@
|
|||||||
[](https://travis-ci.org/Awesome-Technologies/synapse-admin)
|
|
||||||
[](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/build-test.yml)
|
|
||||||
|
|
||||||
# Synapse admin ui
|
# Synapse admin ui
|
||||||
|
|
||||||
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.48.0 for all functions to work as expected!
|
It needs at least Synapse v1.49.0 for all functions to work as expected!
|
||||||
|
|
||||||
You get your server version with the request `/_synapse/admin/v1/server_version`.
|
You get your server version with the request `/_synapse/admin/v1/server_version`.
|
||||||
See also [Synapse version API](https://matrix-org.github.io/synapse/develop/admin_api/version_api.html).
|
See also [Synapse version API](https://matrix-org.github.io/synapse/develop/admin_api/version_api.html).
|
||||||
@ -21,25 +18,8 @@ See also [Synapse administration endpoints](https://matrix-org.github.io/synapse
|
|||||||
|
|
||||||
## Step-By-Step install
|
## Step-By-Step install
|
||||||
|
|
||||||
You have three options:
|
|
||||||
|
|
||||||
1. [Download the tarball and serve with any webserver](#steps-for-1)
|
|
||||||
2. [Download the source code from github and run using nodejs](#steps-for-2)
|
|
||||||
3. [Run the Docker container](#steps-for-3)
|
|
||||||
|
|
||||||
### Steps for 1)
|
|
||||||
|
|
||||||
- make sure you have a webserver installed that can serve static files (any webserver like nginx or apache will do)
|
|
||||||
- configure a vhost for synapse admin on your webserver
|
|
||||||
- download the .tar.gz from the latest release: https://github.com/Awesome-Technologies/synapse-admin/releases/latest
|
|
||||||
- unpack the .tar.gz
|
|
||||||
- move or symlink the `synapse-admin-x.x.x` into your vhosts root dir
|
|
||||||
- open the url of the vhost in your browser
|
|
||||||
|
|
||||||
### Steps for 2)
|
|
||||||
|
|
||||||
- make sure you have installed the following: git, yarn, nodejs
|
- make sure you have installed the following: git, yarn, nodejs
|
||||||
- download the source code: `git clone https://github.com/Awesome-Technologies/synapse-admin.git`
|
- download the source code: `git clone https://github.com/matrix07012/synapse-admin.git`
|
||||||
- change into downloaded directory: `cd synapse-admin`
|
- change into downloaded directory: `cd synapse-admin`
|
||||||
- download dependencies: `yarn install`
|
- download dependencies: `yarn install`
|
||||||
- start web server: `yarn start`
|
- start web server: `yarn start`
|
||||||
@ -49,30 +29,6 @@ Either you define it at startup (e.g. `REACT_APP_SERVER=https://yourmatrixserver
|
|||||||
or by editing it in the [.env](.env) file. See also the
|
or by editing it in the [.env](.env) file. See also the
|
||||||
[documentation](https://create-react-app.dev/docs/adding-custom-environment-variables/).
|
[documentation](https://create-react-app.dev/docs/adding-custom-environment-variables/).
|
||||||
|
|
||||||
### Steps for 3)
|
|
||||||
|
|
||||||
- run the Docker container from the public docker registry: `docker run -p 8080:80 awesometechnologies/synapse-admin` or use the [docker-compose.yml](docker-compose.yml): `docker-compose up -d`
|
|
||||||
|
|
||||||
> note: if you're building on an architecture other than amd64 (for example a raspberry pi), make sure to define a maximum ram for node. otherwise the build will fail.
|
|
||||||
|
|
||||||
```yml
|
|
||||||
version: "3"
|
|
||||||
|
|
||||||
services:
|
|
||||||
synapse-admin:
|
|
||||||
container_name: synapse-admin
|
|
||||||
hostname: synapse-admin
|
|
||||||
build:
|
|
||||||
context: https://github.com/Awesome-Technologies/synapse-admin.git
|
|
||||||
# args:
|
|
||||||
# - NODE_OPTIONS="--max_old_space_size=1024"
|
|
||||||
ports:
|
|
||||||
- "8080:80"
|
|
||||||
restart: unless-stopped
|
|
||||||
```
|
|
||||||
|
|
||||||
- browse to http://localhost:8080
|
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||

|

|
||||||
|
10
src/App.js
10
src/App.js
@ -7,12 +7,14 @@ import { UserList, UserCreate, UserEdit } from "./components/users";
|
|||||||
import { RoomList, RoomShow } from "./components/rooms";
|
import { RoomList, RoomShow } from "./components/rooms";
|
||||||
import { ReportList, ReportShow } from "./components/EventReports";
|
import { ReportList, ReportShow } from "./components/EventReports";
|
||||||
import LoginPage from "./components/LoginPage";
|
import LoginPage from "./components/LoginPage";
|
||||||
import UserIcon from "@material-ui/icons/Group";
|
import CloudQueueIcon from "@material-ui/icons/CloudQueue";
|
||||||
import EqualizerIcon from "@material-ui/icons/Equalizer";
|
import EqualizerIcon from "@material-ui/icons/Equalizer";
|
||||||
|
import UserIcon from "@material-ui/icons/Group";
|
||||||
import { UserMediaStatsList } from "./components/statistics";
|
import { UserMediaStatsList } from "./components/statistics";
|
||||||
import RoomIcon from "@material-ui/icons/ViewList";
|
import RoomIcon from "@material-ui/icons/ViewList";
|
||||||
import ReportIcon from "@material-ui/icons/Warning";
|
import ReportIcon from "@material-ui/icons/Warning";
|
||||||
import FolderSharedIcon from "@material-ui/icons/FolderShared";
|
import FolderSharedIcon from "@material-ui/icons/FolderShared";
|
||||||
|
import { DestinationList, DestinationShow } from "./components/destinations";
|
||||||
import { ImportFeature } from "./components/ImportFeature";
|
import { ImportFeature } from "./components/ImportFeature";
|
||||||
import { RoomDirectoryList } from "./components/RoomDirectory";
|
import { RoomDirectoryList } from "./components/RoomDirectory";
|
||||||
import { Route } from "react-router-dom";
|
import { Route } from "react-router-dom";
|
||||||
@ -66,6 +68,12 @@ const App = () => (
|
|||||||
list={RoomDirectoryList}
|
list={RoomDirectoryList}
|
||||||
icon={FolderSharedIcon}
|
icon={FolderSharedIcon}
|
||||||
/>
|
/>
|
||||||
|
<Resource
|
||||||
|
name="destinations"
|
||||||
|
list={DestinationList}
|
||||||
|
show={DestinationShow}
|
||||||
|
icon={CloudQueueIcon}
|
||||||
|
/>
|
||||||
<Resource name="connections" />
|
<Resource name="connections" />
|
||||||
<Resource name="devices" />
|
<Resource name="devices" />
|
||||||
<Resource name="room_members" />
|
<Resource name="room_members" />
|
||||||
|
71
src/components/destinations.js
Normal file
71
src/components/destinations.js
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
import React from "react";
|
||||||
|
import {
|
||||||
|
Datagrid,
|
||||||
|
DateField,
|
||||||
|
Filter,
|
||||||
|
List,
|
||||||
|
Pagination,
|
||||||
|
SearchInput,
|
||||||
|
SimpleShowLayout,
|
||||||
|
Show,
|
||||||
|
TextField,
|
||||||
|
} from "react-admin";
|
||||||
|
|
||||||
|
const DestinationPagination = props => (
|
||||||
|
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
||||||
|
);
|
||||||
|
|
||||||
|
const date_format = {
|
||||||
|
year: "numeric",
|
||||||
|
month: "2-digit",
|
||||||
|
day: "2-digit",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
second: "2-digit",
|
||||||
|
};
|
||||||
|
|
||||||
|
const destinationRowStyle = (record, index) => ({
|
||||||
|
backgroundColor: record.retry_last_ts > 0 ? "#ffcccc" : "white",
|
||||||
|
});
|
||||||
|
|
||||||
|
const DestinationFilter = ({ ...props }) => {
|
||||||
|
return (
|
||||||
|
<Filter {...props}>
|
||||||
|
<SearchInput source="destination" alwaysOn />
|
||||||
|
</Filter>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DestinationList = props => {
|
||||||
|
return (
|
||||||
|
<List
|
||||||
|
{...props}
|
||||||
|
filters={<DestinationFilter />}
|
||||||
|
pagination={<DestinationPagination />}
|
||||||
|
sort={{ field: "destination", order: "ASC" }}
|
||||||
|
bulkActionButtons={false}
|
||||||
|
>
|
||||||
|
<Datagrid rowClick="show" rowStyle={destinationRowStyle}>
|
||||||
|
<TextField source="destination" />
|
||||||
|
<DateField source="failure_ts" showTime options={date_format} />
|
||||||
|
<DateField source="retry_last_ts" showTime options={date_format} />
|
||||||
|
<TextField source="retry_interval" />
|
||||||
|
<TextField source="last_successful_stream_ordering" />
|
||||||
|
</Datagrid>
|
||||||
|
</List>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DestinationShow = props => {
|
||||||
|
return (
|
||||||
|
<Show {...props}>
|
||||||
|
<SimpleShowLayout>
|
||||||
|
<TextField source="destination" />
|
||||||
|
<DateField source="failure_ts" showTime options={date_format} />
|
||||||
|
<DateField source="retry_last_ts" showTime options={date_format} />
|
||||||
|
<TextField source="retry_interval" />
|
||||||
|
<TextField source="last_successful_stream_ordering" />
|
||||||
|
</SimpleShowLayout>
|
||||||
|
</Show>
|
||||||
|
);
|
||||||
|
};
|
@ -354,6 +354,16 @@ const de = {
|
|||||||
send_failure: "Beim Entfernen ist ein Fehler aufgetreten.",
|
send_failure: "Beim Entfernen ist ein Fehler aufgetreten.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
destinations: {
|
||||||
|
name: "Föderation",
|
||||||
|
fields: {
|
||||||
|
destination: "Ziel",
|
||||||
|
failure_ts: "Fehlerzeitpunkt",
|
||||||
|
retry_last_ts: "Letzter Wiederholungsversuch",
|
||||||
|
retry_interval: "Wiederholungsintervall",
|
||||||
|
last_successful_stream_ordering: "letzte erfogreicher Stream",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
ra: {
|
ra: {
|
||||||
...germanMessages.ra,
|
...germanMessages.ra,
|
||||||
|
@ -350,6 +350,16 @@ const en = {
|
|||||||
send_failure: "An error has occurred.",
|
send_failure: "An error has occurred.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
destinations: {
|
||||||
|
name: "Federation",
|
||||||
|
fields: {
|
||||||
|
destination: "Destination",
|
||||||
|
failure_ts: "Failure timestamp",
|
||||||
|
retry_last_ts: "Last retry timestamp",
|
||||||
|
retry_interval: "Retry interval",
|
||||||
|
last_successful_stream_ordering: "Last successful stream",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
export default en;
|
export default en;
|
||||||
|
@ -275,6 +275,17 @@ const resourceMap = {
|
|||||||
method: "PUT",
|
method: "PUT",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
destinations: {
|
||||||
|
path: "/_synapse/admin/v1/federation/destinations",
|
||||||
|
map: dst => ({
|
||||||
|
...dst,
|
||||||
|
id: dst.destination,
|
||||||
|
}),
|
||||||
|
data: "destinations",
|
||||||
|
total: json => {
|
||||||
|
return json.total;
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function filterNullValues(key, value) {
|
function filterNullValues(key, value) {
|
||||||
@ -296,7 +307,8 @@ function getSearchOrder(order) {
|
|||||||
const dataProvider = {
|
const dataProvider = {
|
||||||
getList: (resource, params) => {
|
getList: (resource, params) => {
|
||||||
console.log("getList " + resource);
|
console.log("getList " + resource);
|
||||||
const { user_id, name, guests, deactivated, search_term } = params.filter;
|
const { user_id, name, guests, deactivated, search_term, destination } =
|
||||||
|
params.filter;
|
||||||
const { page, perPage } = params.pagination;
|
const { page, perPage } = params.pagination;
|
||||||
const { field, order } = params.sort;
|
const { field, order } = params.sort;
|
||||||
const from = (page - 1) * perPage;
|
const from = (page - 1) * perPage;
|
||||||
@ -306,6 +318,7 @@ const dataProvider = {
|
|||||||
user_id: user_id,
|
user_id: user_id,
|
||||||
search_term: search_term,
|
search_term: search_term,
|
||||||
name: name,
|
name: name,
|
||||||
|
destination: destination,
|
||||||
guests: guests,
|
guests: guests,
|
||||||
deactivated: deactivated,
|
deactivated: deactivated,
|
||||||
order_by: field,
|
order_by: field,
|
||||||
|
Loading…
Reference in New Issue
Block a user