mirror of
https://github.com/UA-Fediland/synapse-admin.git
synced 2024-11-08 15:54:51 +00:00
Add room detail view
Needs Synapse v1.14.0 or later Change-Id: I6e3956a1e02fad5ba2f847458cd184af6aaedef0
This commit is contained in:
parent
ac0657c428
commit
61938405e9
5 changed files with 180 additions and 8 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
This project is built using [react-admin](https://marmelab.com/react-admin/).
|
||||
|
||||
It needs at least Synapse v1.13.0 for all functions to work as expected!
|
||||
It needs at least Synapse v1.14.0 for all functions to work as expected!
|
||||
|
||||
## Step-By-Step install:
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import polyglotI18nProvider from "ra-i18n-polyglot";
|
|||
import authProvider from "./synapse/authProvider";
|
||||
import dataProvider from "./synapse/dataProvider";
|
||||
import { UserList, UserCreate, UserEdit } from "./components/users";
|
||||
import { RoomList } from "./components/rooms";
|
||||
import { RoomList, RoomShow } from "./components/rooms";
|
||||
import LoginPage from "./components/LoginPage";
|
||||
import UserIcon from "@material-ui/icons/Group";
|
||||
import { ViewListIcon as RoomIcon } from "@material-ui/icons/ViewList";
|
||||
|
@ -35,7 +35,7 @@ const App = () => (
|
|||
edit={UserEdit}
|
||||
icon={UserIcon}
|
||||
/>
|
||||
<Resource name="rooms" list={RoomList} icon={RoomIcon} />
|
||||
<Resource name="rooms" list={RoomList} show={RoomShow} icon={RoomIcon} />
|
||||
<Resource name="connections" />
|
||||
<Resource name="servernotices" />
|
||||
</Admin>
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
import React from "react";
|
||||
import {
|
||||
BooleanField,
|
||||
Datagrid,
|
||||
List,
|
||||
TextField,
|
||||
Pagination,
|
||||
BooleanField,
|
||||
SelectField,
|
||||
Show,
|
||||
Tab,
|
||||
TabbedShowLayout,
|
||||
TextField,
|
||||
useTranslate,
|
||||
} from "react-admin";
|
||||
import get from "lodash/get";
|
||||
import { Tooltip, Typography } from "@material-ui/core";
|
||||
import HttpsIcon from "@material-ui/icons/Https";
|
||||
import NoEncryptionIcon from "@material-ui/icons/NoEncryption";
|
||||
import PageviewIcon from "@material-ui/icons/Pageview";
|
||||
import ViewListIcon from "@material-ui/icons/ViewList";
|
||||
import VisibilityIcon from "@material-ui/icons/Visibility";
|
||||
|
||||
const RoomPagination = props => (
|
||||
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
||||
|
@ -48,7 +55,7 @@ export const RoomList = props => (
|
|||
pagination={<RoomPagination />}
|
||||
sort={{ field: "name", order: "ASC" }}
|
||||
>
|
||||
<Datagrid>
|
||||
<Datagrid rowClick="show">
|
||||
<EncryptionField
|
||||
source="is_encrypted"
|
||||
sortBy="encryption"
|
||||
|
@ -66,3 +73,103 @@ export const RoomList = props => (
|
|||
</Datagrid>
|
||||
</List>
|
||||
);
|
||||
|
||||
const RoomTitle = ({ record }) => {
|
||||
const translate = useTranslate();
|
||||
var name = ""
|
||||
if (record) {
|
||||
name = record.name !== "" ? record.name : record.id
|
||||
}
|
||||
|
||||
return (
|
||||
<span>
|
||||
{translate("resources.rooms.name", 1)} {name}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export const RoomShow = props => {
|
||||
const translate = useTranslate();
|
||||
return (
|
||||
<Show {...props} title={<RoomTitle />}>
|
||||
<TabbedShowLayout>
|
||||
<Tab label="synapseadmin.rooms.tabs.basic" icon={<ViewListIcon />}>
|
||||
<TextField source="room_id" />
|
||||
<TextField source="name" />
|
||||
<TextField source="canonical_alias" />
|
||||
<TextField source="creator" />
|
||||
</Tab>
|
||||
|
||||
<Tab
|
||||
label="synapseadmin.rooms.tabs.detail"
|
||||
icon={<PageviewIcon />}
|
||||
path="detail"
|
||||
>
|
||||
<TextField source="joined_members" />
|
||||
<TextField source="joined_local_members" />
|
||||
<TextField source="state_events" />
|
||||
<TextField source="version" />
|
||||
<TextField
|
||||
source="encryption"
|
||||
emptyText={translate("resources.rooms.enums.unencrypted")}
|
||||
/>
|
||||
</Tab>
|
||||
|
||||
<Tab
|
||||
label="synapseadmin.rooms.tabs.permission"
|
||||
icon={<VisibilityIcon />}
|
||||
path="permission"
|
||||
>
|
||||
<BooleanField source="federatable" />
|
||||
<BooleanField source="public" />
|
||||
<SelectField
|
||||
source="join_rules"
|
||||
choices={[
|
||||
{ id: "public", name: "resources.rooms.enums.join_rules.public" },
|
||||
{ id: "knock", name: "resources.rooms.enums.join_rules.knock" },
|
||||
{ id: "invite", name: "resources.rooms.enums.join_rules.invite" },
|
||||
{
|
||||
id: "private",
|
||||
name: "resources.rooms.enums.join_rules.private",
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<SelectField
|
||||
source="guest_access"
|
||||
choices={[
|
||||
{
|
||||
id: "can_join",
|
||||
name: "resources.rooms.enums.guest_access.can_join",
|
||||
},
|
||||
{
|
||||
id: "forbidden",
|
||||
name: "resources.rooms.enums.guest_access.forbidden",
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<SelectField
|
||||
source="history_visibility"
|
||||
choices={[
|
||||
{
|
||||
id: "invited",
|
||||
name: "resources.rooms.enums.history_visibility.invited",
|
||||
},
|
||||
{
|
||||
id: "joined",
|
||||
name: "resources.rooms.enums.history_visibility.joined",
|
||||
},
|
||||
{
|
||||
id: "shared",
|
||||
name: "resources.rooms.enums.history_visibility.shared",
|
||||
},
|
||||
{
|
||||
id: "world_readable",
|
||||
name: "resources.rooms.enums.history_visibility.world_readable",
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</Tab>
|
||||
</TabbedShowLayout>
|
||||
</Show>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -15,6 +15,15 @@ export default {
|
|||
invalid_user_id:
|
||||
"Muss eine vollständige Matrix Benutzer-ID sein, z.B. @benutzer_id:homeserver",
|
||||
},
|
||||
rooms: {
|
||||
details: "Raumdetails",
|
||||
tabs: {
|
||||
basic: "Allgemein",
|
||||
members: "Mitglieder",
|
||||
detail: "Details",
|
||||
permission: "Berechtigungen",
|
||||
},
|
||||
},
|
||||
},
|
||||
resources: {
|
||||
users: {
|
||||
|
@ -58,12 +67,36 @@ export default {
|
|||
name: "Name",
|
||||
canonical_alias: "Alias",
|
||||
joined_members: "Mitglieder",
|
||||
joined_local_members: "lokale Mitglieder",
|
||||
joined_local_members: "Lokale Mitglieder",
|
||||
state_events: "Ereignisse",
|
||||
version: "Version",
|
||||
is_encrypted: "Verschlüsselt",
|
||||
federatable: "Föderiert",
|
||||
encryption: "Verschlüsselungs-Algorithmus",
|
||||
federatable: "Föderierbar",
|
||||
public: "Öffentlich",
|
||||
creator: "Ersteller",
|
||||
join_rules: "Beitrittsregeln",
|
||||
guest_access: "Gastzugriff",
|
||||
history_visibility: "Historie-Sichtbarkeit",
|
||||
},
|
||||
enums: {
|
||||
join_rules: {
|
||||
public: "Öffentlich",
|
||||
knock: "Auf Anfrage",
|
||||
invite: "Nur auf Einladung",
|
||||
private: "Privat",
|
||||
},
|
||||
guest_access: {
|
||||
can_join: "Gäste können beitreten",
|
||||
forbidden: "Gäste können nicht beitreten",
|
||||
},
|
||||
history_visibility: {
|
||||
invited: "Ab Einladung",
|
||||
joined: "Ab Beitritt",
|
||||
shared: "Ab Setzen der Einstellung",
|
||||
world_readable: "Jeder",
|
||||
},
|
||||
unencrypted: "Nicht verschlüsselt",
|
||||
},
|
||||
},
|
||||
connections: {
|
||||
|
|
|
@ -14,6 +14,14 @@ export default {
|
|||
invalid_user_id:
|
||||
"Must be a fully qualified Matrix user-id, e.g. @user_id:homeserver",
|
||||
},
|
||||
rooms: {
|
||||
tabs: {
|
||||
basic: "Basic",
|
||||
members: "Members",
|
||||
detail: "Details",
|
||||
permission: "Permissions",
|
||||
},
|
||||
},
|
||||
},
|
||||
resources: {
|
||||
users: {
|
||||
|
@ -61,8 +69,32 @@ export default {
|
|||
state_events: "State events",
|
||||
version: "Version",
|
||||
is_encrypted: "Encrypted",
|
||||
encryption: "Encryption",
|
||||
federatable: "Federatable",
|
||||
public: "Public",
|
||||
creator: "Creator",
|
||||
join_rules: "Join rules",
|
||||
guest_access: "Guest access",
|
||||
history_visibility: "History visibility",
|
||||
},
|
||||
enums: {
|
||||
join_rules: {
|
||||
public: "Public",
|
||||
knock: "Knock",
|
||||
invite: "Invite",
|
||||
private: "Private",
|
||||
},
|
||||
guest_access: {
|
||||
can_join: "Guests can join",
|
||||
forbidden: "Guests can not join",
|
||||
},
|
||||
history_visibility: {
|
||||
invited: "Since invited",
|
||||
joined: "Since joined",
|
||||
shared: "Since shared",
|
||||
world_readable: "Anyone",
|
||||
},
|
||||
unencrypted: "Unencrypted",
|
||||
},
|
||||
},
|
||||
connections: {
|
||||
|
|
Loading…
Reference in a new issue