import React, {Component, PropTypes} from 'react'; import {Tab, Tabs, TabList, TabPanel} from 'react-tabs' import KeyValueEditor from './base/KeyValueEditor'; import RequestHeadersEditor from './editors/RequestHeadersEditor'; import ContentTypeDropdown from './dropdowns/ContentTypeDropdown'; import RenderedQueryString from './RenderedQueryString'; import BodyEditor from './editors/BodyEditor'; import AuthEditor from './editors/AuthEditor'; import {UrlBar} from './UrlBar.elm'; import ElmComponent from './ElmComponent'; import {getContentTypeName} from '../../backend/contentTypes'; import {getContentTypeFromHeaders} from '../../backend/contentTypes'; import {MOD_SYM} from '../../backend/constants'; import {trackEvent} from '../../backend/analytics'; import {debounce} from '../lib/debounce'; class RequestPane extends Component { render () { const { request, importFile, showPasswords, editorFontSize, editorLineWrapping, requestCreate, sendRequest, useBulkHeaderEditor, updateRequestUrl, updateRequestMethod, updateRequestBody, updateRequestParameters, updateRequestAuthentication, updateRequestHeaders, updateRequestContentType, updateSettingsUseBulkHeaderEditor } = this.props; if (!request) { return (
New Request {MOD_SYM}N
Switch Requests {MOD_SYM}P
Manage Cookies {MOD_SYM}K
Edit Environments {MOD_SYM}E
) } return (
} ports={{ onUrlChange: debounce(updateRequestUrl), onSendRequest: sendRequest.bind(null, request), onMethodChange: updateRequestMethod }} component={UrlBar} method={request.method} url={request.url} />
) } } RequestPane.propTypes = { // Functions sendRequest: PropTypes.func.isRequired, requestCreate: PropTypes.func.isRequired, updateRequestUrl: PropTypes.func.isRequired, updateRequestMethod: PropTypes.func.isRequired, updateRequestBody: PropTypes.func.isRequired, updateRequestParameters: PropTypes.func.isRequired, updateRequestAuthentication: PropTypes.func.isRequired, updateRequestHeaders: PropTypes.func.isRequired, updateRequestContentType: PropTypes.func.isRequired, updateSettingsShowPasswords: PropTypes.func.isRequired, updateSettingsUseBulkHeaderEditor: PropTypes.func.isRequired, importFile: PropTypes.func.isRequired, // Other useBulkHeaderEditor: PropTypes.bool.isRequired, showPasswords: PropTypes.bool.isRequired, editorFontSize: PropTypes.number.isRequired, editorLineWrapping: PropTypes.bool.isRequired, // Optional request: PropTypes.object, }; export default RequestPane;