Add creation_ts
to list users
This commit is contained in:
parent
5262518699
commit
c143d88ab0
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
This project is built using [react-admin](https://marmelab.com/react-admin/).
|
This project is built using [react-admin](https://marmelab.com/react-admin/).
|
||||||
|
|
||||||
It needs at least Synapse v1.34.0 for all functions to work as expected!
|
It needs at least Synapse v1.40.0 for all functions to work as expected!
|
||||||
|
|
||||||
You get your server version with the request `/_synapse/admin/v1/server_version`.
|
You get your server version with the request `/_synapse/admin/v1/server_version`.
|
||||||
See also [Synapse version API](https://matrix-org.github.io/synapse/develop/admin_api/version_api.html).
|
See also [Synapse version API](https://matrix-org.github.io/synapse/develop/admin_api/version_api.html).
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
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 ContactMailIcon from "@material-ui/icons/ContactMail";
|
import ContactMailIcon from "@material-ui/icons/ContactMail";
|
||||||
@ -121,17 +123,38 @@ 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 => {
|
||||||
<Filter {...props}>
|
const translate = useTranslate();
|
||||||
<SearchInput source="name" alwaysOn />
|
return (
|
||||||
<BooleanInput source="guests" alwaysOn />
|
<Filter {...props}>
|
||||||
<BooleanInput
|
<SearchInput source="name" alwaysOn />
|
||||||
label="resources.users.fields.show_deactivated"
|
<BooleanInput source="guests" alwaysOn />
|
||||||
source="deactivated"
|
<BooleanInput
|
||||||
alwaysOn
|
label="resources.users.fields.show_deactivated"
|
||||||
/>
|
source="deactivated"
|
||||||
</Filter>
|
alwaysOn
|
||||||
);
|
/>
|
||||||
|
<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>
|
||||||
@ -149,8 +172,13 @@ const AvatarField = ({ source, className, record = {} }) => (
|
|||||||
<Avatar src={record[source]} className={className} />
|
<Avatar src={record[source]} className={className} />
|
||||||
);
|
);
|
||||||
|
|
||||||
export const UserList = props => {
|
const FilterableUserList = ({ userFilters, dispatch, ...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}
|
||||||
@ -169,13 +197,35 @@ export const UserList = props => {
|
|||||||
/>
|
/>
|
||||||
<TextField source="id" sortBy="name" />
|
<TextField source="id" sortBy="name" />
|
||||||
<TextField source="displayname" />
|
<TextField source="displayname" />
|
||||||
<BooleanField source="is_guest" />
|
|
||||||
<BooleanField source="admin" />
|
|
||||||
<BooleanField source="deactivated" />
|
<BooleanField source="deactivated" />
|
||||||
|
{adminFilter && <BooleanField source="admin" />}
|
||||||
|
{isGuestFilter && <BooleanField source="is_guest" />}
|
||||||
|
{creationTimeFilter && (
|
||||||
|
<DateField
|
||||||
|
source="creation_ts"
|
||||||
|
label="resources.users.fields.creation_ts_ms"
|
||||||
|
showTime
|
||||||
|
options={{
|
||||||
|
year: "numeric",
|
||||||
|
month: "2-digit",
|
||||||
|
day: "2-digit",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "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