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:
Manuel Stahl 2024-02-05 13:06:47 +01:00
parent 78d1d34a84
commit af453eea71
10 changed files with 142 additions and 147 deletions

View file

@ -98,15 +98,13 @@ 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"> <Datagrid rowClick="show" bulkActionButtons={false}>
<TextField source="id" sortable={false} /> <TextField source="id" sortable={false} />
<DateField <DateField
source="received_ts" source="received_ts"
@ -119,5 +117,4 @@ export const ReportList = ({ ...props }) => {
<TextField sortable={false} source="score" /> <TextField sortable={false} source="score" />
</Datagrid> </Datagrid>
</List> </List>
); );
};

View file

@ -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 " +

View file

@ -54,8 +54,7 @@ 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}
@ -76,8 +75,7 @@ export const RegistrationTokenList = props => {
/> />
</Datagrid> </Datagrid>
</List> </List>
); );
};
export const RegistrationTokenCreate = props => ( export const RegistrationTokenCreate = props => (
<Create {...props}> <Create {...props}>
@ -104,8 +102,7 @@ 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 />
@ -123,5 +120,4 @@ export const RegistrationTokenEdit = props => {
/> />
</SimpleForm> </SimpleForm>
</Edit> </Edit>
); );
};

View file

@ -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",
}), }),

View file

@ -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 (

View file

@ -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={{

View file

@ -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>

View file

@ -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}

View file

@ -52,8 +52,7 @@ 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 />}
@ -74,5 +73,4 @@ export const UserMediaStatsList = props => {
<NumberField source="media_length" /> <NumberField source="media_length" />
</Datagrid> </Datagrid>
</List> </List>
); );
};

View file

@ -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,8 +145,7 @@ const UserBulkActionButtons = props => (
</> </>
); );
export const UserList = props => { export const UserList = props => (
return (
<List <List
{...props} {...props}
filters={userFilters} filters={userFilters}
@ -175,8 +173,7 @@ export const UserList = props => {
/> />
</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 (