diff --git a/README.md b/README.md index dbc4ded..26ddd69 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This project is built using [react-admin](https://marmelab.com/react-admin/). -It needs at least Synapse v1.41.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). 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 66a8a05..67a6b09 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -352,6 +352,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 51ba6ca..dfabda6 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -348,6 +348,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 5b11139..0200f9f 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,