2018-09-29 10:32:53 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2018-10-25 05:36:06 +00:00
|
|
|
import { gettext } from '../../utils/constants';
|
2018-09-29 10:32:53 +00:00
|
|
|
import TreeDirList from './tree-dir-list';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
node: PropTypes.object.isRequired,
|
|
|
|
onMainNodeClick: PropTypes.func.isRequired,
|
2018-10-16 10:19:51 +00:00
|
|
|
};
|
2018-09-04 09:16:50 +00:00
|
|
|
|
|
|
|
class TreeDirView extends React.Component {
|
2018-09-29 07:47:53 +00:00
|
|
|
|
2018-09-04 09:16:50 +00:00
|
|
|
render() {
|
|
|
|
let node = this.props.node;
|
|
|
|
let children = node.hasChildren() ? node.children : null;
|
|
|
|
|
|
|
|
return (
|
2018-09-21 06:16:15 +00:00
|
|
|
<div className="table-container">
|
|
|
|
<table>
|
|
|
|
<thead>
|
2018-10-25 05:36:06 +00:00
|
|
|
<tr>
|
|
|
|
<th style={{width: '4%'}}></th>
|
|
|
|
<th style={{width: '66%'}}>{gettext('Name')}</th>
|
|
|
|
<th style={{width: '15%'}}>{gettext('Size')}</th>
|
|
|
|
<th style={{width: '15%'}}>{gettext('Last Update')}</th>
|
|
|
|
</tr>
|
2018-09-21 06:16:15 +00:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{children && children.map((node, index) => {
|
|
|
|
return (
|
2018-10-25 05:36:06 +00:00
|
|
|
<TreeDirList key={index} node={node} onMainNodeClick={this.props.onMainNodeClick}/>
|
2018-09-29 10:32:53 +00:00
|
|
|
);
|
2018-09-21 06:16:15 +00:00
|
|
|
})}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2018-09-29 10:32:53 +00:00
|
|
|
);
|
2018-09-04 09:16:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-29 10:32:53 +00:00
|
|
|
TreeDirView.propTypes = propTypes;
|
|
|
|
|
2018-09-04 09:16:50 +00:00
|
|
|
export default TreeDirView;
|