2022-11-10 05:27:55 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { Utils } from '../../../utils/utils';
|
|
|
|
import { siteRoot } from '../../../utils/constants';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
type: PropTypes.string.isRequired,
|
|
|
|
userTrafficItem: PropTypes.object.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
class TrafficTableBody extends React.Component {
|
|
|
|
|
|
|
|
trafficName = () => {
|
|
|
|
let { userTrafficItem, type } = this.props;
|
|
|
|
switch(type) {
|
|
|
|
case 'user':
|
|
|
|
if (userTrafficItem.name) {
|
|
|
|
return (
|
2024-06-14 07:49:14 +00:00
|
|
|
<a href={siteRoot + 'org/useradmin/info/' + userTrafficItem.email + '/'}>{userTrafficItem.name}</a>
|
2022-11-10 05:27:55 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
return(<span>{'--'}</span>);
|
|
|
|
case 'org':
|
|
|
|
return(<span>{userTrafficItem.org_name}</span>);
|
|
|
|
}
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2022-11-10 05:27:55 +00:00
|
|
|
|
|
|
|
render() {
|
|
|
|
let { userTrafficItem } = this.props;
|
|
|
|
|
|
|
|
let syncUploadSize = Utils.bytesToSize(userTrafficItem.sync_file_upload);
|
|
|
|
let syncDownloadSize = Utils.bytesToSize(userTrafficItem.sync_file_download);
|
|
|
|
let webUploadSize = Utils.bytesToSize(userTrafficItem.web_file_upload);
|
|
|
|
let webDownloadSize = Utils.bytesToSize(userTrafficItem.web_file_download);
|
|
|
|
let linkUploadSize = Utils.bytesToSize(userTrafficItem.link_file_upload);
|
|
|
|
let linkDownloadSize = Utils.bytesToSize(userTrafficItem.link_file_download);
|
|
|
|
|
|
|
|
return(
|
|
|
|
<tr>
|
|
|
|
<td>{this.trafficName()}</td>
|
|
|
|
<td>{syncUploadSize}</td>
|
|
|
|
<td>{syncDownloadSize}</td>
|
|
|
|
<td>{webUploadSize}</td>
|
|
|
|
<td>{webDownloadSize}</td>
|
|
|
|
<td>{linkUploadSize}</td>
|
|
|
|
<td>{linkDownloadSize}</td>
|
|
|
|
</tr>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TrafficTableBody.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default TrafficTableBody;
|