mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-06 19:49:29 +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:
parent
b52b6d25f0
commit
0717e105f7
@ -119,19 +119,13 @@ class Item extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
revokeAdmin = () => {
|
revokeAdmin = () => {
|
||||||
this.props.revokeAdmin(this.props.item.email);
|
this.props.revokeAdmin(this.props.item);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMenuItemClick = (operation) => {
|
onMenuItemClick = (operation) => {
|
||||||
switch (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':
|
case 'Revoke Admin':
|
||||||
this.props.revokeAdmin(this.props.item.email);
|
this.toggleRevokeAdminDialog();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,6 +144,9 @@ class Item extends Component {
|
|||||||
const { item } = this.props;
|
const { item } = this.props;
|
||||||
const { isOpIconShown, isRevokeAdminDialogOpen } = this.state;
|
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 (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
|
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
|
||||||
@ -178,8 +175,9 @@ class Item extends Component {
|
|||||||
{isRevokeAdminDialogOpen &&
|
{isRevokeAdminDialogOpen &&
|
||||||
<CommonOperationConfirmationDialog
|
<CommonOperationConfirmationDialog
|
||||||
title={gettext('Revoke Admin')}
|
title={gettext('Revoke Admin')}
|
||||||
message={gettext('Sure ?')}
|
message={revokeAdminDialogMsg}
|
||||||
executeOperation={this.revokeAdmin}
|
executeOperation={this.revokeAdmin}
|
||||||
|
confirmBtnText={gettext('Revoke')}
|
||||||
toggleDialog={this.toggleRevokeAdminDialog}
|
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 => {
|
seafileAPI.sysAdminUpdateInstitutionUser(this.props.institutionID, email, false).then(res => {
|
||||||
let userList = this.state.userList.filter(user => {
|
let userList = this.state.userList.filter(user => {
|
||||||
return user.email != email;
|
return user.email != email;
|
||||||
});
|
});
|
||||||
this.setState({userList: userList});
|
this.setState({userList: userList});
|
||||||
toaster.success(gettext('Success'));
|
toaster.success(gettext('Successfully revoked the admin permission of {placeholder}'.replace('{placeholder}', name)));
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
let errMessage = Utils.getErrorMsg(error);
|
let errMessage = Utils.getErrorMsg(error);
|
||||||
toaster.danger(errMessage);
|
toaster.danger(errMessage);
|
||||||
|
@ -41,22 +41,22 @@ class StatisticFile extends React.Component {
|
|||||||
visited.push(item.visited);
|
visited.push(item.visited);
|
||||||
});
|
});
|
||||||
let addedData = {
|
let addedData = {
|
||||||
label: gettext('added'),
|
label: gettext('Added'),
|
||||||
data: added,
|
data: added,
|
||||||
borderColor: '#57cd6b',
|
borderColor: '#57cd6b',
|
||||||
backgroundColor: '#57cd6b'};
|
backgroundColor: '#57cd6b'};
|
||||||
let visitedData = {
|
let visitedData = {
|
||||||
label: gettext('visited'),
|
label: gettext('Visited'),
|
||||||
data: visited,
|
data: visited,
|
||||||
borderColor: '#fd913a',
|
borderColor: '#fd913a',
|
||||||
backgroundColor: '#fd913a'};
|
backgroundColor: '#fd913a'};
|
||||||
let modifiedData = {
|
let modifiedData = {
|
||||||
label: gettext('modified'),
|
label: gettext('Modified'),
|
||||||
data: modified,
|
data: modified,
|
||||||
borderColor: '#72c3fc',
|
borderColor: '#72c3fc',
|
||||||
backgroundColor: '#72c3fc'};
|
backgroundColor: '#72c3fc'};
|
||||||
let deletedData = {
|
let deletedData = {
|
||||||
label: gettext('deleted'),
|
label: gettext('Deleted'),
|
||||||
data: deleted,
|
data: deleted,
|
||||||
borderColor: '#f75356',
|
borderColor: '#f75356',
|
||||||
backgroundColor: '#f75356'};
|
backgroundColor: '#f75356'};
|
||||||
|
@ -33,7 +33,7 @@ class StatisticStorage extends React.Component {
|
|||||||
totalStorage.push(item.total_storage);
|
totalStorage.push(item.total_storage);
|
||||||
});
|
});
|
||||||
let total_storage = {
|
let total_storage = {
|
||||||
label: gettext('Total storage space'),
|
label: gettext('Total Storage'),
|
||||||
data: totalStorage,
|
data: totalStorage,
|
||||||
borderColor: '#fd913a',
|
borderColor: '#fd913a',
|
||||||
backgroundColor: '#fd913a'};
|
backgroundColor: '#fd913a'};
|
||||||
|
@ -22,20 +22,6 @@ class TrafficTable extends React.Component {
|
|||||||
this.props.sortBySize(showIconName, sortOrder);
|
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) => {
|
sortBySize = (sortByType) => {
|
||||||
let { sortOrder } = this.props;
|
let { sortOrder } = this.props;
|
||||||
let newSortOrder = sortOrder === 'asc' ? 'desc' : 'asc';
|
let newSortOrder = sortOrder === 'asc' ? 'desc' : 'asc';
|
||||||
@ -47,24 +33,21 @@ class TrafficTable extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let { sortOrder } = this.props;
|
const { type, sortOrder } = this.props;
|
||||||
let { showIconName } = this.state;
|
const { showIconName } = this.state;
|
||||||
|
|
||||||
let trafficTypeName = this.getTrafficTypeName();
|
|
||||||
|
|
||||||
const sortIcon = sortOrder == 'asc' ? <span className="fas fa-caret-up"></span> : <span className="fas fa-caret-down"></span>;
|
const sortIcon = sortOrder == 'asc' ? <span className="fas fa-caret-up"></span> : <span className="fas fa-caret-down"></span>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<table className="table-hover">
|
<table className="table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<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="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="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="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="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_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('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_download')}>{gettext('Share link download')} {showIconName === 'link_file_download' && sortIcon}</div></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
Loading…
Reference in New Issue
Block a user