mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 10:26:17 +00:00
Merge branch '7.1' into master
This commit is contained in:
@@ -5,6 +5,7 @@ import { seafileAPI } from '../../utils/seafile-api';
|
||||
import { gettext } from '../../utils/constants';
|
||||
import toaster from '../../components/toast';
|
||||
import EmptyTip from '../../components/empty-tip';
|
||||
import ConfirmUnlinkDeviceDialog from '../../components/dialog/confirm-unlink-device';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
class Content extends Component {
|
||||
@@ -65,8 +66,9 @@ class Item extends Component {
|
||||
super(props);
|
||||
this.state = {
|
||||
isOpMenuOpen: false, // for mobile
|
||||
showOpIcon: false,
|
||||
unlinked: false
|
||||
isOpIconShown: false,
|
||||
unlinked: false,
|
||||
isConfirmUnlinkDialogOpen: false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -78,13 +80,19 @@ class Item extends Component {
|
||||
|
||||
handleMouseOver = () => {
|
||||
this.setState({
|
||||
showOpIcon: true
|
||||
isOpIconShown: true
|
||||
});
|
||||
}
|
||||
|
||||
handleMouseOut = () => {
|
||||
this.setState({
|
||||
showOpIcon: false
|
||||
isOpIconShown: false
|
||||
});
|
||||
}
|
||||
|
||||
toggleDialog = () => {
|
||||
this.setState({
|
||||
isConfirmUnlinkDialogOpen: !this.state.isConfirmUnlinkDialogOpen
|
||||
});
|
||||
}
|
||||
|
||||
@@ -92,14 +100,23 @@ class Item extends Component {
|
||||
e.preventDefault();
|
||||
|
||||
const data = this.props.data;
|
||||
if (data.is_desktop_client) {
|
||||
this.toggleDialog();
|
||||
} else {
|
||||
const wipeDevice = true;
|
||||
this.unlinkDevice(wipeDevice);
|
||||
}
|
||||
}
|
||||
|
||||
seafileAPI.unlinkDevice(data.platform, data.device_id).then((res) => {
|
||||
unlinkDevice = (wipeDevice) => {
|
||||
const data = this.props.data;
|
||||
seafileAPI.unlinkDevice(data.platform, data.device_id, wipeDevice).then((res) => {
|
||||
this.setState({
|
||||
unlinked: true
|
||||
});
|
||||
let msg_s = gettext('Successfully unlinked %(name)s.');
|
||||
msg_s = msg_s.replace('%(name)s', data.device_name);
|
||||
toaster.success(msg_s);
|
||||
let msg = gettext('Successfully unlinked %(name)s.');
|
||||
msg = msg.replace('%(name)s', data.device_name);
|
||||
toaster.success(msg);
|
||||
}).catch((error) => {
|
||||
let errMessage = Utils.getErrorMsg(error);
|
||||
toaster.danger(errMessage);
|
||||
@@ -114,7 +131,7 @@ class Item extends Component {
|
||||
const data = this.props.data;
|
||||
|
||||
let opClasses = 'sf2-icon-delete unlink-device action-icon';
|
||||
opClasses += this.state.showOpIcon ? '' : ' invisible';
|
||||
opClasses += this.state.isOpIconShown ? '' : ' invisible';
|
||||
|
||||
const desktopItem = (
|
||||
<tr onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}>
|
||||
@@ -156,7 +173,17 @@ class Item extends Component {
|
||||
</tr>
|
||||
);
|
||||
|
||||
return this.props.isDesktop ? desktopItem : mobileItem;
|
||||
return (
|
||||
<React.Fragment>
|
||||
{this.props.isDesktop ? desktopItem : mobileItem}
|
||||
{this.state.isConfirmUnlinkDialogOpen &&
|
||||
<ConfirmUnlinkDeviceDialog
|
||||
executeOperation={this.unlinkDevice}
|
||||
toggleDialog={this.toggleDialog}
|
||||
/>
|
||||
}
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,7 @@ class OrgAdminList extends React.Component {
|
||||
{orgAdminUsers.map(item => {
|
||||
return (
|
||||
<UserItem
|
||||
key={item.id}
|
||||
key={item.index}
|
||||
user={item}
|
||||
currentTab="admins"
|
||||
isItemFreezed={this.state.isItemFreezed}
|
||||
|
@@ -55,13 +55,13 @@ class UserItem extends React.Component {
|
||||
}
|
||||
|
||||
toggleResetPW = () => {
|
||||
const email = this.props.user.email;
|
||||
const { email, name } = this.props.user;
|
||||
toaster.success(gettext('Resetting user\'s password, please wait for a moment.'));
|
||||
seafileAPI.orgAdminResetOrgUserPassword(orgID, email).then(res => {
|
||||
let msg;
|
||||
msg = gettext('Successfully reset password to %(passwd)s for user %(user)s.');
|
||||
msg = msg.replace('%(passwd)s', res.data.new_password);
|
||||
msg = msg.replace('%(user)s', email);
|
||||
msg = msg.replace('%(user)s', name);
|
||||
toaster.success(msg, {
|
||||
duration: 15
|
||||
});
|
||||
@@ -122,6 +122,17 @@ class UserItem extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
getQuotaTotal = (data) => {
|
||||
switch (data) {
|
||||
case -1: // failed to fetch quota
|
||||
return gettext('Failed');
|
||||
case -2:
|
||||
return '--';
|
||||
default: // data > 0
|
||||
return Utils.formatSize({bytes: data});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let { user, currentTab } = this.props;
|
||||
let href = siteRoot + 'org/useradmin/info/' + encodeURIComponent(user.email) + '/';
|
||||
@@ -141,7 +152,7 @@ class UserItem extends React.Component {
|
||||
onStatusChanged={this.changeStatus}
|
||||
/>
|
||||
</td>
|
||||
<td>{`${user.self_usage} / ${user.quota || '--'}`}</td>
|
||||
<td>{`${Utils.formatSize({bytes: user.quota_usage})} / ${this.getQuotaTotal(user.quota_total)}`}</td>
|
||||
<td>
|
||||
{user.ctime} /
|
||||
<br />
|
||||
|
@@ -71,10 +71,10 @@ class OrgUsersList extends React.Component {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{orgUsers.map(item => {
|
||||
{orgUsers.map((item, index) => {
|
||||
return (
|
||||
<UserItem
|
||||
key={item.id}
|
||||
key={index}
|
||||
user={item}
|
||||
currentTab="users"
|
||||
isItemFreezed={this.state.isItemFreezed}
|
||||
|
@@ -1,17 +1,18 @@
|
||||
import React, { Component, Fragment } from 'react';
|
||||
import { Link } from '@reach/router';
|
||||
import moment from 'moment';
|
||||
import { Button } from 'reactstrap';
|
||||
import { seafileAPI } from '../../../utils/seafile-api';
|
||||
import { gettext, siteRoot } from '../../../utils/constants';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
import EmptyTip from '../../../components/empty-tip';
|
||||
import moment from 'moment';
|
||||
import { Button } from 'reactstrap';
|
||||
import Loading from '../../../components/loading';
|
||||
import Paginator from '../../../components/paginator';
|
||||
import LogsNav from './logs-nav';
|
||||
import MainPanelTopbar from '../main-panel-topbar';
|
||||
import UserLink from '../user-link';
|
||||
import LogsExportExcelDialog from '../../../components/dialog/sysadmin-dialog/sysadmin-logs-export-excel-dialog';
|
||||
import ModalPortal from '../../../components/modal-portal';
|
||||
import EmptyTip from '../../../components/empty-tip';
|
||||
import Loading from '../../../components/loading';
|
||||
import Paginator from '../../../components/paginator';
|
||||
import MainPanelTopbar from '../main-panel-topbar';
|
||||
import UserLink from '../user-link';
|
||||
import LogsNav from './logs-nav';
|
||||
|
||||
class Content extends Component {
|
||||
|
||||
@@ -44,9 +45,9 @@ class Content extends Component {
|
||||
<table className="table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%">{gettext('Share From')}</th>
|
||||
<th width="10%">{gettext('Share To')}</th>
|
||||
<th width="20%">{gettext('Actions')}</th>
|
||||
<th width="15%">{gettext('Share From')}</th>
|
||||
<th width="15%">{gettext('Share To')}</th>
|
||||
<th width="10%">{gettext('Actions')}</th>
|
||||
<th width="13%">{gettext('Permission')}</th>
|
||||
<th width="20%">{gettext('Library')}</th>
|
||||
<th width="12%">{gettext('Folder')}</th>
|
||||
@@ -112,12 +113,27 @@ class Item extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
getShareTo = (item) => {
|
||||
switch(item.share_type) {
|
||||
case 'user':
|
||||
return <UserLink email={item.to_user_email} name={item.to_user_name} />;
|
||||
case 'group':
|
||||
return <Link to={`${siteRoot}sys/groups/${item.to_group_id}/libraries/`}>{item.to_group_name}</Link>;
|
||||
case 'department':
|
||||
return <Link to={`${siteRoot}sys/departments/${item.to_group_id}/`}>{item.to_group_name}</Link>;
|
||||
case 'all':
|
||||
return <Link to={`${siteRoot}org/`}>{gettext('All')}</Link>;
|
||||
default:
|
||||
return gettext('Deleted');
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let { item } = this.props;
|
||||
return (
|
||||
<tr onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}>
|
||||
<td><UserLink email={item.from_user_email} name={item.from_user_name} /></td>
|
||||
<td><UserLink email={item.to_user_email} name={item.to_user_name} /></td>
|
||||
<td>{this.getShareTo(item)}</td>
|
||||
<td>{this.getActionTextByEType(item.etype)}</td>
|
||||
<td>{Utils.sharePerms(item.permission)}</td>
|
||||
<td>{item.repo_name ? item.repo_name : gettext('Deleted')}</td>
|
||||
|
@@ -10,19 +10,20 @@ import Loading from '../../../components/loading';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
import toaster from '../../../components/toast';
|
||||
|
||||
class TrafficOrganizationsTable extends React.Component {
|
||||
class OrgsTraffic extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
userTrafficList: [],
|
||||
orgTrafficList: [],
|
||||
perPage: 25,
|
||||
currentPage: 1,
|
||||
hasNextPage: false,
|
||||
month: moment().format('YYYYMM'),
|
||||
isLoading: false,
|
||||
errorMessage: '',
|
||||
sortOrder: 'asc'
|
||||
sortBy: 'link_file_download',
|
||||
sortOrder: 'desc'
|
||||
};
|
||||
this.initPage = 1;
|
||||
this.initMonth = moment().format('YYYYMM');
|
||||
@@ -35,16 +36,16 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
perPage: parseInt(urlParams.get('per_page') || perPage),
|
||||
currentPage: parseInt(urlParams.get('page') || currentPage)
|
||||
}, () => {
|
||||
this.onGenerateReports(this.initMonth, this.state.currentPage);
|
||||
this.getTrafficList(this.initMonth, this.state.currentPage);
|
||||
});
|
||||
}
|
||||
|
||||
getPreviousPage = () => {
|
||||
this.onGenerateReports(this.state.month, this.state.currentPage - 1);
|
||||
this.getTrafficList(this.state.month, this.state.currentPage - 1);
|
||||
}
|
||||
|
||||
getNextPage = () => {
|
||||
this.onGenerateReports(this.state.month, this.state.currentPage + 1);
|
||||
this.getTrafficList(this.state.month, this.state.currentPage + 1);
|
||||
}
|
||||
|
||||
handleChange = (e) => {
|
||||
@@ -65,28 +66,22 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.onGenerateReports(month, this.initPage);
|
||||
this.getTrafficList(month, this.initPage);
|
||||
e.target.blur();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
sortBySize = (sortByType, sortOrder) => {
|
||||
let { userTrafficList } = this.state;
|
||||
let newUserTrafficList = Utils.sortTraffic(userTrafficList, sortByType, sortOrder);
|
||||
this.setState({
|
||||
userTrafficList: newUserTrafficList,
|
||||
sortOrder: sortOrder
|
||||
});
|
||||
}
|
||||
|
||||
onGenerateReports = (month, page) => {
|
||||
let { perPage } = this.state;
|
||||
getTrafficList = (month, page) => {
|
||||
const { perPage, sortBy, sortOrder } = this.state;
|
||||
const orderBy = `${sortBy}_${sortOrder}`;
|
||||
this.setState({isLoading: true, errorMessage: ''});
|
||||
seafileAPI.sysAdminListOrgTraffic(month, page, perPage).then(res => {
|
||||
let userTrafficList = res.data.org_monthly_traffic_list.slice(0);
|
||||
seafileAPI.sysAdminListOrgTraffic(month, page, perPage, orderBy).then(res => {
|
||||
let orgTrafficList = res.data.org_monthly_traffic_list.slice(0);
|
||||
this.setState({
|
||||
userTrafficList: userTrafficList,
|
||||
month: month,
|
||||
currentPage: page,
|
||||
orgTrafficList: orgTrafficList,
|
||||
hasNextPage: res.data.has_next_page,
|
||||
isLoading: false
|
||||
});
|
||||
@@ -96,14 +91,28 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
sortItems = (sortBy) => {
|
||||
this.setState({
|
||||
sortBy: sortBy,
|
||||
sortOrder: this.state.sortOrder == 'asc' ? 'desc' : 'asc'
|
||||
}, () => {
|
||||
const { month, currentPage } = this.state;
|
||||
this.getTrafficList(month, currentPage);
|
||||
});
|
||||
}
|
||||
|
||||
resetPerPage = (newPerPage) => {
|
||||
this.setState({
|
||||
perPage: newPerPage,
|
||||
}, () => this.onGenerateReports(this.initPage, this.initMonth));
|
||||
}, () => this.getTrafficList(this.initPage, this.initMonth));
|
||||
}
|
||||
|
||||
render() {
|
||||
let { userTrafficList, currentPage, hasNextPage, perPage, isLoading, errorMessage, sortOrder } = this.state;
|
||||
const {
|
||||
isLoading, errorMessage, orgTrafficList,
|
||||
currentPage, hasNextPage, perPage,
|
||||
sortBy, sortOrder
|
||||
} = this.state;
|
||||
return (
|
||||
<Fragment>
|
||||
<div className="d-flex align-items-center mt-4">
|
||||
@@ -118,8 +127,8 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
</div>
|
||||
{isLoading && <Loading />}
|
||||
{!isLoading &&
|
||||
<TrafficTable type={'org'} sortOrder={sortOrder} sortBySize={this.sortBySize} >
|
||||
{userTrafficList.length > 0 && userTrafficList.map((item, index) => {
|
||||
<TrafficTable type={'org'} sortItems={this.sortItems} sortBy={sortBy} sortOrder={sortOrder}>
|
||||
{orgTrafficList.length > 0 && orgTrafficList.map((item, index) => {
|
||||
return(
|
||||
<TrafficTableBody
|
||||
key={index}
|
||||
@@ -143,4 +152,4 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default TrafficOrganizationsTable;
|
||||
export default OrgsTraffic;
|
@@ -10,7 +10,7 @@ import { gettext } from '../../../utils/constants';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
import toaster from '../../../components/toast';
|
||||
|
||||
class TrafficOrganizationsTable extends React.Component {
|
||||
class UsersTraffic extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@@ -22,7 +22,8 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
month: moment().format('YYYYMM'),
|
||||
isLoading: false,
|
||||
errorMessage: '',
|
||||
sortOrder: 'asc'
|
||||
sortBy: 'link_file_download',
|
||||
sortOrder: 'desc'
|
||||
};
|
||||
this.initPage = 1;
|
||||
this.initMonth = moment().format('YYYYMM');
|
||||
@@ -35,16 +36,16 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
perPage: parseInt(urlParams.get('per_page') || perPage),
|
||||
currentPage: parseInt(urlParams.get('page') || currentPage)
|
||||
}, () => {
|
||||
this.onGenerateReports(this.initMonth, this.state.currentPage);
|
||||
});
|
||||
this.getTrafficList(this.initMonth, this.state.currentPage);
|
||||
});
|
||||
}
|
||||
|
||||
getPreviousPage = () => {
|
||||
this.onGenerateReports(this.state.month, this.state.currentPage - 1);
|
||||
this.getTrafficList(this.state.month, this.state.currentPage - 1);
|
||||
}
|
||||
|
||||
getNextPage = () => {
|
||||
this.onGenerateReports(this.state.month, this.state.currentPage + 1);
|
||||
this.getTrafficList(this.state.month, this.state.currentPage + 1);
|
||||
}
|
||||
|
||||
handleChange = (e) => {
|
||||
@@ -54,15 +55,6 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
sortBySize = (sortByType, sortOrder) => {
|
||||
let { userTrafficList } = this.state;
|
||||
let newUserTrafficList = Utils.sortTraffic(userTrafficList, sortByType, sortOrder);
|
||||
this.setState({
|
||||
userTrafficList: newUserTrafficList,
|
||||
sortOrder: sortOrder
|
||||
});
|
||||
}
|
||||
|
||||
handleKeyPress = (e) => {
|
||||
let { month } = this.state;
|
||||
if (e.key === 'Enter') {
|
||||
@@ -74,21 +66,24 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.onGenerateReports(month, this.initPage);
|
||||
this.getTrafficList(month, this.initPage);
|
||||
e.target.blur();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
onGenerateReports = (month, page) => {
|
||||
let { perPage } = this.state;
|
||||
getTrafficList = (month, page) => {
|
||||
const { perPage, sortBy, sortOrder } = this.state;
|
||||
const orderBy = `${sortBy}_${sortOrder}`;
|
||||
this.setState({
|
||||
isLoading: true,
|
||||
errorMessage: ''
|
||||
});
|
||||
seafileAPI.sysAdminListUserTraffic(month, page, perPage).then(res => {
|
||||
seafileAPI.sysAdminListUserTraffic(month, page, perPage, orderBy).then(res => {
|
||||
let userTrafficList = res.data.user_monthly_traffic_list.slice(0);
|
||||
this.setState({
|
||||
month: month,
|
||||
currentPage: page,
|
||||
userTrafficList: userTrafficList,
|
||||
hasNextPage: res.data.has_next_page,
|
||||
isLoading: false
|
||||
@@ -99,14 +94,28 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
sortItems = (sortBy) => {
|
||||
this.setState({
|
||||
sortBy: sortBy,
|
||||
sortOrder: this.state.sortOrder == 'asc' ? 'desc' : 'asc'
|
||||
}, () => {
|
||||
const { month, currentPage } = this.state;
|
||||
this.getTrafficList(month, currentPage);
|
||||
});
|
||||
}
|
||||
|
||||
resetPerPage = (newPerPage) => {
|
||||
this.setState({
|
||||
perPage: newPerPage,
|
||||
}, () => this.onGenerateReports(this.initMonth, this.initPage));
|
||||
}, () => this.getTrafficList(this.initMonth, this.initPage));
|
||||
}
|
||||
|
||||
render() {
|
||||
let { userTrafficList, currentPage, hasNextPage, perPage, isLoading, errorMessage, sortOrder } = this.state;
|
||||
const {
|
||||
isLoading, errorMessage, userTrafficList,
|
||||
currentPage, hasNextPage, perPage,
|
||||
sortBy, sortOrder
|
||||
} = this.state;
|
||||
return (
|
||||
<Fragment>
|
||||
<div className="d-flex align-items-center mt-4">
|
||||
@@ -121,7 +130,7 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
</div>
|
||||
{isLoading && <Loading />}
|
||||
{!isLoading &&
|
||||
<TrafficTable type={'user'} sortBySize={this.sortBySize} sortOrder={sortOrder}>
|
||||
<TrafficTable type={'user'} sortItems={this.sortItems} sortBy={sortBy} sortOrder={sortOrder}>
|
||||
{userTrafficList.length > 0 && userTrafficList.map((item, index) => {
|
||||
return(
|
||||
<TrafficTableBody
|
||||
@@ -146,4 +155,4 @@ class TrafficOrganizationsTable extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default TrafficOrganizationsTable;
|
||||
export default UsersTraffic;
|
@@ -6,8 +6,8 @@ import MainPanelTopbar from '../main-panel-topbar';
|
||||
import StatisticNav from './statistic-nav';
|
||||
import StatisticCommonTool from './statistic-common-tool';
|
||||
import Loading from '../../../components/loading';
|
||||
import TrafficOrganizationsTable from './traffic-organizations-table';
|
||||
import TrafficUserTable from './traffic-user-table';
|
||||
import OrgsTraffic from './statistic-traffic-orgs';
|
||||
import UsersTraffic from './statistic-traffic-users';
|
||||
import StatisticChart from './statistic-chart';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
import toaster from '../../../components/toast';
|
||||
@@ -204,10 +204,10 @@ class StatisticTraffic extends React.Component {
|
||||
</div>
|
||||
}
|
||||
{!isLoading && tabActive === 'user' &&
|
||||
<TrafficUserTable />
|
||||
<UsersTraffic />
|
||||
}
|
||||
{!isLoading && tabActive === 'organizations' &&
|
||||
<TrafficOrganizationsTable />
|
||||
<OrgsTraffic />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -4,6 +4,9 @@ import { gettext } from '../../../utils/constants';
|
||||
|
||||
const propTypes = {
|
||||
type: PropTypes.string.isRequired,
|
||||
sortBy: PropTypes.string.isRequired,
|
||||
sortOrder: PropTypes.string.isRequired,
|
||||
sortItems: PropTypes.func.isRequired,
|
||||
children: PropTypes.oneOfType([PropTypes.bool, PropTypes.array]),
|
||||
};
|
||||
|
||||
@@ -11,30 +14,10 @@ class TrafficTable extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
showIconName: 'link_file_download'
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
let { showIconName } = this.state;
|
||||
let { sortOrder } = this.props;
|
||||
this.props.sortBySize(showIconName, sortOrder);
|
||||
}
|
||||
|
||||
sortBySize = (sortByType) => {
|
||||
let { sortOrder } = this.props;
|
||||
let newSortOrder = sortOrder === 'asc' ? 'desc' : 'asc';
|
||||
this.setState({
|
||||
showIconName: sortByType
|
||||
});
|
||||
|
||||
this.props.sortBySize(sortByType, newSortOrder);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { type, sortOrder } = this.props;
|
||||
const { showIconName } = this.state;
|
||||
const { type, sortBy, sortOrder } = this.props;
|
||||
const sortIcon = sortOrder == 'asc' ? <span className="fas fa-caret-up"></span> : <span className="fas fa-caret-down"></span>;
|
||||
|
||||
return (
|
||||
@@ -42,12 +25,12 @@ class TrafficTable extends React.Component {
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="16%">{type == 'user' ? gettext('User') : gettext('Organization')}</th>
|
||||
<th width="11%"><div className="d-block table-sort-op cursor-pointer" onClick={this.sortBySize.bind(this, 'sync_file_upload')}>{gettext('Sync Upload')} {showIconName === 'sync_file_upload' && sortIcon}</div></th>
|
||||
<th width="14%"><div className="d-block table-sort-op cursor-pointer" onClick={this.sortBySize.bind(this, 'sync_file_donwload')}>{gettext('Sync Download')} {showIconName === 'sync_file_donwload' && sortIcon}</div></th>
|
||||
<th width="11%"><div className="d-block table-sort-op cursor-pointer" onClick={this.sortBySize.bind(this, 'web_file_upload')}>{gettext('Web Upload')} {showIconName === 'web_file_upload' && sortIcon}</div></th>
|
||||
<th width="14%"><div className="d-block table-sort-op cursor-pointer" onClick={this.sortBySize.bind(this, 'web_file_download')}>{gettext('Web Download')} {showIconName === 'web_file_download' && sortIcon}</div></th>
|
||||
<th width="17%"><div className="d-block table-sort-op cursor-pointer" onClick={this.sortBySize.bind(this, 'link_file_upload')}>{gettext('Share link upload')} {showIconName === 'link_file_upload' && sortIcon}</div></th>
|
||||
<th width="17%"><div className="d-block table-sort-op cursor-pointer" onClick={this.sortBySize.bind(this, 'link_file_download')}>{gettext('Share link download')} {showIconName === 'link_file_download' && sortIcon}</div></th>
|
||||
<th width="11%"><div className="d-block table-sort-op cursor-pointer" onClick={this.props.sortItems.bind(this, 'sync_file_upload')}>{gettext('Sync Upload')} {sortBy === 'sync_file_upload' && sortIcon}</div></th>
|
||||
<th width="14%"><div className="d-block table-sort-op cursor-pointer" onClick={this.props.sortItems.bind(this, 'sync_file_download')}>{gettext('Sync Download')} {sortBy === 'sync_file_download' && sortIcon}</div></th>
|
||||
<th width="11%"><div className="d-block table-sort-op cursor-pointer" onClick={this.props.sortItems.bind(this, 'web_file_upload')}>{gettext('Web Upload')} {sortBy === 'web_file_upload' && sortIcon}</div></th>
|
||||
<th width="14%"><div className="d-block table-sort-op cursor-pointer" onClick={this.props.sortItems.bind(this, 'web_file_download')}>{gettext('Web Download')} {sortBy === 'web_file_download' && sortIcon}</div></th>
|
||||
<th width="17%"><div className="d-block table-sort-op cursor-pointer" onClick={this.props.sortItems.bind(this, 'link_file_upload')}>{gettext('Share link upload')} {sortBy === 'link_file_upload' && sortIcon}</div></th>
|
||||
<th width="17%"><div className="d-block table-sort-op cursor-pointer" onClick={this.props.sortItems.bind(this, 'link_file_download')}>{gettext('Share link download')} {sortBy === 'link_file_download' && sortIcon}</div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
Reference in New Issue
Block a user