1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-28 16:17:02 +00:00

[system admin] users: added 'sort by quota_usage' (#4417)

This commit is contained in:
llj
2020-03-09 14:01:12 +08:00
committed by GitHub
parent 1afbb10146
commit 54fe3d0fbc
2 changed files with 60 additions and 6 deletions

View File

@@ -43,8 +43,17 @@ class Content extends Component {
this.props.getListByPage(this.props.currentPage + 1);
}
sortByQuotaUsage = (e) => {
e.preventDefault();
this.props.sortByQuotaUsage();
}
render() {
const { isAdmin, loading, errorMsg, items, isAllUsersSelected, curPerPage, hasNextPage, currentPage } = this.props;
const {
isAdmin, loading, errorMsg, items, isAllUsersSelected,
curPerPage, hasNextPage, currentPage,
sortBy, sortOrder
} = this.props;
if (loading) {
return <Loading />;
} else if (errorMsg) {
@@ -56,9 +65,18 @@ class Content extends Component {
</EmptyTip>
);
let columns = [];
const sortIcon = <span className={`fas ${sortOrder == 'asc' ? 'fa-caret-up' : 'fa-caret-down'}`}></span>;
const spaceText = gettext('Space Used');
const spaceEl =
sortBy != undefined ? // only offer 'sort' for 'DB' & 'LDAPImported' users
<a className="d-inline-block table-sort-op" href="#" onClick={this.sortByQuotaUsage}>{spaceText} {sortBy == 'quota_usage' && sortIcon}</a> :
spaceText;
const colSpaceText = <Fragment>{spaceEl}{` / ${gettext('Quota')}`}</Fragment>;
const colNameText = `${gettext('Name')} / ${gettext('Contact Email')}`;
const colSpaceText = `${gettext('Space Used')} / ${gettext('Quota')}`;
const colCreatedText = `${gettext('Created At')} / ${gettext('Last Login')}`;
if (isPro) {
columns.push(