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/body/BodyEditor'; import AuthEditor from './editors/AuthEditor'; import RequestUrlBar from './RequestUrlBar.js'; import {MOD_SYM, getContentTypeName} from '../../common/constants'; import {debounce} from '../../common/misc'; import {trackEvent} from '../../analytics/index'; class RequestPane extends Component { render () { const { request, environmentId, handleImportFile, showPasswords, editorFontSize, editorLineWrapping, handleCreateRequest, handleSend, useBulkHeaderEditor, updateRequestUrl, updateRequestMethod, updateRequestBody, updateRequestParameters, updateRequestAuthentication, updateRequestHeaders, updateRequestMimeType, 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
) } const numParameters = request.parameters.filter(p => !p.disabled).length; const numHeaders = request.headers.filter(h => !h.disabled).length; const hasAuth = !request.authentication.disabled; return (
trackEvent('Request Pane', 'View', 'Body')}> trackEvent('Request Pane', 'View', 'Auth')}> trackEvent('Request Pane', 'View', 'Query')}> trackEvent('Request Pane', 'View', 'Headers')}>
trackEvent('Query', 'Toggle', pair.disabled ? 'Disable' : 'Enable')} onCreate={() => trackEvent('Query', 'Create')} onDelete={() => trackEvent('Query', 'Delete')} pairs={request.parameters} onChange={updateRequestParameters} />
) } } RequestPane.propTypes = { // Functions handleSend: PropTypes.func.isRequired, handleCreateRequest: 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, updateRequestMimeType: PropTypes.func.isRequired, updateSettingsShowPasswords: PropTypes.func.isRequired, updateSettingsUseBulkHeaderEditor: PropTypes.func.isRequired, handleImportFile: PropTypes.func.isRequired, // Other useBulkHeaderEditor: PropTypes.bool.isRequired, showPasswords: PropTypes.bool.isRequired, editorFontSize: PropTypes.number.isRequired, editorLineWrapping: PropTypes.bool.isRequired, environmentId: PropTypes.string.isRequired, // Optional request: PropTypes.object, }; export default RequestPane;