1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

Admin new sort (#8002)

* [system admin] Libraries - 'All' & 'Wikis': removed the sort in the table head, added a sort menu

* [org admin] libraries - 'all': removed the sort in the table head, and added a sort menu

* [org admin] users - 'all': removed the sort in the table head, and added a sort menu

* [system admin] Users - 'Database' & 'LDAP(imported)': removed the sort in the table head, added a sort menu

* [system admin] Links - Share Links: removed the sort in the table head, and added a sort menu

* [system admin] Departments - department - members: removed the sort in the table head, added a sort menu, and bugfix

* [org admin] Departments - department - members: removed the sort in the table head, added a sort menu, and bugfix

* [sort menu] fixed the default menu options
This commit is contained in:
llj
2025-07-04 11:55:33 +08:00
committed by GitHub
parent 52c2578e9b
commit 4703a2a75e
19 changed files with 232 additions and 190 deletions

View File

@@ -2,9 +2,12 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Link } from '@gatsbyjs/reach-router';
import { siteRoot, gettext } from '../../../utils/constants';
import SortMenu from '../../../components/sort-menu';
const propTypes = {
currentItem: PropTypes.string.isRequired
currentItem: PropTypes.string.isRequired,
sortBy: PropTypes.string,
sortItems: PropTypes.func
};
class Nav extends React.Component {
@@ -17,10 +20,20 @@ class Nav extends React.Component {
{ name: 'system', urlPart: 'system-library', text: gettext('System') },
{ name: 'trash', urlPart: 'trash-libraries', text: gettext('Trash') }
];
this.sortOptions = [
{ value: 'file_count-desc', text: gettext('Descending by files') },
{ value: 'size-desc', text: gettext('Descending by size') }
];
}
onSelectSortOption = (item) => {
const [sortBy,] = item.value.split('-');
this.props.sortItems(sortBy);
};
render() {
const { currentItem } = this.props;
const { currentItem, sortBy, sortOrder = 'desc' } = this.props;
const showSortIcon = currentItem == 'all' || currentItem == 'wikis';
return (
<div className="cur-view-path tab-nav-container">
<ul className="nav">
@@ -32,6 +45,14 @@ class Nav extends React.Component {
);
})}
</ul>
{showSortIcon &&
<SortMenu
sortBy={sortBy}
sortOrder={sortOrder}
sortOptions={this.sortOptions}
onSelectSortOption={this.onSelectSortOption}
/>
}
</div>
);
}