2016-07-16 02:06:10 +00:00
|
|
|
import React from 'react';
|
2016-07-14 22:48:56 +00:00
|
|
|
import ReactDOM from 'react-dom'
|
|
|
|
|
2016-07-16 02:06:10 +00:00
|
|
|
import ModalComponent from './lib/ModalComponent';
|
|
|
|
import Modal from './base/Modal';
|
|
|
|
import ModalBody from './base/ModalBody';
|
|
|
|
import ModalHeader from './base/ModalHeader';
|
|
|
|
import ModalFooter from './base/ModalFooter';
|
|
|
|
import {MODAL_CURL_EXPORT} from '../lib/constants';
|
2016-07-19 04:01:31 +00:00
|
|
|
import {exportCurl} from '../lib/export/curl';
|
2016-07-14 22:48:56 +00:00
|
|
|
|
|
|
|
class CurlExportModal extends ModalComponent {
|
|
|
|
constructor (props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {cmd: ''};
|
|
|
|
}
|
|
|
|
|
|
|
|
show (request) {
|
|
|
|
super.show();
|
|
|
|
|
|
|
|
exportCurl(request._id).then(cmd => {
|
|
|
|
this.setState({cmd});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidUpdate () {
|
|
|
|
ReactDOM.findDOMNode(this.refs.textarea).select();
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const {cmd} = this.state;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Modal ref="modal" tall={true} {...this.props}>
|
|
|
|
<ModalHeader>Export Request as Curl</ModalHeader>
|
|
|
|
<ModalBody className="grid pad">
|
2016-07-19 19:13:51 +00:00
|
|
|
<div className="form-control form-control--outlined no-margin tall">
|
2016-07-14 22:48:56 +00:00
|
|
|
<textarea
|
|
|
|
ref="textarea"
|
|
|
|
className="no-resize monospace tall"
|
|
|
|
onChange={e => {}}
|
|
|
|
value={cmd}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</ModalBody>
|
|
|
|
<ModalFooter>
|
|
|
|
<button className="btn pull-right" onClick={e => this.hide()}>Done</button>
|
|
|
|
</ModalFooter>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CurlExportModal.propTypes = {};
|
|
|
|
|
|
|
|
export default CurlExportModal;
|