2020-01-27 16:57:27 +03:00
|
|
|
import React from "react";
|
2020-02-07 18:29:11 +03:00
|
|
|
import { Admin, Resource, resolveBrowserLocale } from "react-admin";
|
|
|
|
import polyglotI18nProvider from "ra-i18n-polyglot";
|
2020-02-07 18:35:21 +03:00
|
|
|
import authProvider from "./synapse/authProvider";
|
2020-02-07 18:10:43 +03:00
|
|
|
import dataProvider from "./synapse/dataProvider";
|
2020-02-07 19:44:48 +03:00
|
|
|
import { UserList, UserCreate, UserEdit } from "./components/users";
|
2020-07-07 22:28:20 +03:00
|
|
|
import { RoomList, RoomShow } from "./components/rooms";
|
2021-01-04 11:14:33 +03:00
|
|
|
import { ReportList, ReportShow } from "./components/EventReports";
|
2020-02-07 18:35:21 +03:00
|
|
|
import LoginPage from "./components/LoginPage";
|
2020-02-07 19:44:48 +03:00
|
|
|
import UserIcon from "@material-ui/icons/Group";
|
2021-02-11 23:14:02 +03:00
|
|
|
import EqualizerIcon from "@material-ui/icons/Equalizer";
|
|
|
|
import { UserMediaStatsList } from "./components/statistics";
|
2021-01-04 11:14:33 +03:00
|
|
|
import RoomIcon from "@material-ui/icons/ViewList";
|
|
|
|
import ReportIcon from "@material-ui/icons/Warning";
|
2021-05-04 14:52:43 +03:00
|
|
|
import FolderSharedIcon from "@material-ui/icons/FolderShared";
|
2020-09-22 12:30:27 +03:00
|
|
|
import { ImportFeature } from "./components/ImportFeature";
|
2021-05-04 14:52:43 +03:00
|
|
|
import { RoomDirectoryList } from "./components/RoomDirectory";
|
2020-09-22 12:30:27 +03:00
|
|
|
import { Route } from "react-router-dom";
|
2020-02-07 18:29:11 +03:00
|
|
|
import germanMessages from "./i18n/de";
|
|
|
|
import englishMessages from "./i18n/en";
|
2021-05-04 14:58:13 +03:00
|
|
|
import chineseMessages from "./i18n/zh";
|
2020-02-07 18:29:11 +03:00
|
|
|
|
|
|
|
// TODO: Can we use lazy loading together with browser locale?
|
|
|
|
const messages = {
|
|
|
|
de: germanMessages,
|
|
|
|
en: englishMessages,
|
2021-05-04 14:58:13 +03:00
|
|
|
zh: chineseMessages,
|
2020-02-07 18:29:11 +03:00
|
|
|
};
|
|
|
|
const i18nProvider = polyglotI18nProvider(
|
|
|
|
locale => (messages[locale] ? messages[locale] : messages.en),
|
|
|
|
resolveBrowserLocale()
|
|
|
|
);
|
2020-01-27 16:57:27 +03:00
|
|
|
|
|
|
|
const App = () => (
|
2020-02-07 18:35:21 +03:00
|
|
|
<Admin
|
2021-03-01 11:26:58 +03:00
|
|
|
disableTelemetry
|
2020-02-07 18:35:21 +03:00
|
|
|
loginPage={LoginPage}
|
|
|
|
authProvider={authProvider}
|
|
|
|
dataProvider={dataProvider}
|
|
|
|
i18nProvider={i18nProvider}
|
2020-09-22 12:30:27 +03:00
|
|
|
customRoutes={[
|
|
|
|
<Route key="userImport" path="/import_users" component={ImportFeature} />,
|
|
|
|
]}
|
2020-02-07 18:35:21 +03:00
|
|
|
>
|
2020-02-07 19:44:48 +03:00
|
|
|
<Resource
|
|
|
|
name="users"
|
|
|
|
list={UserList}
|
|
|
|
create={UserCreate}
|
|
|
|
edit={UserEdit}
|
|
|
|
icon={UserIcon}
|
|
|
|
/>
|
2020-07-07 22:28:20 +03:00
|
|
|
<Resource name="rooms" list={RoomList} show={RoomShow} icon={RoomIcon} />
|
2021-02-11 23:14:02 +03:00
|
|
|
<Resource
|
|
|
|
name="user_media_statistics"
|
|
|
|
list={UserMediaStatsList}
|
|
|
|
icon={EqualizerIcon}
|
|
|
|
/>
|
2021-01-04 11:14:33 +03:00
|
|
|
<Resource
|
|
|
|
name="reports"
|
|
|
|
list={ReportList}
|
|
|
|
show={ReportShow}
|
|
|
|
icon={ReportIcon}
|
|
|
|
/>
|
2021-05-04 14:52:43 +03:00
|
|
|
<Resource
|
|
|
|
name="room_directory"
|
|
|
|
list={RoomDirectoryList}
|
|
|
|
icon={FolderSharedIcon}
|
|
|
|
/>
|
2020-03-28 23:25:34 +03:00
|
|
|
<Resource name="connections" />
|
2020-07-08 11:58:57 +03:00
|
|
|
<Resource name="devices" />
|
2020-08-06 22:43:19 +03:00
|
|
|
<Resource name="room_members" />
|
2021-02-11 23:11:34 +03:00
|
|
|
<Resource name="users_media" />
|
2021-02-11 22:45:02 +03:00
|
|
|
<Resource name="joined_rooms" />
|
2021-02-11 22:37:20 +03:00
|
|
|
<Resource name="pushers" />
|
2020-04-23 11:00:46 +03:00
|
|
|
<Resource name="servernotices" />
|
2021-05-04 14:57:41 +03:00
|
|
|
<Resource name="room_state" />
|
2020-01-27 16:57:27 +03:00
|
|
|
</Admin>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default App;
|