remove filter
This commit is contained in:
parent
1b55f64ed1
commit
1f898bf7a8
@ -1,6 +1,4 @@
|
|||||||
import React, { cloneElement, Fragment } from "react";
|
import React, { cloneElement, Fragment } from "react";
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { Chip } from "@material-ui/core";
|
|
||||||
import Avatar from "@material-ui/core/Avatar";
|
import Avatar from "@material-ui/core/Avatar";
|
||||||
import PersonPinIcon from "@material-ui/icons/PersonPin";
|
import PersonPinIcon from "@material-ui/icons/PersonPin";
|
||||||
import AssignmentIndIcon from "@material-ui/icons/AssignmentInd";
|
import AssignmentIndIcon from "@material-ui/icons/AssignmentInd";
|
||||||
@ -124,38 +122,17 @@ 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 UserFilter = props => (
|
||||||
const translate = useTranslate();
|
<Filter {...props}>
|
||||||
return (
|
<SearchInput source="name" alwaysOn />
|
||||||
<Filter {...props}>
|
<BooleanInput source="guests" alwaysOn />
|
||||||
<SearchInput source="name" alwaysOn />
|
<BooleanInput
|
||||||
<BooleanInput source="guests" alwaysOn />
|
label="resources.users.fields.show_deactivated"
|
||||||
<BooleanInput
|
source="deactivated"
|
||||||
label="resources.users.fields.show_deactivated"
|
alwaysOn
|
||||||
source="deactivated"
|
/>
|
||||||
alwaysOn
|
</Filter>
|
||||||
/>
|
);
|
||||||
<Chip
|
|
||||||
label={translate("resources.users.fields.admin")}
|
|
||||||
source="admin"
|
|
||||||
defaultValue={false}
|
|
||||||
style={{ marginBottom: 8 }}
|
|
||||||
/>
|
|
||||||
<Chip
|
|
||||||
label={translate("resources.users.fields.is_guest")}
|
|
||||||
source="is_guest"
|
|
||||||
defaultValue={false}
|
|
||||||
style={{ marginBottom: 8 }}
|
|
||||||
/>
|
|
||||||
<Chip
|
|
||||||
label={translate("resources.users.fields.creation_ts_ms")}
|
|
||||||
source="creation_ts"
|
|
||||||
defaultValue={false}
|
|
||||||
style={{ marginBottom: 8 }}
|
|
||||||
/>
|
|
||||||
</Filter>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const UserBulkActionButtons = props => (
|
const UserBulkActionButtons = props => (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
@ -173,13 +150,8 @@ const AvatarField = ({ source, className, record = {} }) => (
|
|||||||
<Avatar src={record[source]} className={className} />
|
<Avatar src={record[source]} className={className} />
|
||||||
);
|
);
|
||||||
|
|
||||||
const FilterableUserList = ({ userFilters, dispatch, ...props }) => {
|
export const UserList = props => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const filter = userFilters;
|
|
||||||
const adminFilter = filter && filter.admin ? true : false;
|
|
||||||
const isGuestFilter = filter && filter.is_guest ? true : false;
|
|
||||||
const creationTimeFilter = filter && filter.creation_ts ? true : false;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List
|
<List
|
||||||
{...props}
|
{...props}
|
||||||
@ -199,34 +171,25 @@ const FilterableUserList = ({ userFilters, dispatch, ...props }) => {
|
|||||||
<TextField source="id" sortBy="name" />
|
<TextField source="id" sortBy="name" />
|
||||||
<TextField source="displayname" />
|
<TextField source="displayname" />
|
||||||
<BooleanField source="deactivated" />
|
<BooleanField source="deactivated" />
|
||||||
{adminFilter && <BooleanField source="admin" />}
|
<BooleanField source="admin" />
|
||||||
{isGuestFilter && <BooleanField source="is_guest" />}
|
<BooleanField source="is_guest" />
|
||||||
{creationTimeFilter && (
|
<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={{
|
||||||
options={{
|
year: "numeric",
|
||||||
year: "numeric",
|
month: "2-digit",
|
||||||
month: "2-digit",
|
day: "2-digit",
|
||||||
day: "2-digit",
|
hour: "2-digit",
|
||||||
hour: "2-digit",
|
minute: "2-digit",
|
||||||
minute: "2-digit",
|
second: "2-digit",
|
||||||
second: "2-digit",
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Datagrid>
|
</Datagrid>
|
||||||
</List>
|
</List>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
function mapStateToProps(state) {
|
|
||||||
return {
|
|
||||||
userFilters: state.admin.resources.users.list.params.displayedFilters,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export const UserList = connect(mapStateToProps)(FilterableUserList);
|
|
||||||
|
|
||||||
// https://matrix.org/docs/spec/appendices#user-identifiers
|
// https://matrix.org/docs/spec/appendices#user-identifiers
|
||||||
const validateUser = regex(
|
const validateUser = regex(
|
||||||
|
Loading…
Reference in New Issue
Block a user