import React from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
import moment from 'moment';
import { gettext, fileServerRoot } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
import Loading from '../loading';
import '../../css/commit-details.css';
const propTypes = {
repoID: PropTypes.string.isRequired,
commitID: PropTypes.string.isRequired,
commitTime: PropTypes.string.isRequired,
toggleDialog: PropTypes.func.isRequired
};
class CommitDetails extends React.Component {
constructor(props) {
super(props);
this.state = {
isLoading: true,
errorMsg: '',
};
}
componentDidMount() {
const {repoID, commitID} = this.props;
seafileAPI.getCommitDetails(repoID, commitID).then((res) => {
this.setState({
isLoading: false,
errorMsg: '',
commitDetails: res.data
});
}).catch((error) => {
let errorMsg = Utils.getErrorMsg(error);
this.setState({
isLoading: false,
errorMsg: errorMsg
});
});
}
render() {
const { toggleDialog, commitTime} = this.props;
return (
{moment(this.props.commitTime).format('YYYY-MM-DD HH:mm:ss')}
{data.cmt_desc}
; } return ({errorMsg}
; } return this.renderDetails(commitDetails); } } CommitDetails.propTypes = propTypes; export default CommitDetails;