mirror of
https://github.com/Awesome-Technologies/synapse-admin.git
synced 2024-10-31 06:55:15 +03:00
Remove/mark unused parameters
All top level components should pass props to the generic react-admin component to be more versatile. Change-Id: I25dd099cde1aefacbc748dc4716a8b0a3db9ab93
This commit is contained in:
parent
78d1d34a84
commit
af453eea71
10 changed files with 142 additions and 147 deletions
|
@ -98,26 +98,23 @@ export const ReportShow = props => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ReportList = ({ ...props }) => {
|
export const ReportList = props => (
|
||||||
return (
|
<List
|
||||||
<List
|
{...props}
|
||||||
{...props}
|
pagination={<ReportPagination />}
|
||||||
pagination={<ReportPagination />}
|
sort={{ field: "received_ts", order: "DESC" }}
|
||||||
sort={{ field: "received_ts", order: "DESC" }}
|
>
|
||||||
bulkActionButtons={false}
|
<Datagrid rowClick="show" bulkActionButtons={false}>
|
||||||
>
|
<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>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ function TranslatableOption({ value, text }) {
|
||||||
return <option value={value}>{translate(text)}</option>;
|
return <option value={value}>{translate(text)}</option>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FilePicker = props => {
|
const FilePicker = () => {
|
||||||
const [values, setValues] = useState(null);
|
const [values, setValues] = useState(null);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const [stats, setStats] = useState(null);
|
const [stats, setStats] = useState(null);
|
||||||
|
@ -191,7 +191,7 @@ const FilePicker = props => {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const runImport = async e => {
|
const runImport = async _e => {
|
||||||
if (progress !== null) {
|
if (progress !== null) {
|
||||||
notify("import_users.errors.already_in_progress");
|
notify("import_users.errors.already_in_progress");
|
||||||
return;
|
return;
|
||||||
|
@ -307,7 +307,7 @@ const FilePicker = props => {
|
||||||
let retries = 0;
|
let retries = 0;
|
||||||
const submitRecord = recordData => {
|
const submitRecord = recordData => {
|
||||||
return dataProvider.getOne("users", { id: recordData.id }).then(
|
return dataProvider.getOne("users", { id: recordData.id }).then(
|
||||||
async alreadyExists => {
|
async _alreadyExists => {
|
||||||
if (LOGGING) console.log("already existed");
|
if (LOGGING) console.log("already existed");
|
||||||
|
|
||||||
if (useridMode === "update" || conflictMode === "skip") {
|
if (useridMode === "update" || conflictMode === "skip") {
|
||||||
|
@ -332,7 +332,7 @@ const FilePicker = props => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async okToSubmit => {
|
async _okToSubmit => {
|
||||||
if (LOGGING)
|
if (LOGGING)
|
||||||
console.log(
|
console.log(
|
||||||
"OK to create record " +
|
"OK to create record " +
|
||||||
|
|
|
@ -54,30 +54,28 @@ const dateFormatter = v => {
|
||||||
|
|
||||||
const registrationTokenFilters = [<BooleanInput source="valid" alwaysOn />];
|
const registrationTokenFilters = [<BooleanInput source="valid" alwaysOn />];
|
||||||
|
|
||||||
export const RegistrationTokenList = props => {
|
export const RegistrationTokenList = props => (
|
||||||
return (
|
<List
|
||||||
<List
|
{...props}
|
||||||
{...props}
|
filters={registrationTokenFilters}
|
||||||
filters={registrationTokenFilters}
|
filterDefaultValues={{ valid: true }}
|
||||||
filterDefaultValues={{ valid: true }}
|
pagination={false}
|
||||||
pagination={false}
|
perPage={500}
|
||||||
perPage={500}
|
>
|
||||||
>
|
<Datagrid rowClick="edit">
|
||||||
<Datagrid rowClick="edit">
|
<TextField source="token" sortable={false} />
|
||||||
<TextField source="token" sortable={false} />
|
<NumberField source="uses_allowed" sortable={false} />
|
||||||
<NumberField source="uses_allowed" sortable={false} />
|
<NumberField source="pending" sortable={false} />
|
||||||
<NumberField source="pending" sortable={false} />
|
<NumberField source="completed" sortable={false} />
|
||||||
<NumberField source="completed" sortable={false} />
|
<DateField
|
||||||
<DateField
|
source="expiry_time"
|
||||||
source="expiry_time"
|
showTime
|
||||||
showTime
|
options={date_format}
|
||||||
options={date_format}
|
sortable={false}
|
||||||
sortable={false}
|
/>
|
||||||
/>
|
</Datagrid>
|
||||||
</Datagrid>
|
</List>
|
||||||
</List>
|
);
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const RegistrationTokenCreate = props => (
|
export const RegistrationTokenCreate = props => (
|
||||||
<Create {...props}>
|
<Create {...props}>
|
||||||
|
@ -104,24 +102,22 @@ export const RegistrationTokenCreate = props => (
|
||||||
</Create>
|
</Create>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const RegistrationTokenEdit = props => {
|
export const RegistrationTokenEdit = props => (
|
||||||
return (
|
<Edit {...props}>
|
||||||
<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>
|
);
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
|
@ -102,16 +102,16 @@ export const RoomDirectorySaveButton = () => {
|
||||||
const refresh = useRefresh();
|
const refresh = useRefresh();
|
||||||
const [create, { isloading }] = useCreate();
|
const [create, { isloading }] = useCreate();
|
||||||
|
|
||||||
const handleSend = values => {
|
const handleSend = () => {
|
||||||
create(
|
create(
|
||||||
"room_directory",
|
"room_directory",
|
||||||
{ 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");
|
||||||
refresh();
|
refresh();
|
||||||
},
|
},
|
||||||
onError: error =>
|
onError: _error =>
|
||||||
notify("resources.room_directory.action.send_failure", {
|
notify("resources.room_directory.action.send_failure", {
|
||||||
type: "error",
|
type: "error",
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -42,7 +42,7 @@ const destinationRowSx = (record, _index) => ({
|
||||||
|
|
||||||
const destinationFilters = [<SearchInput source="destination" alwaysOn />];
|
const destinationFilters = [<SearchInput source="destination" alwaysOn />];
|
||||||
|
|
||||||
export const DestinationReconnectButton = props => {
|
export const DestinationReconnectButton = () => {
|
||||||
const record = useRecordContext();
|
const record = useRecordContext();
|
||||||
const refresh = useRefresh();
|
const refresh = useRefresh();
|
||||||
const notify = useNotify();
|
const notify = useNotify();
|
||||||
|
@ -83,13 +83,13 @@ export const DestinationReconnectButton = props => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const DestinationShowActions = props => (
|
const DestinationShowActions = () => (
|
||||||
<TopToolbar>
|
<TopToolbar>
|
||||||
<DestinationReconnectButton />
|
<DestinationReconnectButton />
|
||||||
</TopToolbar>
|
</TopToolbar>
|
||||||
);
|
);
|
||||||
|
|
||||||
const DestinationTitle = props => {
|
const DestinationTitle = () => {
|
||||||
const record = useRecordContext();
|
const record = useRecordContext();
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -44,6 +44,7 @@ export const DeviceRemoveButton = props => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
|
{...props}
|
||||||
label="ra.action.remove"
|
label="ra.action.remove"
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
sx={{
|
sx={{
|
||||||
|
|
|
@ -122,6 +122,7 @@ export const DeleteMediaButton = props => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
|
{...props}
|
||||||
label="resources.delete_media.action.send"
|
label="resources.delete_media.action.send"
|
||||||
onClick={handleDialogOpen}
|
onClick={handleDialogOpen}
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
|
@ -298,7 +299,7 @@ export const QuarantineMediaButton = props => {
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<Button disabled={true}>
|
<Button {...props} disabled={true}>
|
||||||
<ClearIcon />
|
<ClearIcon />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -311,7 +312,11 @@ export const QuarantineMediaButton = props => {
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<Button onClick={handleRemoveQuarantaine} disabled={isLoading}>
|
<Button
|
||||||
|
{...props}
|
||||||
|
onClick={handleRemoveQuarantaine}
|
||||||
|
disabled={isLoading}
|
||||||
|
>
|
||||||
<BlockIcon color="error" />
|
<BlockIcon color="error" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -54,7 +54,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 = "";
|
||||||
|
@ -69,23 +69,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"
|
||||||
|
@ -298,11 +298,12 @@ const RoomListActions = () => (
|
||||||
</TopToolbar>
|
</TopToolbar>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const RoomList = () => {
|
export const RoomList = props => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List
|
<List
|
||||||
|
{...props}
|
||||||
pagination={<RoomPagination />}
|
pagination={<RoomPagination />}
|
||||||
sort={{ field: "name", order: "ASC" }}
|
sort={{ field: "name", order: "ASC" }}
|
||||||
filters={roomFilters}
|
filters={roomFilters}
|
||||||
|
|
|
@ -52,27 +52,25 @@ const UserMediaStatsPagination = props => (
|
||||||
|
|
||||||
const userMediaStatsFilters = [<SearchInput source="search_term" alwaysOn />];
|
const userMediaStatsFilters = [<SearchInput source="search_term" alwaysOn />];
|
||||||
|
|
||||||
export const UserMediaStatsList = props => {
|
export const UserMediaStatsList = props => (
|
||||||
return (
|
<List
|
||||||
<List
|
{...props}
|
||||||
{...props}
|
actions={<ListActions />}
|
||||||
actions={<ListActions />}
|
filters={userMediaStatsFilters}
|
||||||
filters={userMediaStatsFilters}
|
pagination={<UserMediaStatsPagination />}
|
||||||
pagination={<UserMediaStatsPagination />}
|
sort={{ field: "media_length", order: "DESC" }}
|
||||||
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>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
|
@ -134,11 +134,10 @@ const userFilters = [
|
||||||
/>,
|
/>,
|
||||||
];
|
];
|
||||||
|
|
||||||
const UserBulkActionButtons = props => (
|
const UserBulkActionButtons = () => (
|
||||||
<>
|
<>
|
||||||
<ServerNoticeBulkButton {...props} />
|
<ServerNoticeBulkButton />
|
||||||
<BulkDeleteButton
|
<BulkDeleteButton
|
||||||
{...props}
|
|
||||||
label="resources.users.action.erase"
|
label="resources.users.action.erase"
|
||||||
confirmTitle="resources.users.helper.erase"
|
confirmTitle="resources.users.helper.erase"
|
||||||
mutationMode="pessimistic"
|
mutationMode="pessimistic"
|
||||||
|
@ -146,37 +145,35 @@ const UserBulkActionButtons = props => (
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const UserList = props => {
|
export const UserList = props => (
|
||||||
return (
|
<List
|
||||||
<List
|
{...props}
|
||||||
{...props}
|
filters={userFilters}
|
||||||
filters={userFilters}
|
filterDefaultValues={{ guests: true, deactivated: false }}
|
||||||
filterDefaultValues={{ guests: true, deactivated: false }}
|
sort={{ field: "name", order: "ASC" }}
|
||||||
sort={{ field: "name", order: "ASC" }}
|
actions={<UserListActions maxResults={10000} />}
|
||||||
actions={<UserListActions maxResults={10000} />}
|
pagination={<UserPagination />}
|
||||||
pagination={<UserPagination />}
|
>
|
||||||
>
|
<Datagrid rowClick="edit" bulkActionButtons={<UserBulkActionButtons />}>
|
||||||
<Datagrid rowClick="edit" bulkActionButtons={<UserBulkActionButtons />}>
|
<AvatarField
|
||||||
<AvatarField
|
source="avatar_src"
|
||||||
source="avatar_src"
|
sx={{ height: "40px", width: "40px" }}
|
||||||
sx={{ height: "40px", width: "40px" }}
|
sortBy="avatar_url"
|
||||||
sortBy="avatar_url"
|
/>
|
||||||
/>
|
<TextField source="id" sortBy="name" />
|
||||||
<TextField source="id" sortBy="name" />
|
<TextField source="displayname" />
|
||||||
<TextField source="displayname" />
|
<BooleanField source="is_guest" />
|
||||||
<BooleanField source="is_guest" />
|
<BooleanField source="admin" />
|
||||||
<BooleanField source="admin" />
|
<BooleanField source="deactivated" />
|
||||||
<BooleanField source="deactivated" />
|
<DateField
|
||||||
<DateField
|
source="creation_ts"
|
||||||
source="creation_ts"
|
label="resources.users.fields.creation_ts_ms"
|
||||||
label="resources.users.fields.creation_ts_ms"
|
showTime
|
||||||
showTime
|
options={date_format}
|
||||||
options={date_format}
|
/>
|
||||||
/>
|
</Datagrid>
|
||||||
</Datagrid>
|
</List>
|
||||||
</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
|
||||||
|
@ -300,7 +297,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 (
|
||||||
|
|
Loading…
Reference in a new issue