Merge branch 'master' into room_membership

This commit is contained in:
Michael Albert 2021-02-11 20:41:18 +01:00 committed by GitHub
commit 021fdba9fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 91 additions and 3 deletions

View File

@ -53,6 +53,7 @@ const App = () => (
<Resource name="devices" />
<Resource name="room_members" />
<Resource name="joined_rooms" />
<Resource name="pushers" />
<Resource name="servernotices" />
</Admin>
);

View File

@ -4,6 +4,7 @@ import {
BooleanField,
BulkDeleteWithConfirmButton,
Datagrid,
DeleteButton,
Filter,
List,
Pagination,
@ -15,6 +16,7 @@ import {
Tab,
TabbedShowLayout,
TextField,
TopToolbar,
useTranslate,
} from "react-admin";
import get from "lodash/get";
@ -70,10 +72,26 @@ const RoomTitle = ({ record }) => {
);
};
const RoomShowActions = ({ basePath, data, resource }) => {
const translate = useTranslate();
return (
<TopToolbar>
<DeleteButton
basePath={basePath}
record={data}
resource={resource}
undoable={false}
confirmTitle={translate("synapseadmin.rooms.delete.title")}
confirmContent={translate("synapseadmin.rooms.delete.message")}
/>
</TopToolbar>
);
};
export const RoomShow = props => {
const translate = useTranslate();
return (
<Show {...props} title={<RoomTitle />}>
<Show {...props} actions={<RoomShowActions />} title={<RoomTitle />}>
<TabbedShowLayout>
<Tab label="synapseadmin.rooms.tabs.basic" icon={<ViewListIcon />}>
<TextField source="room_id" />

View File

@ -6,6 +6,7 @@ import DevicesIcon from "@material-ui/icons/Devices";
import GetAppIcon from "@material-ui/icons/GetApp";
import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent";
import ViewListIcon from "@material-ui/icons/ViewList";
import NotificationsIcon from "@material-ui/icons/Notifications";
import {
ArrayInput,
ArrayField,
@ -436,6 +437,29 @@ export const UserEdit = props => {
</Datagrid>
</ReferenceManyField>
</FormTab>
<FormTab
label={translate("resources.pushers.name", { smart_count: 2 })}
icon={<NotificationsIcon />}
path="pushers"
>
<ReferenceManyField
reference="pushers"
target="user_id"
addLabel={false}
>
<Datagrid style={{ width: "100%" }}>
<TextField source="kind" sortable={false} />
<TextField source="app_display_name" sortable={false} />
<TextField source="app_id" sortable={false} />
<TextField source="data.url" sortable={false} />
<TextField source="device_display_name" sortable={false} />
<TextField source="lang" sortable={false} />
<TextField source="profile_tag" sortable={false} />
<TextField source="pushkey" sortable={false} />
</Datagrid>
</ReferenceManyField>
</FormTab>
</TabbedForm>
</Edit>
);

View File

@ -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",

View File

@ -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",

View File

@ -87,7 +87,9 @@ const resourceMap = {
id: d.device_id,
}),
data: "devices",
total: json => json.devices.length,
total: json => {
return json.total;
},
reference: id => ({
endpoint: `/_synapse/admin/v2/users/${id}/devices`,
}),
@ -111,7 +113,22 @@ const resourceMap = {
endpoint: `/_synapse/admin/v1/rooms/${id}/members`,
}),
data: "members",
total: json => json.members.length,
total: json => {
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;
},
},
joined_rooms: {
map: jr => ({