mirror of
https://github.com/UA-Fediland/synapse-admin.git
synced 2024-12-30 17:03:17 +00:00
Export resources as objects
Change-Id: I3c501369abf27fa21293c0434c56a00aaf8a64cd
This commit is contained in:
parent
af453eea71
commit
d520c6d618
8 changed files with 88 additions and 60 deletions
69
src/App.js
69
src/App.js
|
@ -8,26 +8,15 @@ import {
|
|||
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, RoomShow } from "./components/rooms";
|
||||
import { ReportList, ReportShow } from "./components/EventReports";
|
||||
import users from "./components/users";
|
||||
import rooms from "./components/rooms";
|
||||
import userMediaStats from "./components/statistics";
|
||||
import reports from "./components/EventReports";
|
||||
import roomDirectory from "./components/RoomDirectory";
|
||||
import destinations from "./components/destinations";
|
||||
import registrationToken from "./components/RegistrationTokens";
|
||||
import LoginPage from "./components/LoginPage";
|
||||
import ConfirmationNumberIcon from "@mui/icons-material/ConfirmationNumber";
|
||||
import CloudQueueIcon from "@mui/icons-material/CloudQueue";
|
||||
import EqualizerIcon from "@mui/icons-material/Equalizer";
|
||||
import UserIcon from "@mui/icons-material/Group";
|
||||
import { UserMediaStatsList } from "./components/statistics";
|
||||
import RoomIcon from "@mui/icons-material/ViewList";
|
||||
import ReportIcon from "@mui/icons-material/Warning";
|
||||
import FolderSharedIcon from "@mui/icons-material/FolderShared";
|
||||
import { DestinationList, DestinationShow } from "./components/destinations";
|
||||
import { ImportFeature } from "./components/ImportFeature";
|
||||
import {
|
||||
RegistrationTokenCreate,
|
||||
RegistrationTokenEdit,
|
||||
RegistrationTokenList,
|
||||
} from "./components/RegistrationTokens";
|
||||
import { RoomDirectoryList } from "./components/RoomDirectory";
|
||||
import { Route } from "react-router-dom";
|
||||
import germanMessages from "./i18n/de";
|
||||
import englishMessages from "./i18n/en";
|
||||
|
@ -59,43 +48,13 @@ const App = () => (
|
|||
<CustomRoutes>
|
||||
<Route path="/import_users" element={<ImportFeature />} />
|
||||
</CustomRoutes>
|
||||
<Resource
|
||||
name="users"
|
||||
list={UserList}
|
||||
create={UserCreate}
|
||||
edit={UserEdit}
|
||||
icon={UserIcon}
|
||||
/>
|
||||
<Resource name="rooms" list={RoomList} show={RoomShow} icon={RoomIcon} />
|
||||
<Resource
|
||||
name="user_media_statistics"
|
||||
list={UserMediaStatsList}
|
||||
icon={EqualizerIcon}
|
||||
/>
|
||||
<Resource
|
||||
name="reports"
|
||||
list={ReportList}
|
||||
show={ReportShow}
|
||||
icon={ReportIcon}
|
||||
/>
|
||||
<Resource
|
||||
name="room_directory"
|
||||
list={RoomDirectoryList}
|
||||
icon={FolderSharedIcon}
|
||||
/>
|
||||
<Resource
|
||||
name="destinations"
|
||||
list={DestinationList}
|
||||
show={DestinationShow}
|
||||
icon={CloudQueueIcon}
|
||||
/>
|
||||
<Resource
|
||||
name="registration_tokens"
|
||||
list={RegistrationTokenList}
|
||||
create={RegistrationTokenCreate}
|
||||
edit={RegistrationTokenEdit}
|
||||
icon={ConfirmationNumberIcon}
|
||||
/>
|
||||
<Resource {...users} />
|
||||
<Resource {...rooms} />
|
||||
<Resource {...userMediaStats} />
|
||||
<Resource {...reports} />
|
||||
<Resource {...roomDirectory} />
|
||||
<Resource {...destinations} />
|
||||
<Resource {...registrationToken} />
|
||||
<Resource name="connections" />
|
||||
<Resource name="devices" />
|
||||
<Resource name="room_members" />
|
||||
|
|
|
@ -13,6 +13,7 @@ import {
|
|||
useTranslate,
|
||||
} from "react-admin";
|
||||
import PageviewIcon from "@mui/icons-material/Pageview";
|
||||
import ReportIcon from "@mui/icons-material/Warning";
|
||||
import ViewListIcon from "@mui/icons-material/ViewList";
|
||||
|
||||
const date_format = {
|
||||
|
@ -118,3 +119,12 @@ export const ReportList = props => (
|
|||
</Datagrid>
|
||||
</List>
|
||||
);
|
||||
|
||||
const resource = {
|
||||
name: "reports",
|
||||
icon: ReportIcon,
|
||||
list: ReportList,
|
||||
show: ReportShow,
|
||||
};
|
||||
|
||||
export default resource;
|
||||
|
|
|
@ -17,6 +17,7 @@ import {
|
|||
TextField,
|
||||
Toolbar,
|
||||
} from "react-admin";
|
||||
import RegistrationTokenIcon from "@mui/icons-material/ConfirmationNumber";
|
||||
|
||||
const date_format = {
|
||||
year: "numeric",
|
||||
|
@ -121,3 +122,13 @@ export const RegistrationTokenEdit = props => (
|
|||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
|
||||
const resource = {
|
||||
name: "users",
|
||||
icon: RegistrationTokenIcon,
|
||||
list: RegistrationTokenList,
|
||||
edit: RegistrationTokenEdit,
|
||||
create: RegistrationTokenCreate,
|
||||
};
|
||||
|
||||
export default resource;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import React from "react";
|
||||
import FolderSharedIcon from "@mui/icons-material/FolderShared";
|
||||
import {
|
||||
BooleanField,
|
||||
BulkDeleteButton,
|
||||
|
@ -22,6 +21,7 @@ import {
|
|||
useUnselectAll,
|
||||
} from "react-admin";
|
||||
import { useMutation } from "react-query";
|
||||
import RoomDirectoryIcon from "@mui/icons-material/FolderShared";
|
||||
import AvatarField from "./AvatarField";
|
||||
|
||||
const RoomDirectoryPagination = props => (
|
||||
|
@ -44,7 +44,7 @@ export const RoomDirectoryDeleteButton = props => {
|
|||
smart_count: 1,
|
||||
})}
|
||||
resource="room_directory"
|
||||
icon={<FolderSharedIcon />}
|
||||
icon={<RoomDirectoryIcon />}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -57,7 +57,7 @@ export const RoomDirectoryBulkDeleteButton = props => (
|
|||
confirmTitle="resources.room_directory.action.title"
|
||||
confirmContent="resources.room_directory.action.content"
|
||||
resource="room_directory"
|
||||
icon={<FolderSharedIcon />}
|
||||
icon={<RoomDirectoryIcon />}
|
||||
/>
|
||||
);
|
||||
|
||||
|
@ -91,7 +91,7 @@ export const RoomDirectoryBulkSaveButton = () => {
|
|||
onClick={handleSend}
|
||||
disabled={isloading}
|
||||
>
|
||||
<FolderSharedIcon />
|
||||
<RoomDirectoryIcon />
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
@ -125,7 +125,7 @@ export const RoomDirectorySaveButton = () => {
|
|||
onClick={handleSend}
|
||||
disabled={isloading}
|
||||
>
|
||||
<FolderSharedIcon />
|
||||
<RoomDirectoryIcon />
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
@ -194,3 +194,11 @@ export const RoomDirectoryList = () => (
|
|||
</DatagridConfigurable>
|
||||
</List>
|
||||
);
|
||||
|
||||
const resource = {
|
||||
name: "room_directory",
|
||||
icon: RoomDirectoryIcon,
|
||||
list: RoomDirectoryList,
|
||||
};
|
||||
|
||||
export default resource;
|
||||
|
|
|
@ -20,6 +20,7 @@ import {
|
|||
useTranslate,
|
||||
} from "react-admin";
|
||||
import AutorenewIcon from "@mui/icons-material/Autorenew";
|
||||
import DestinationsIcon from "@mui/icons-material/CloudQueue";
|
||||
import FolderSharedIcon from "@mui/icons-material/FolderShared";
|
||||
import ViewListIcon from "@mui/icons-material/ViewList";
|
||||
|
||||
|
@ -177,3 +178,12 @@ export const DestinationShow = props => {
|
|||
</Show>
|
||||
);
|
||||
};
|
||||
|
||||
const resource = {
|
||||
name: "destinations",
|
||||
icon: DestinationsIcon,
|
||||
list: DestinationList,
|
||||
show: DestinationShow,
|
||||
};
|
||||
|
||||
export default resource;
|
||||
|
|
|
@ -34,6 +34,7 @@ import UserIcon from "@mui/icons-material/Group";
|
|||
import ViewListIcon from "@mui/icons-material/ViewList";
|
||||
import VisibilityIcon from "@mui/icons-material/Visibility";
|
||||
import EventIcon from "@mui/icons-material/Event";
|
||||
import RoomIcon from "@mui/icons-material/ViewList";
|
||||
import {
|
||||
RoomDirectoryBulkDeleteButton,
|
||||
RoomDirectoryBulkSaveButton,
|
||||
|
@ -346,3 +347,12 @@ export const RoomList = props => {
|
|||
</List>
|
||||
);
|
||||
};
|
||||
|
||||
const resource = {
|
||||
name: "rooms",
|
||||
icon: RoomIcon,
|
||||
list: RoomList,
|
||||
show: RoomShow,
|
||||
};
|
||||
|
||||
export default resource;
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
TopToolbar,
|
||||
useListContext,
|
||||
} from "react-admin";
|
||||
import EqualizerIcon from "@mui/icons-material/Equalizer";
|
||||
import { DeleteMediaButton } from "./media";
|
||||
|
||||
const ListActions = props => {
|
||||
|
@ -74,3 +75,11 @@ export const UserMediaStatsList = props => (
|
|||
</Datagrid>
|
||||
</List>
|
||||
);
|
||||
|
||||
const resource = {
|
||||
name: "user_media_statistics",
|
||||
icon: EqualizerIcon,
|
||||
list: UserMediaStatsList,
|
||||
};
|
||||
|
||||
export default resource;
|
||||
|
|
|
@ -7,6 +7,7 @@ import NotificationsIcon from "@mui/icons-material/Notifications";
|
|||
import PermMediaIcon from "@mui/icons-material/PermMedia";
|
||||
import PersonPinIcon from "@mui/icons-material/PersonPin";
|
||||
import SettingsInputComponentIcon from "@mui/icons-material/SettingsInputComponent";
|
||||
import UserIcon from "@mui/icons-material/Group";
|
||||
import ViewListIcon from "@mui/icons-material/ViewList";
|
||||
import {
|
||||
ArrayInput,
|
||||
|
@ -524,3 +525,13 @@ export const UserEdit = props => {
|
|||
</Edit>
|
||||
);
|
||||
};
|
||||
|
||||
const resource = {
|
||||
name: "users",
|
||||
icon: UserIcon,
|
||||
list: UserList,
|
||||
edit: UserEdit,
|
||||
create: UserCreate,
|
||||
};
|
||||
|
||||
export default resource;
|
||||
|
|
Loading…
Reference in a new issue