diff --git a/README.md b/README.md index fee460b..d86369c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,8 @@ -[![Build Status](https://travis-ci.org/Awesome-Technologies/synapse-admin.svg?branch=master)](https://travis-ci.org/Awesome-Technologies/synapse-admin) -[![build-test](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/build-test.yml/badge.svg)](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/build-test.yml) - # Synapse admin ui 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`. 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 -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 -- 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` - download dependencies: `yarn install` - 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 [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](./screenshots.jpg) diff --git a/src/App.js b/src/App.js index 018f18c..773291a 100644 --- a/src/App.js +++ b/src/App.js @@ -7,12 +7,14 @@ import { UserList, UserCreate, UserEdit } from "./components/users"; import { RoomList, RoomShow } from "./components/rooms"; import { ReportList, ReportShow } from "./components/EventReports"; 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 UserIcon from "@material-ui/icons/Group"; import { UserMediaStatsList } from "./components/statistics"; import RoomIcon from "@material-ui/icons/ViewList"; import ReportIcon from "@material-ui/icons/Warning"; import FolderSharedIcon from "@material-ui/icons/FolderShared"; +import { DestinationList, DestinationShow } from "./components/destinations"; import { ImportFeature } from "./components/ImportFeature"; import { RoomDirectoryList } from "./components/RoomDirectory"; import { Route } from "react-router-dom"; @@ -66,6 +68,12 @@ const App = () => ( list={RoomDirectoryList} icon={FolderSharedIcon} /> + diff --git a/src/components/destinations.js b/src/components/destinations.js new file mode 100644 index 0000000..ec926b9 --- /dev/null +++ b/src/components/destinations.js @@ -0,0 +1,71 @@ +import React from "react"; +import { + Datagrid, + DateField, + Filter, + List, + Pagination, + SearchInput, + SimpleShowLayout, + Show, + TextField, +} from "react-admin"; + +const DestinationPagination = props => ( + +); + +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 ( + + + + ); +}; + +export const DestinationList = props => { + return ( + } + pagination={} + sort={{ field: "destination", order: "ASC" }} + bulkActionButtons={false} + > + + + + + + + + + ); +}; + +export const DestinationShow = props => { + return ( + + + + + + + + + + ); +}; diff --git a/src/i18n/de.js b/src/i18n/de.js index fe61abe..484a098 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -354,6 +354,16 @@ const de = { 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: { ...germanMessages.ra, diff --git a/src/i18n/en.js b/src/i18n/en.js index 25c13be..d57bce4 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -350,6 +350,16 @@ const en = { 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; diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 136a1dc..90de141 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -275,6 +275,17 @@ const resourceMap = { 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) { @@ -296,7 +307,8 @@ function getSearchOrder(order) { const dataProvider = { getList: (resource, params) => { 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 { field, order } = params.sort; const from = (page - 1) * perPage; @@ -306,6 +318,7 @@ const dataProvider = { user_id: user_id, search_term: search_term, name: name, + destination: destination, guests: guests, deactivated: deactivated, order_by: field,