mirror of
https://github.com/UA-Fediland/synapse-admin.git
synced 2024-11-22 06:21:28 +00:00
Simplify filters
Change-Id: I3e4cb7134a92c949bfb62d753c682a6c8fca6736
This commit is contained in:
parent
a222af273f
commit
78d1d34a84
5 changed files with 18 additions and 43 deletions
|
@ -6,7 +6,6 @@ import {
|
||||||
DateField,
|
DateField,
|
||||||
DateTimeInput,
|
DateTimeInput,
|
||||||
Edit,
|
Edit,
|
||||||
Filter,
|
|
||||||
List,
|
List,
|
||||||
maxValue,
|
maxValue,
|
||||||
number,
|
number,
|
||||||
|
@ -53,17 +52,13 @@ const dateFormatter = v => {
|
||||||
return `${year}-${month}-${day}T${hour}:${minute}`;
|
return `${year}-${month}-${day}T${hour}:${minute}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const RegistrationTokenFilter = props => (
|
const registrationTokenFilters = [<BooleanInput source="valid" alwaysOn />];
|
||||||
<Filter {...props}>
|
|
||||||
<BooleanInput source="valid" alwaysOn />
|
|
||||||
</Filter>
|
|
||||||
);
|
|
||||||
|
|
||||||
export const RegistrationTokenList = props => {
|
export const RegistrationTokenList = props => {
|
||||||
return (
|
return (
|
||||||
<List
|
<List
|
||||||
{...props}
|
{...props}
|
||||||
filters={<RegistrationTokenFilter />}
|
filters={registrationTokenFilters}
|
||||||
filterDefaultValues={{ valid: true }}
|
filterDefaultValues={{ valid: true }}
|
||||||
pagination={false}
|
pagination={false}
|
||||||
perPage={500}
|
perPage={500}
|
||||||
|
|
|
@ -3,7 +3,6 @@ import {
|
||||||
Button,
|
Button,
|
||||||
Datagrid,
|
Datagrid,
|
||||||
DateField,
|
DateField,
|
||||||
Filter,
|
|
||||||
List,
|
List,
|
||||||
Pagination,
|
Pagination,
|
||||||
ReferenceField,
|
ReferenceField,
|
||||||
|
@ -41,13 +40,7 @@ const destinationRowSx = (record, _index) => ({
|
||||||
backgroundColor: record.retry_last_ts > 0 ? "#ffcccc" : "white",
|
backgroundColor: record.retry_last_ts > 0 ? "#ffcccc" : "white",
|
||||||
});
|
});
|
||||||
|
|
||||||
const DestinationFilter = props => {
|
const destinationFilters = [<SearchInput source="destination" alwaysOn />];
|
||||||
return (
|
|
||||||
<Filter {...props}>
|
|
||||||
<SearchInput source="destination" alwaysOn />
|
|
||||||
</Filter>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DestinationReconnectButton = props => {
|
export const DestinationReconnectButton = props => {
|
||||||
const record = useRecordContext();
|
const record = useRecordContext();
|
||||||
|
@ -110,7 +103,7 @@ export const DestinationList = props => {
|
||||||
return (
|
return (
|
||||||
<List
|
<List
|
||||||
{...props}
|
{...props}
|
||||||
filters={<DestinationFilter />}
|
filters={destinationFilters}
|
||||||
pagination={<DestinationPagination />}
|
pagination={<DestinationPagination />}
|
||||||
sort={{ field: "destination", order: "ASC" }}
|
sort={{ field: "destination", order: "ASC" }}
|
||||||
>
|
>
|
||||||
|
|
|
@ -7,7 +7,6 @@ import {
|
||||||
DatagridConfigurable,
|
DatagridConfigurable,
|
||||||
DeleteButton,
|
DeleteButton,
|
||||||
ExportButton,
|
ExportButton,
|
||||||
Filter,
|
|
||||||
FunctionField,
|
FunctionField,
|
||||||
List,
|
List,
|
||||||
NumberField,
|
NumberField,
|
||||||
|
@ -290,11 +289,7 @@ const RoomBulkActionButtons = () => (
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
const RoomFilter = props => (
|
const roomFilters = [<SearchInput source="search_term" alwaysOn />];
|
||||||
<Filter {...props}>
|
|
||||||
<SearchInput source="search_term" alwaysOn />
|
|
||||||
</Filter>
|
|
||||||
);
|
|
||||||
|
|
||||||
const RoomListActions = () => (
|
const RoomListActions = () => (
|
||||||
<TopToolbar>
|
<TopToolbar>
|
||||||
|
@ -310,7 +305,7 @@ export const RoomList = () => {
|
||||||
<List
|
<List
|
||||||
pagination={<RoomPagination />}
|
pagination={<RoomPagination />}
|
||||||
sort={{ field: "name", order: "ASC" }}
|
sort={{ field: "name", order: "ASC" }}
|
||||||
filters={<RoomFilter />}
|
filters={roomFilters}
|
||||||
actions={<RoomListActions />}
|
actions={<RoomListActions />}
|
||||||
>
|
>
|
||||||
<DatagridConfigurable
|
<DatagridConfigurable
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { cloneElement } from "react";
|
||||||
import {
|
import {
|
||||||
Datagrid,
|
Datagrid,
|
||||||
ExportButton,
|
ExportButton,
|
||||||
Filter,
|
|
||||||
List,
|
List,
|
||||||
NumberField,
|
NumberField,
|
||||||
Pagination,
|
Pagination,
|
||||||
|
@ -51,18 +50,14 @@ const UserMediaStatsPagination = props => (
|
||||||
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
||||||
);
|
);
|
||||||
|
|
||||||
const UserMediaStatsFilter = props => (
|
const userMediaStatsFilters = [<SearchInput source="search_term" alwaysOn />];
|
||||||
<Filter {...props}>
|
|
||||||
<SearchInput source="search_term" alwaysOn />
|
|
||||||
</Filter>
|
|
||||||
);
|
|
||||||
|
|
||||||
export const UserMediaStatsList = props => {
|
export const UserMediaStatsList = props => {
|
||||||
return (
|
return (
|
||||||
<List
|
<List
|
||||||
{...props}
|
{...props}
|
||||||
actions={<ListActions />}
|
actions={<ListActions />}
|
||||||
filters={<UserMediaStatsFilter />}
|
filters={userMediaStatsFilters}
|
||||||
pagination={<UserMediaStatsPagination />}
|
pagination={<UserMediaStatsPagination />}
|
||||||
sort={{ field: "media_length", order: "DESC" }}
|
sort={{ field: "media_length", order: "DESC" }}
|
||||||
>
|
>
|
||||||
|
|
|
@ -17,7 +17,6 @@ import {
|
||||||
Create,
|
Create,
|
||||||
Edit,
|
Edit,
|
||||||
List,
|
List,
|
||||||
Filter,
|
|
||||||
Toolbar,
|
Toolbar,
|
||||||
SimpleForm,
|
SimpleForm,
|
||||||
SimpleFormIterator,
|
SimpleFormIterator,
|
||||||
|
@ -125,17 +124,15 @@ const UserPagination = props => (
|
||||||
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
||||||
);
|
);
|
||||||
|
|
||||||
const UserFilter = props => (
|
const userFilters = [
|
||||||
<Filter {...props}>
|
<SearchInput source="name" alwaysOn />,
|
||||||
<SearchInput source="name" alwaysOn />
|
<BooleanInput source="guests" alwaysOn />,
|
||||||
<BooleanInput source="guests" alwaysOn />
|
|
||||||
<BooleanInput
|
<BooleanInput
|
||||||
label="resources.users.fields.show_deactivated"
|
label="resources.users.fields.show_deactivated"
|
||||||
source="deactivated"
|
source="deactivated"
|
||||||
alwaysOn
|
alwaysOn
|
||||||
/>
|
/>,
|
||||||
</Filter>
|
];
|
||||||
);
|
|
||||||
|
|
||||||
const UserBulkActionButtons = props => (
|
const UserBulkActionButtons = props => (
|
||||||
<>
|
<>
|
||||||
|
@ -153,7 +150,7 @@ export const UserList = props => {
|
||||||
return (
|
return (
|
||||||
<List
|
<List
|
||||||
{...props}
|
{...props}
|
||||||
filters={<UserFilter />}
|
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} />}
|
||||||
|
|
Loading…
Reference in a new issue