From f2a12756733964da59069a1cd9a63b3f1e1a4407 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Thu, 11 Feb 2021 20:37:20 +0100 Subject: [PATCH] Add a new tab to user page with pushers (#85) * Add a new tab to user page with pushers * Update pushers `total` and `id` --- src/App.js | 1 + src/components/users.js | 27 +++++++++++++++++++++++++++ src/i18n/de.js | 14 ++++++++++++++ src/i18n/en.js | 14 ++++++++++++++ src/synapse/dataProvider.js | 13 +++++++++++++ 5 files changed, 69 insertions(+) diff --git a/src/App.js b/src/App.js index 5b784c4..e9378b8 100644 --- a/src/App.js +++ b/src/App.js @@ -52,6 +52,7 @@ const App = () => ( + ); diff --git a/src/components/users.js b/src/components/users.js index 5f8caf8..d463379 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -5,6 +5,7 @@ import ContactMailIcon from "@material-ui/icons/ContactMail"; import DevicesIcon from "@material-ui/icons/Devices"; import GetAppIcon from "@material-ui/icons/GetApp"; import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent"; +import NotificationsIcon from "@material-ui/icons/Notifications"; import { ArrayInput, ArrayField, @@ -312,6 +313,7 @@ export const UserEdit = props => { /> + } @@ -330,6 +332,7 @@ export const UserEdit = props => { + } @@ -361,6 +364,7 @@ export const UserEdit = props => { + } @@ -400,6 +404,29 @@ export const UserEdit = props => { + + } + path="pushers" + > + + + + + + + + + + + + + ); diff --git a/src/i18n/de.js b/src/i18n/de.js index 1b60545..a881b1d 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -223,6 +223,20 @@ export default { }, }, }, + pushers: { + name: "Pusher |||| Pushers", + fields: { + app: "App", + app_display_name: "App-Anzeigename", + app_id: "App ID", + device_display_name: "Geräte-Anzeigename", + kind: "Art", + lang: "Sprache", + profile_tag: "Profil-Tag", + pushkey: "Pushkey", + data: { url: "URL" }, + }, + }, servernotices: { name: "Serverbenachrichtigungen", send: "Servernachricht versenden", diff --git a/src/i18n/en.js b/src/i18n/en.js index 76b33aa..87d70be 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -220,6 +220,20 @@ export default { }, }, }, + pushers: { + name: "Pusher |||| Pushers", + fields: { + app: "App", + app_display_name: "App display name", + app_id: "App ID", + device_display_name: "Device display name", + kind: "Kind", + lang: "Language", + profile_tag: "Profile tag", + pushkey: "Pushkey", + data: { url: "URL" }, + }, + }, servernotices: { name: "Server Notices", send: "Send server notices", diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 3df3c9d..815d5dd 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -117,6 +117,19 @@ const resourceMap = { return json.total; }, }, + pushers: { + map: p => ({ + ...p, + id: p.pushkey, + }), + reference: id => ({ + endpoint: `/_synapse/admin/v1/users/${id}/pushers`, + }), + data: "pushers", + total: json => { + return json.total; + }, + }, servernotices: { map: n => ({ id: n.event_id }), create: data => ({