mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 08:28:11 +00:00
polymerize create file events (#2888)
* polymerize create file events * use multiFilesActivity object * activities getmore * polymerize by user and repo * update algorithm * modify judging condition
This commit is contained in:
59
frontend/src/components/dialog/list-created-files-dialog.js
Normal file
59
frontend/src/components/dialog/list-created-files-dialog.js
Normal file
@@ -0,0 +1,59 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import moment from 'moment';
|
||||
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Table } from 'reactstrap';
|
||||
import { gettext, siteRoot } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
activity: PropTypes.object.isRequired,
|
||||
toggleCancel: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
class ListCreatedFileDialog extends React.Component {
|
||||
|
||||
toggle = (activity) => {
|
||||
this.props.toggleCancel(activity);
|
||||
}
|
||||
|
||||
render() {
|
||||
let activity = this.props.activity;
|
||||
return (
|
||||
<Modal isOpen={true}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('Created Files')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th width='50%'>{gettext('Name')}</th>
|
||||
<th width='25%'>{gettext('Library Name')}</th>
|
||||
<th width='25%'>{gettext('Time')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{
|
||||
activity.createdFilesList.map((item, index) => {
|
||||
let fileURL = `${siteRoot}lib/${item.repo_id}/file${Utils.encodePath(item.path)}`;
|
||||
return (
|
||||
<tr key={index}>
|
||||
<td><a href={fileURL} target='_blank'>{item.name}</a></td>
|
||||
<td>{item.repo_name}</td>
|
||||
<td>{moment(item.time).fromNow()}</td>
|
||||
</tr>
|
||||
);
|
||||
})
|
||||
}
|
||||
</tbody>
|
||||
</Table>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={this.toggle.bind(this, activity)}>{gettext('Close')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ListCreatedFileDialog.propTypes = propTypes;
|
||||
|
||||
export default ListCreatedFileDialog;
|
Reference in New Issue
Block a user