remove props
This commit is contained in:
parent
2e25a918c5
commit
ac8ec6e021
@ -28,10 +28,10 @@ const ReportPagination = props => (
|
|||||||
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
||||||
);
|
);
|
||||||
|
|
||||||
export const ReportShow = props => {
|
export const ReportShow = () => {
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
return (
|
return (
|
||||||
<Show {...props}>
|
<Show>
|
||||||
<TabbedShowLayout>
|
<TabbedShowLayout>
|
||||||
<Tab
|
<Tab
|
||||||
label={translate("synapseadmin.reports.tabs.basic", {
|
label={translate("synapseadmin.reports.tabs.basic", {
|
||||||
@ -97,26 +97,23 @@ export const ReportShow = props => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ReportList = ({ ...props }) => {
|
export const ReportList = () => (
|
||||||
return (
|
<List
|
||||||
<List
|
pagination={<ReportPagination />}
|
||||||
{...props}
|
sort={{ field: "received_ts", order: "DESC" }}
|
||||||
pagination={<ReportPagination />}
|
bulkActionButtons={false}
|
||||||
sort={{ field: "received_ts", order: "DESC" }}
|
>
|
||||||
bulkActionButtons={false}
|
<Datagrid rowClick="show">
|
||||||
>
|
<TextField source="id" sortable={false} />
|
||||||
<Datagrid rowClick="show">
|
<DateField
|
||||||
<TextField source="id" sortable={false} />
|
source="received_ts"
|
||||||
<DateField
|
showTime
|
||||||
source="received_ts"
|
options={date_format}
|
||||||
showTime
|
sortable={true}
|
||||||
options={date_format}
|
/>
|
||||||
sortable={true}
|
<TextField sortable={false} source="user_id" />
|
||||||
/>
|
<TextField sortable={false} source="name" />
|
||||||
<TextField sortable={false} source="user_id" />
|
<TextField sortable={false} source="score" />
|
||||||
<TextField sortable={false} source="name" />
|
</Datagrid>
|
||||||
<TextField sortable={false} source="score" />
|
</List>
|
||||||
</Datagrid>
|
);
|
||||||
</List>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
// in src/Menu.js
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { useMediaQuery } from "@mui/material";
|
import { useMediaQuery } from "@mui/material";
|
||||||
import {
|
import {
|
||||||
|
@ -59,33 +59,30 @@ const RegistrationTokenFilter = props => (
|
|||||||
</Filter>
|
</Filter>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const RegistrationTokenList = props => {
|
export const RegistrationTokenList = () => (
|
||||||
return (
|
<List
|
||||||
<List
|
filters={<RegistrationTokenFilter />}
|
||||||
{...props}
|
filterDefaultValues={{ valid: true }}
|
||||||
filters={<RegistrationTokenFilter />}
|
pagination={false}
|
||||||
filterDefaultValues={{ valid: true }}
|
perPage={500}
|
||||||
pagination={false}
|
>
|
||||||
perPage={500}
|
<Datagrid rowClick="edit">
|
||||||
>
|
<TextField source="token" sortable={false} />
|
||||||
<Datagrid rowClick="edit">
|
<NumberField source="uses_allowed" sortable={false} />
|
||||||
<TextField source="token" sortable={false} />
|
<NumberField source="pending" sortable={false} />
|
||||||
<NumberField source="uses_allowed" sortable={false} />
|
<NumberField source="completed" sortable={false} />
|
||||||
<NumberField source="pending" sortable={false} />
|
<DateField
|
||||||
<NumberField source="completed" sortable={false} />
|
source="expiry_time"
|
||||||
<DateField
|
showTime
|
||||||
source="expiry_time"
|
options={date_format}
|
||||||
showTime
|
sortable={false}
|
||||||
options={date_format}
|
/>
|
||||||
sortable={false}
|
</Datagrid>
|
||||||
/>
|
</List>
|
||||||
</Datagrid>
|
);
|
||||||
</List>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const RegistrationTokenCreate = props => (
|
export const RegistrationTokenCreate = () => (
|
||||||
<Create {...props}>
|
<Create>
|
||||||
<SimpleForm redirect="list" toolbar={<Toolbar alwaysEnableSaveButton />}>
|
<SimpleForm redirect="list" toolbar={<Toolbar alwaysEnableSaveButton />}>
|
||||||
<TextInput
|
<TextInput
|
||||||
source="token"
|
source="token"
|
||||||
@ -109,24 +106,22 @@ export const RegistrationTokenCreate = props => (
|
|||||||
</Create>
|
</Create>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const RegistrationTokenEdit = props => {
|
export const RegistrationTokenEdit = () => (
|
||||||
return (
|
<Edit>
|
||||||
<Edit {...props}>
|
<SimpleForm>
|
||||||
<SimpleForm>
|
<TextInput source="token" disabled />
|
||||||
<TextInput source="token" disabled />
|
<NumberInput source="pending" disabled />
|
||||||
<NumberInput source="pending" disabled />
|
<NumberInput source="completed" disabled />
|
||||||
<NumberInput source="completed" disabled />
|
<NumberInput
|
||||||
<NumberInput
|
source="uses_allowed"
|
||||||
source="uses_allowed"
|
validate={validateUsesAllowed}
|
||||||
validate={validateUsesAllowed}
|
step={1}
|
||||||
step={1}
|
/>
|
||||||
/>
|
<DateTimeInput
|
||||||
<DateTimeInput
|
source="expiry_time"
|
||||||
source="expiry_time"
|
parse={dateParser}
|
||||||
parse={dateParser}
|
format={dateFormatter}
|
||||||
format={dateFormatter}
|
/>
|
||||||
/>
|
</SimpleForm>
|
||||||
</SimpleForm>
|
</Edit>
|
||||||
</Edit>
|
);
|
||||||
);
|
|
||||||
};
|
|
||||||
|
@ -28,12 +28,11 @@ const RoomDirectoryPagination = props => (
|
|||||||
<Pagination {...props} rowsPerPageOptions={[100, 500, 1000, 2000]} />
|
<Pagination {...props} rowsPerPageOptions={[100, 500, 1000, 2000]} />
|
||||||
);
|
);
|
||||||
|
|
||||||
export const RoomDirectoryDeleteButton = props => {
|
export const RoomDirectoryDeleteButton = () => {
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DeleteButton
|
<DeleteButton
|
||||||
{...props}
|
|
||||||
label="resources.room_directory.action.erase"
|
label="resources.room_directory.action.erase"
|
||||||
redirect={false}
|
redirect={false}
|
||||||
mutationMode="pessimistic"
|
mutationMode="pessimistic"
|
||||||
@ -49,9 +48,8 @@ export const RoomDirectoryDeleteButton = props => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RoomDirectoryBulkDeleteButton = props => (
|
export const RoomDirectoryBulkDeleteButton = () => (
|
||||||
<BulkDeleteButton
|
<BulkDeleteButton
|
||||||
{...props}
|
|
||||||
label="resources.room_directory.action.erase"
|
label="resources.room_directory.action.erase"
|
||||||
mutationMode="pessimistic"
|
mutationMode="pessimistic"
|
||||||
confirmTitle="resources.room_directory.action.title"
|
confirmTitle="resources.room_directory.action.title"
|
||||||
@ -100,13 +98,12 @@ export const RoomDirectorySaveButton = () => {
|
|||||||
const record = useRecordContext();
|
const record = useRecordContext();
|
||||||
const notify = useNotify();
|
const notify = useNotify();
|
||||||
const refresh = useRefresh();
|
const refresh = useRefresh();
|
||||||
const [create, { isloading }] = useCreate("room_directory");
|
const [create, { isloading }] = useCreate();
|
||||||
|
|
||||||
const handleSend = values => {
|
const handleSend = values => {
|
||||||
create(
|
create(
|
||||||
{
|
"room_directory",
|
||||||
payload: { data: { id: record.id } },
|
{ data: { id: record.id } },
|
||||||
},
|
|
||||||
{
|
{
|
||||||
onSuccess: data => {
|
onSuccess: data => {
|
||||||
notify("resources.room_directory.action.send_success");
|
notify("resources.room_directory.action.send_success");
|
||||||
@ -137,9 +134,10 @@ const RoomDirectoryBulkActionButtons = () => (
|
|||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
|
||||||
const AvatarField = ({ source, className, record = {} }) => (
|
const AvatarField = ({ source, sx }) => {
|
||||||
<Avatar src={record[source]} className={className} />
|
const record = useRecordContext();
|
||||||
);
|
return <Avatar src={record[source]} sx={sx} />;
|
||||||
|
};
|
||||||
|
|
||||||
const RoomDirectoryListActions = () => (
|
const RoomDirectoryListActions = () => (
|
||||||
<TopToolbar>
|
<TopToolbar>
|
||||||
|
@ -128,14 +128,10 @@ export const DestinationList = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DestinationShow = props => {
|
export const DestinationShow = () => {
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
return (
|
return (
|
||||||
<Show
|
<Show actions={<DestinationShowActions />} title={<DestinationTitle />}>
|
||||||
actions={<DestinationShowActions />}
|
|
||||||
title={<DestinationTitle />}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
<TabbedShowLayout>
|
<TabbedShowLayout>
|
||||||
<Tab label="status" icon={<ViewListIcon />}>
|
<Tab label="status" icon={<ViewListIcon />}>
|
||||||
<TextField source="destination" />
|
<TextField source="destination" />
|
||||||
|
@ -55,7 +55,7 @@ const RoomPagination = props => (
|
|||||||
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
||||||
);
|
);
|
||||||
|
|
||||||
const RoomTitle = props => {
|
const RoomTitle = () => {
|
||||||
const record = useRecordContext();
|
const record = useRecordContext();
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
var name = "";
|
var name = "";
|
||||||
@ -70,23 +70,23 @@ const RoomTitle = props => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const RoomShowActions = ({ data, resource }) => {
|
const RoomShowActions = () => {
|
||||||
|
const record = useRecordContext();
|
||||||
var roomDirectoryStatus = "";
|
var roomDirectoryStatus = "";
|
||||||
if (data) {
|
if (record) {
|
||||||
roomDirectoryStatus = data.public;
|
roomDirectoryStatus = record.public;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TopToolbar>
|
<TopToolbar>
|
||||||
{roomDirectoryStatus === false && (
|
{roomDirectoryStatus === false && (
|
||||||
<RoomDirectorySaveButton record={data} />
|
<RoomDirectorySaveButton record={record} />
|
||||||
)}
|
)}
|
||||||
{roomDirectoryStatus === true && (
|
{roomDirectoryStatus === true && (
|
||||||
<RoomDirectoryDeleteButton record={data} />
|
<RoomDirectoryDeleteButton record={record} />
|
||||||
)}
|
)}
|
||||||
<DeleteButton
|
<DeleteButton
|
||||||
record={data}
|
record={record}
|
||||||
resource={resource}
|
|
||||||
mutationMode="pessimistic"
|
mutationMode="pessimistic"
|
||||||
confirmTitle="resources.rooms.action.erase.title"
|
confirmTitle="resources.rooms.action.erase.title"
|
||||||
confirmContent="resources.rooms.action.erase.content"
|
confirmContent="resources.rooms.action.erase.content"
|
||||||
@ -95,10 +95,10 @@ const RoomShowActions = ({ data, resource }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RoomShow = props => {
|
export const RoomShow = () => {
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
return (
|
return (
|
||||||
<Show {...props} actions={<RoomShowActions />} title={<RoomTitle />}>
|
<Show actions={<RoomShowActions />} title={<RoomTitle />}>
|
||||||
<TabbedShowLayout>
|
<TabbedShowLayout>
|
||||||
<Tab label="synapseadmin.rooms.tabs.basic" icon={<ViewListIcon />}>
|
<Tab label="synapseadmin.rooms.tabs.basic" icon={<ViewListIcon />}>
|
||||||
<TextField source="room_id" />
|
<TextField source="room_id" />
|
||||||
@ -348,7 +348,6 @@ export const RoomList = () => {
|
|||||||
[`& [data-testid="false"]`]: { color: theme.palette.error.main },
|
[`& [data-testid="false"]`]: { color: theme.palette.error.main },
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RoomNameField source="name" />
|
<RoomNameField source="name" />
|
||||||
<TextField source="joined_members" />
|
<TextField source="joined_members" />
|
||||||
<TextField source="joined_local_members" />
|
<TextField source="joined_local_members" />
|
||||||
|
@ -57,27 +57,24 @@ const UserMediaStatsFilter = props => (
|
|||||||
</Filter>
|
</Filter>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const UserMediaStatsList = props => {
|
export const UserMediaStatsList = () => (
|
||||||
return (
|
<List
|
||||||
<List
|
actions={<ListActions />}
|
||||||
{...props}
|
filters={<UserMediaStatsFilter />}
|
||||||
actions={<ListActions />}
|
pagination={<UserMediaStatsPagination />}
|
||||||
filters={<UserMediaStatsFilter />}
|
sort={{ field: "media_length", order: "DESC" }}
|
||||||
pagination={<UserMediaStatsPagination />}
|
>
|
||||||
sort={{ field: "media_length", order: "DESC" }}
|
<Datagrid
|
||||||
|
rowClick={(id, resource, record) => "/users/" + id + "/media"}
|
||||||
|
bulkActionButtons={false}
|
||||||
>
|
>
|
||||||
<Datagrid
|
<TextField source="user_id" label="resources.users.fields.id" />
|
||||||
rowClick={(id, resource, record) => "/users/" + id + "/media"}
|
<TextField
|
||||||
bulkActionButtons={false}
|
source="displayname"
|
||||||
>
|
label="resources.users.fields.displayname"
|
||||||
<TextField source="user_id" label="resources.users.fields.id" />
|
/>
|
||||||
<TextField
|
<NumberField source="media_count" />
|
||||||
source="displayname"
|
<NumberField source="media_length" />
|
||||||
label="resources.users.fields.displayname"
|
</Datagrid>
|
||||||
/>
|
</List>
|
||||||
<NumberField source="media_count" />
|
);
|
||||||
<NumberField source="media_length" />
|
|
||||||
</Datagrid>
|
|
||||||
</List>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
@ -148,42 +148,40 @@ const UserBulkActionButtons = () => (
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
const AvatarField = ({ source, record = {}, sx }) => (
|
const AvatarField = ({ source, sx }) => {
|
||||||
<Avatar src={record[source]} sx={sx} />
|
const record = useRecordContext();
|
||||||
);
|
return <Avatar src={record[source]} sx={sx} />;
|
||||||
|
|
||||||
export const UserList = props => {
|
|
||||||
return (
|
|
||||||
<List
|
|
||||||
{...props}
|
|
||||||
filters={<UserFilter />}
|
|
||||||
filterDefaultValues={{ guests: true, deactivated: false }}
|
|
||||||
sort={{ field: "name", order: "ASC" }}
|
|
||||||
actions={<UserListActions maxResults={10000} />}
|
|
||||||
pagination={<UserPagination />}
|
|
||||||
>
|
|
||||||
<Datagrid rowClick="edit" bulkActionButtons={<UserBulkActionButtons />}>
|
|
||||||
<AvatarField
|
|
||||||
source="avatar_src"
|
|
||||||
sx={{ height: "40px", width: "40px" }}
|
|
||||||
sortBy="avatar_url"
|
|
||||||
/>
|
|
||||||
<TextField source="id" sortBy="name" />
|
|
||||||
<TextField source="displayname" />
|
|
||||||
<BooleanField source="is_guest" />
|
|
||||||
<BooleanField source="admin" />
|
|
||||||
<BooleanField source="deactivated" />
|
|
||||||
<DateField
|
|
||||||
source="creation_ts"
|
|
||||||
label="resources.users.fields.creation_ts_ms"
|
|
||||||
showTime
|
|
||||||
options={date_format}
|
|
||||||
/>
|
|
||||||
</Datagrid>
|
|
||||||
</List>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const UserList = () => (
|
||||||
|
<List
|
||||||
|
filters={<UserFilter />}
|
||||||
|
filterDefaultValues={{ guests: true, deactivated: false }}
|
||||||
|
sort={{ field: "name", order: "ASC" }}
|
||||||
|
actions={<UserListActions maxResults={10000} />}
|
||||||
|
pagination={<UserPagination />}
|
||||||
|
>
|
||||||
|
<Datagrid rowClick="edit" bulkActionButtons={<UserBulkActionButtons />}>
|
||||||
|
<AvatarField
|
||||||
|
source="avatar_src"
|
||||||
|
sx={{ height: "40px", width: "40px" }}
|
||||||
|
sortBy="avatar_url"
|
||||||
|
/>
|
||||||
|
<TextField source="id" sortBy="name" />
|
||||||
|
<TextField source="displayname" />
|
||||||
|
<BooleanField source="is_guest" />
|
||||||
|
<BooleanField source="admin" />
|
||||||
|
<BooleanField source="deactivated" />
|
||||||
|
<DateField
|
||||||
|
source="creation_ts"
|
||||||
|
label="resources.users.fields.creation_ts_ms"
|
||||||
|
showTime
|
||||||
|
options={date_format}
|
||||||
|
/>
|
||||||
|
</Datagrid>
|
||||||
|
</List>
|
||||||
|
);
|
||||||
|
|
||||||
// https://matrix.org/docs/spec/appendices#user-identifiers
|
// https://matrix.org/docs/spec/appendices#user-identifiers
|
||||||
// here only local part of user_id
|
// here only local part of user_id
|
||||||
// maxLength = 255 - "@" - ":" - localStorage.getItem("home_server").length
|
// maxLength = 255 - "@" - ":" - localStorage.getItem("home_server").length
|
||||||
@ -265,8 +263,8 @@ const UserEditActions = ({ data }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UserCreate = props => (
|
export const UserCreate = () => (
|
||||||
<Create {...props}>
|
<Create>
|
||||||
<SimpleForm>
|
<SimpleForm>
|
||||||
<TextInput source="id" autoComplete="off" validate={validateUser} />
|
<TextInput source="id" autoComplete="off" validate={validateUser} />
|
||||||
<TextInput source="displayname" validate={maxLength(256)} />
|
<TextInput source="displayname" validate={maxLength(256)} />
|
||||||
@ -306,7 +304,7 @@ export const UserCreate = props => (
|
|||||||
</Create>
|
</Create>
|
||||||
);
|
);
|
||||||
|
|
||||||
const UserTitle = props => {
|
const UserTitle = () => {
|
||||||
const record = useRecordContext();
|
const record = useRecordContext();
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
return (
|
return (
|
||||||
@ -319,10 +317,10 @@ const UserTitle = props => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UserEdit = props => {
|
export const UserEdit = () => {
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
return (
|
return (
|
||||||
<Edit {...props} title={<UserTitle />} actions={<UserEditActions />}>
|
<Edit title={<UserTitle />} actions={<UserEditActions />}>
|
||||||
<TabbedForm toolbar={<UserEditToolbar />}>
|
<TabbedForm toolbar={<UserEditToolbar />}>
|
||||||
<FormTab
|
<FormTab
|
||||||
label={translate("resources.users.name", { smart_count: 1 })}
|
label={translate("resources.users.name", { smart_count: 1 })}
|
||||||
|
Loading…
Reference in New Issue
Block a user