1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-05 19:26:30 +00:00

[system admin] bugfix for 'statistics' & 'institution admin' (#4315)

* [system admin] bugfix for 'statistics' & 'institution admin'

* [system admin] bugfix for 'statistics'
This commit is contained in:
llj 2019-11-28 14:09:27 +08:00 committed by Daniel Pan
parent b52b6d25f0
commit 0717e105f7
4 changed files with 24 additions and 41 deletions

View File

@ -119,19 +119,13 @@ class Item extends Component {
}
revokeAdmin = () => {
this.props.revokeAdmin(this.props.item.email);
this.props.revokeAdmin(this.props.item);
}
onMenuItemClick = (operation) => {
switch (operation) {
case 'Delete':
this.props.deleteUser(this.props.item.email);
break;
case 'Set Admin':
this.props.setAdmin(this.props.item.email);
break;
case 'Revoke Admin':
this.props.revokeAdmin(this.props.item.email);
this.toggleRevokeAdminDialog();
break;
}
}
@ -150,6 +144,9 @@ class Item extends Component {
const { item } = this.props;
const { isOpIconShown, isRevokeAdminDialogOpen } = this.state;
const itemName = '<span class="op-target">' + Utils.HTMLescape(item.name) + '</span>';
const revokeAdminDialogMsg = gettext('Are you sure you want to revoke the admin permission of {placeholder} ?').replace('{placeholder}', itemName);
return (
<Fragment>
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
@ -178,8 +175,9 @@ class Item extends Component {
{isRevokeAdminDialogOpen &&
<CommonOperationConfirmationDialog
title={gettext('Revoke Admin')}
message={gettext('Sure ?')}
message={revokeAdminDialogMsg}
executeOperation={this.revokeAdmin}
confirmBtnText={gettext('Revoke')}
toggleDialog={this.toggleRevokeAdminDialog}
/>
}
@ -235,13 +233,15 @@ class InstitutionAdmins extends Component {
});
}
revokeAdmin = (email) => {
revokeAdmin = (item) => {
const email = item.email;
const name = item.name;
seafileAPI.sysAdminUpdateInstitutionUser(this.props.institutionID, email, false).then(res => {
let userList = this.state.userList.filter(user => {
return user.email != email;
});
this.setState({userList: userList});
toaster.success(gettext('Success'));
toaster.success(gettext('Successfully revoked the admin permission of {placeholder}'.replace('{placeholder}', name)));
}).catch((error) => {
let errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage);

View File

@ -41,22 +41,22 @@ class StatisticFile extends React.Component {
visited.push(item.visited);
});
let addedData = {
label: gettext('added'),
label: gettext('Added'),
data: added,
borderColor: '#57cd6b',
backgroundColor: '#57cd6b'};
let visitedData = {
label: gettext('visited'),
label: gettext('Visited'),
data: visited,
borderColor: '#fd913a',
backgroundColor: '#fd913a'};
let modifiedData = {
label: gettext('modified'),
label: gettext('Modified'),
data: modified,
borderColor: '#72c3fc',
backgroundColor: '#72c3fc'};
let deletedData = {
label: gettext('deleted'),
label: gettext('Deleted'),
data: deleted,
borderColor: '#f75356',
backgroundColor: '#f75356'};
@ -100,4 +100,4 @@ class StatisticFile extends React.Component {
}
}
export default StatisticFile;
export default StatisticFile;

View File

@ -33,7 +33,7 @@ class StatisticStorage extends React.Component {
totalStorage.push(item.total_storage);
});
let total_storage = {
label: gettext('Total storage space'),
label: gettext('Total Storage'),
data: totalStorage,
borderColor: '#fd913a',
backgroundColor: '#fd913a'};
@ -78,4 +78,4 @@ class StatisticStorage extends React.Component {
}
}
export default StatisticStorage;
export default StatisticStorage;

View File

@ -22,20 +22,6 @@ class TrafficTable extends React.Component {
this.props.sortBySize(showIconName, sortOrder);
}
getTrafficTypeName = () => {
let { type } = this.props;
let trafficTypeName;
switch(type) {
case 'user':
trafficTypeName = 'User';
break;
case 'org':
trafficTypeName = 'Org';
break;
}
return trafficTypeName;
}
sortBySize = (sortByType) => {
let { sortOrder } = this.props;
let newSortOrder = sortOrder === 'asc' ? 'desc' : 'asc';
@ -47,24 +33,21 @@ class TrafficTable extends React.Component {
}
render() {
let { sortOrder } = this.props;
let { showIconName } = this.state;
let trafficTypeName = this.getTrafficTypeName();
const { type, sortOrder } = this.props;
const { showIconName } = this.state;
const sortIcon = sortOrder == 'asc' ? <span className="fas fa-caret-up"></span> : <span className="fas fa-caret-down"></span>;
return (
<table className="table-hover">
<thead>
<tr>
<th width="16%">{gettext('{trafficTypeName}').replace('{trafficTypeName}', trafficTypeName)}</th>
<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('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('Link Download')} {showIconName === 'link_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>
</tr>
</thead>
<tbody>
@ -77,4 +60,4 @@ class TrafficTable extends React.Component {
TrafficTable.propTypes = propTypes;
export default TrafficTable;
export default TrafficTable;