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