2019-02-27 19:44:22 +08:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2019-05-05 15:18:54 +08:00
|
|
|
import { gettext } from '../../utils/constants';
|
2019-02-27 19:44:22 +08:00
|
|
|
import UserItem from './org-user-item';
|
|
|
|
|
|
|
|
import '../../css/org-admin-paginator.css';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
currentTab: PropTypes.string.isRequired,
|
2019-05-05 15:18:54 +08:00
|
|
|
toggleDelete: PropTypes.func.isRequired,
|
|
|
|
toggleRevokeAdmin: PropTypes.func.isRequired,
|
|
|
|
orgAdminUsers: PropTypes.array.isRequired,
|
2023-11-24 18:21:46 +08:00
|
|
|
changeStatus: PropTypes.func.isRequired,
|
2020-04-27 14:46:41 +08:00
|
|
|
initOrgAdmin: PropTypes.func.isRequired
|
2019-02-27 19:44:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class OrgAdminList extends React.Component {
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
2020-04-27 14:46:41 +08:00
|
|
|
isItemFreezed: false
|
2019-02-27 19:44:22 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
2019-05-05 15:18:54 +08:00
|
|
|
this.props.initOrgAdmin();
|
|
|
|
}
|
|
|
|
|
2019-02-27 19:44:22 +08:00
|
|
|
onFreezedItem = () => {
|
2024-07-18 11:58:42 +08:00
|
|
|
this.setState({ isItemFreezed: true });
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-02-27 19:44:22 +08:00
|
|
|
|
|
|
|
onUnfreezedItem = () => {
|
2024-07-18 11:58:42 +08:00
|
|
|
this.setState({ isItemFreezed: false });
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-02-27 19:44:22 +08:00
|
|
|
|
2023-11-24 18:21:46 +08:00
|
|
|
toggleItemFreezed = (isFreezed) => {
|
|
|
|
this.setState({ isItemFreezed: isFreezed });
|
|
|
|
};
|
|
|
|
|
2019-02-27 19:44:22 +08:00
|
|
|
render() {
|
2019-05-05 15:18:54 +08:00
|
|
|
let orgAdminUsers = this.props.orgAdminUsers;
|
2019-02-27 19:44:22 +08:00
|
|
|
|
|
|
|
return (
|
2019-03-15 16:30:20 +08:00
|
|
|
<div className="cur-view-content">
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th width="30%">{gettext('Name')}</th>
|
|
|
|
<th width="15%">{gettext('Status')}</th>
|
2020-04-27 14:46:41 +08:00
|
|
|
<th width="20%">{gettext('Space Used')} / {gettext('Quota')}</th>
|
|
|
|
<th width="25%">{gettext('Created At')} / {gettext('Last Login')}</th>
|
2024-07-18 11:58:42 +08:00
|
|
|
<th width="10%">{/* Operations*/}</th>
|
2019-03-15 16:30:20 +08:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2023-11-24 18:21:46 +08:00
|
|
|
{orgAdminUsers.map((item, index) => {
|
2019-02-27 19:44:22 +08:00
|
|
|
return (
|
2020-11-02 13:56:35 +08:00
|
|
|
<UserItem
|
2023-11-24 18:21:46 +08:00
|
|
|
key={index}
|
2019-02-27 19:44:22 +08:00
|
|
|
user={item}
|
2020-04-27 14:46:41 +08:00
|
|
|
currentTab="admins"
|
2019-02-27 19:44:22 +08:00
|
|
|
isItemFreezed={this.state.isItemFreezed}
|
2019-05-05 15:18:54 +08:00
|
|
|
toggleDelete={this.props.toggleDelete}
|
|
|
|
toggleRevokeAdmin={this.props.toggleRevokeAdmin}
|
2023-11-24 18:21:46 +08:00
|
|
|
changeStatus={this.props.changeStatus}
|
2019-02-27 19:44:22 +08:00
|
|
|
onFreezedItem={this.onFreezedItem}
|
|
|
|
onUnfreezedItem={this.onUnfreezedItem}
|
2023-11-24 18:21:46 +08:00
|
|
|
toggleItemFreezed={this.toggleItemFreezed}
|
2019-02-27 19:44:22 +08:00
|
|
|
/>
|
2019-04-03 16:54:24 +08:00
|
|
|
);
|
|
|
|
})}
|
2019-03-15 16:30:20 +08:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2019-02-27 19:44:22 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OrgAdminList.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default OrgAdminList;
|