Commit 98acf156 authored by Oleksii Savran's avatar Oleksii Savran
Browse files

Admin: Users by createdDate

parent 600c04ea
......@@ -136,7 +136,9 @@
"expired": "Expired",
"locked": "Locked",
"email": "E-mail address",
"uuid": "UUID"
"uuid": "UUID",
"createdDate": "Created date",
"lastLogin": "Last login"
},
"requests": {
"email": "E-mail address",
......@@ -2218,7 +2220,8 @@
"title": "Filter users",
"locked": "Account locked",
"enabled": "Account active",
"expired": "Account expired"
"expired": "Account expired",
"lastLogin": "Last login"
},
"p": {
"browse": {
......@@ -2391,7 +2394,9 @@
},
"sort": {
"lastLoginAsc": "Last login (old to new)",
"lastLoginDesc": "Last login (new to old)"
"lastLoginDesc": "Last login (new to old)",
"createdDateAsc": "Created date (old to new)",
"createdDateDesc": "Created date (new to old)"
}
},
"vocabulary": {
......
......@@ -21,6 +21,7 @@ class UserFilter {
public role: string[];
public uuid: string[];
public version: number[];
public lastLogin: DateFilter;
}
export default UserFilter;
......@@ -25,6 +25,7 @@ class User extends UuidModel {
public lockedUntil: Date;
public passwordExpires: Date;
public lastLogin: Date;
public createdDate: Date;
public constructor(obj?) {
super(obj);
......@@ -40,6 +41,8 @@ class User extends UuidModel {
email: { property: 'email', label: 'user.common.emailAddress', direction: 'ASC' },
lastLogin: { property: 'lastLogin', label: 'user.sort.lastLoginAsc', direction: 'ASC' },
lastLoginDesc: { property: 'lastLogin', label: 'user.sort.lastLoginDesc', direction: 'DESC' },
createdDate: { property: 'createdDate', label: 'user.sort.createdDateAsc', direction: 'ASC' },
createdDateDesc: { property: 'createdDate', label: 'user.sort.createdDateDesc', direction: 'DESC' },
};
}
......
......@@ -136,7 +136,9 @@
"expired": "Expired",
"locked": "Locked",
"email": "E-mail address",
"uuid": "UUID"
"uuid": "UUID",
"createdDate": "Created date",
"lastLogin": "Last login"
},
"requests": {
"email": "E-mail address",
......
......@@ -19,14 +19,14 @@ class BooleanFilter extends React.Component<IBooleanFilter, any> {
private getTermsValue = (val) => val === 'true' ? this.props.terms.get('1') : val === 'false' ? this.props.terms.get('0') : (this.props.terms.get('1') + this.props.terms.get('0')) || '0';
public render() {
const {terms, name, label} = this.props;
const {terms, name, label, t} = this.props;
return (
<div>
<Field
name={ name }
singleColumn
component={ RadioSelection }
formLabel={ label }
formLabel={ t(label) }
parse={ (value) => value === '' ? null : value === 'true' }
options={ [true, false, ''] }
classes={ {label: 'full-width'} }
......
......@@ -199,8 +199,7 @@ function getLabelName(path, value, lookups, prefix, t, labels) {
}
const translatedPrettyName = t(`${name}`);
if (prettyPath.includes('Date')) {
if (prettyPath.includes('Date') || prettyPath.includes('lastLogin')) {
return <span>{ translatedPrettyPath } <PrettyDate value={ new Date(name) } /></span>;
}
......
......@@ -56,7 +56,8 @@
"title": "Filter users",
"locked": "Account locked",
"enabled": "Account active",
"expired": "Account expired"
"expired": "Account expired",
"lastLogin": "Last login"
},
"p": {
"browse": {
......@@ -229,6 +230,8 @@
},
"sort": {
"lastLoginAsc": "Last login (old to new)",
"lastLoginDesc": "Last login (new to old)"
"lastLoginDesc": "Last login (new to old)",
"createdDateAsc": "Created date (old to new)",
"createdDateDesc": "Created date (new to old)"
}
}
\ No newline at end of file
......@@ -9,8 +9,9 @@ import StringFilter from 'ui/common/filter/StringFilter';
import StringArrFilter from 'ui/common/filter/StringArrFilter';
import BooleanFilter from 'ui/common/filter/BooleanFilter';
import {User} from 'model/user/User';
import DateFilter from 'ui/common/filter/DateFilter';
const UserFilters = ({handleSubmit, initialValues, initialize, ...other}) => {
const UserFilters = ({handleSubmit, initialValues, initialize, t, ...other}) => {
return (
<FiltersBlock title="user.admin.f.title" handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
<CollapsibleComponentSearch title="common:f.textSearch">
......@@ -20,6 +21,10 @@ const UserFilters = ({handleSubmit, initialValues, initialize, ...other}) => {
<CollapsibleComponentSearch title="user.common.roleLabel">
<StringArrFilter name="role" options={ User.USERROLES } byKey />
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title="common:f.dateSearch">
<DateFilter name="createdDate" label="common:f.createdDate"/>
<DateFilter name="lastLogin" label="user.admin.f.lastLogin"/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title="user.common.statusLabel">
<BooleanFilter name="locked" label="user.admin.f.locked" />
<BooleanFilter name="active" label="user.admin.f.enabled" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment