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 }) => {
return (
export const ReportList = props => (
<List
{...props}
pagination={<ReportPagination />}
sort={{ field: "received_ts", order: "DESC" }}
bulkActionButtons={false}
>
<Datagrid rowClick="show">
<Datagrid rowClick="show" bulkActionButtons={false}>
<TextField source="id" sortable={false} />
<DateField
source="received_ts"
@ -119,5 +117,4 @@ export const ReportList = ({ ...props }) => {
<TextField sortable={false} source="score" />
</Datagrid>
</List>
);
};
);

View File

@ -32,7 +32,7 @@ function TranslatableOption({ value, text }) {
return <option value={value}>{translate(text)}</option>;
}
const FilePicker = props => {
const FilePicker = () => {
const [values, setValues] = useState(null);
const [error, setError] = useState(null);
const [stats, setStats] = useState(null);
@ -191,7 +191,7 @@ const FilePicker = props => {
return true;
};
const runImport = async e => {
const runImport = async _e => {
if (progress !== null) {
notify("import_users.errors.already_in_progress");
return;
@ -307,7 +307,7 @@ const FilePicker = props => {
let retries = 0;
const submitRecord = recordData => {
return dataProvider.getOne("users", { id: recordData.id }).then(
async alreadyExists => {
async _alreadyExists => {
if (LOGGING) console.log("already existed");
if (useridMode === "update" || conflictMode === "skip") {
@ -332,7 +332,7 @@ const FilePicker = props => {
}
}
},
async okToSubmit => {
async _okToSubmit => {
if (LOGGING)
console.log(
"OK to create record " +

View File

@ -54,8 +54,7 @@ const dateFormatter = v => {
const registrationTokenFilters = [<BooleanInput source="valid" alwaysOn />];
export const RegistrationTokenList = props => {
return (
export const RegistrationTokenList = props => (
<List
{...props}
filters={registrationTokenFilters}
@ -76,8 +75,7 @@ export const RegistrationTokenList = props => {
/>
</Datagrid>
</List>
);
};
);
export const RegistrationTokenCreate = props => (
<Create {...props}>
@ -104,8 +102,7 @@ export const RegistrationTokenCreate = props => (
</Create>
);
export const RegistrationTokenEdit = props => {
return (
export const RegistrationTokenEdit = props => (
<Edit {...props}>
<SimpleForm>
<TextInput source="token" disabled />
@ -123,5 +120,4 @@ export const RegistrationTokenEdit = props => {
/>
</SimpleForm>
</Edit>
);
};
);

View File

@ -102,16 +102,16 @@ export const RoomDirectorySaveButton = () => {
const refresh = useRefresh();
const [create, { isloading }] = useCreate();
const handleSend = values => {
const handleSend = () => {
create(
"room_directory",
{ data: { id: record.id } },
{
onSuccess: data => {
onSuccess: _data => {
notify("resources.room_directory.action.send_success");
refresh();
},
onError: error =>
onError: _error =>
notify("resources.room_directory.action.send_failure", {
type: "error",
}),

View File

@ -42,7 +42,7 @@ const destinationRowSx = (record, _index) => ({
const destinationFilters = [<SearchInput source="destination" alwaysOn />];
export const DestinationReconnectButton = props => {
export const DestinationReconnectButton = () => {
const record = useRecordContext();
const refresh = useRefresh();
const notify = useNotify();
@ -83,13 +83,13 @@ export const DestinationReconnectButton = props => {
);
};
const DestinationShowActions = props => (
const DestinationShowActions = () => (
<TopToolbar>
<DestinationReconnectButton />
</TopToolbar>
);
const DestinationTitle = props => {
const DestinationTitle = () => {
const record = useRecordContext();
const translate = useTranslate();
return (

View File

@ -44,6 +44,7 @@ export const DeviceRemoveButton = props => {
return (
<>
<Button
{...props}
label="ra.action.remove"
onClick={handleClick}
sx={{

View File

@ -122,6 +122,7 @@ export const DeleteMediaButton = props => {
return (
<>
<Button
{...props}
label="resources.delete_media.action.send"
onClick={handleDialogOpen}
disabled={isLoading}
@ -298,7 +299,7 @@ export const QuarantineMediaButton = props => {
})}
>
<div>
<Button disabled={true}>
<Button {...props} disabled={true}>
<ClearIcon />
</Button>
</div>
@ -311,7 +312,11 @@ export const QuarantineMediaButton = props => {
})}
>
<div>
<Button onClick={handleRemoveQuarantaine} disabled={isLoading}>
<Button
{...props}
onClick={handleRemoveQuarantaine}
disabled={isLoading}
>
<BlockIcon color="error" />
</Button>
</div>

View File

@ -54,7 +54,7 @@ const RoomPagination = props => (
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
);
const RoomTitle = props => {
const RoomTitle = () => {
const record = useRecordContext();
const translate = useTranslate();
var name = "";
@ -69,23 +69,23 @@ const RoomTitle = props => {
);
};
const RoomShowActions = ({ data, resource }) => {
const RoomShowActions = () => {
const record = useRecordContext();
var roomDirectoryStatus = "";
if (data) {
roomDirectoryStatus = data.public;
if (record) {
roomDirectoryStatus = record.public;
}
return (
<TopToolbar>
{roomDirectoryStatus === false && (
<RoomDirectorySaveButton record={data} />
<RoomDirectorySaveButton record={record} />
)}
{roomDirectoryStatus === true && (
<RoomDirectoryDeleteButton record={data} />
<RoomDirectoryDeleteButton record={record} />
)}
<DeleteButton
record={data}
resource={resource}
record={record}
mutationMode="pessimistic"
confirmTitle="resources.rooms.action.erase.title"
confirmContent="resources.rooms.action.erase.content"
@ -298,11 +298,12 @@ const RoomListActions = () => (
</TopToolbar>
);
export const RoomList = () => {
export const RoomList = props => {
const theme = useTheme();
return (
<List
{...props}
pagination={<RoomPagination />}
sort={{ field: "name", order: "ASC" }}
filters={roomFilters}

View File

@ -52,8 +52,7 @@ const UserMediaStatsPagination = props => (
const userMediaStatsFilters = [<SearchInput source="search_term" alwaysOn />];
export const UserMediaStatsList = props => {
return (
export const UserMediaStatsList = props => (
<List
{...props}
actions={<ListActions />}
@ -74,5 +73,4 @@ export const UserMediaStatsList = props => {
<NumberField source="media_length" />
</Datagrid>
</List>
);
};
);

View File

@ -134,11 +134,10 @@ const userFilters = [
/>,
];
const UserBulkActionButtons = props => (
const UserBulkActionButtons = () => (
<>
<ServerNoticeBulkButton {...props} />
<ServerNoticeBulkButton />
<BulkDeleteButton
{...props}
label="resources.users.action.erase"
confirmTitle="resources.users.helper.erase"
mutationMode="pessimistic"
@ -146,8 +145,7 @@ const UserBulkActionButtons = props => (
</>
);
export const UserList = props => {
return (
export const UserList = props => (
<List
{...props}
filters={userFilters}
@ -175,8 +173,7 @@ export const UserList = props => {
/>
</Datagrid>
</List>
);
};
);
// https://matrix.org/docs/spec/appendices#user-identifiers
// here only local part of user_id
@ -300,7 +297,7 @@ export const UserCreate = props => (
</Create>
);
const UserTitle = props => {
const UserTitle = () => {
const record = useRecordContext();
const translate = useTranslate();
return (