Simplify filters

Change-Id: I3e4cb7134a92c949bfb62d753c682a6c8fca6736
This commit is contained in:
Manuel Stahl 2024-02-03 13:46:33 +01:00
parent a222af273f
commit 78d1d34a84
5 changed files with 18 additions and 43 deletions

View File

@ -6,7 +6,6 @@ import {
DateField,
DateTimeInput,
Edit,
Filter,
List,
maxValue,
number,
@ -53,17 +52,13 @@ const dateFormatter = v => {
return `${year}-${month}-${day}T${hour}:${minute}`;
};
const RegistrationTokenFilter = props => (
<Filter {...props}>
<BooleanInput source="valid" alwaysOn />
</Filter>
);
const registrationTokenFilters = [<BooleanInput source="valid" alwaysOn />];
export const RegistrationTokenList = props => {
return (
<List
{...props}
filters={<RegistrationTokenFilter />}
filters={registrationTokenFilters}
filterDefaultValues={{ valid: true }}
pagination={false}
perPage={500}

View File

@ -3,7 +3,6 @@ import {
Button,
Datagrid,
DateField,
Filter,
List,
Pagination,
ReferenceField,
@ -41,13 +40,7 @@ const destinationRowSx = (record, _index) => ({
backgroundColor: record.retry_last_ts > 0 ? "#ffcccc" : "white",
});
const DestinationFilter = props => {
return (
<Filter {...props}>
<SearchInput source="destination" alwaysOn />
</Filter>
);
};
const destinationFilters = [<SearchInput source="destination" alwaysOn />];
export const DestinationReconnectButton = props => {
const record = useRecordContext();
@ -110,7 +103,7 @@ export const DestinationList = props => {
return (
<List
{...props}
filters={<DestinationFilter />}
filters={destinationFilters}
pagination={<DestinationPagination />}
sort={{ field: "destination", order: "ASC" }}
>

View File

@ -7,7 +7,6 @@ import {
DatagridConfigurable,
DeleteButton,
ExportButton,
Filter,
FunctionField,
List,
NumberField,
@ -290,11 +289,7 @@ const RoomBulkActionButtons = () => (
</>
);
const RoomFilter = props => (
<Filter {...props}>
<SearchInput source="search_term" alwaysOn />
</Filter>
);
const roomFilters = [<SearchInput source="search_term" alwaysOn />];
const RoomListActions = () => (
<TopToolbar>
@ -310,7 +305,7 @@ export const RoomList = () => {
<List
pagination={<RoomPagination />}
sort={{ field: "name", order: "ASC" }}
filters={<RoomFilter />}
filters={roomFilters}
actions={<RoomListActions />}
>
<DatagridConfigurable

View File

@ -3,7 +3,6 @@ import { cloneElement } from "react";
import {
Datagrid,
ExportButton,
Filter,
List,
NumberField,
Pagination,
@ -51,18 +50,14 @@ const UserMediaStatsPagination = props => (
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
);
const UserMediaStatsFilter = props => (
<Filter {...props}>
<SearchInput source="search_term" alwaysOn />
</Filter>
);
const userMediaStatsFilters = [<SearchInput source="search_term" alwaysOn />];
export const UserMediaStatsList = props => {
return (
<List
{...props}
actions={<ListActions />}
filters={<UserMediaStatsFilter />}
filters={userMediaStatsFilters}
pagination={<UserMediaStatsPagination />}
sort={{ field: "media_length", order: "DESC" }}
>

View File

@ -17,7 +17,6 @@ import {
Create,
Edit,
List,
Filter,
Toolbar,
SimpleForm,
SimpleFormIterator,
@ -125,17 +124,15 @@ const UserPagination = props => (
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
);
const UserFilter = props => (
<Filter {...props}>
<SearchInput source="name" alwaysOn />
<BooleanInput source="guests" alwaysOn />
const userFilters = [
<SearchInput source="name" alwaysOn />,
<BooleanInput source="guests" alwaysOn />,
<BooleanInput
label="resources.users.fields.show_deactivated"
source="deactivated"
alwaysOn
/>
</Filter>
);
/>,
];
const UserBulkActionButtons = props => (
<>
@ -153,7 +150,7 @@ export const UserList = props => {
return (
<List
{...props}
filters={<UserFilter />}
filters={userFilters}
filterDefaultValues={{ guests: true, deactivated: false }}
sort={{ field: "name", order: "ASC" }}
actions={<UserListActions maxResults={10000} />}