import React, {Component, PropTypes} from 'react'; import {Tab, Tabs, TabList, TabPanel} from 'react-tabs' import KeyValueEditor from './base/KeyValueEditor'; import ContentTypeDropdown from './ContentTypeDropdown'; import RenderedQueryString from './RenderedQueryString'; import RequestBodyEditor from './RequestBodyEditor'; import RequestAuthEditor from './RequestAuthEditor'; import RequestUrlBar from '../components/RequestUrlBar'; import {getContentTypeName} from '../lib/contentTypes'; import {getContentTypeFromHeaders} from '../lib/contentTypes'; import {MOD_SYM} from '../lib/constants'; class RequestPane extends Component { render () { const { request, showPasswords, editorFontSize, editorLineWrapping, sendRequest, updateRequestUrl, updateRequestMethod, updateRequestBody, updateRequestParameters, updateRequestAuthentication, updateRequestHeaders, updateRequestContentType, updateSettingsShowPasswords } = this.props; if (!request) { return ( New Request {MOD_SYM}N Open Settings {MOD_SYM}, Switch Requests {MOD_SYM}P ) } return ( sendRequest(request)} onUrlChange={updateRequestUrl} onMethodChange={updateRequestMethod} requestId={request._id} url={request.url} method={request.method} /> {getContentTypeName(getContentTypeFromHeaders(request.headers))} Auth {request.authentication.username ? : ''} Params {request.parameters.length ? ({request.parameters.length}) : null} Headers {request.headers.length ? ( ({request.headers.length}) ) : null} updateSettingsShowPasswords(!showPasswords)}> {showPasswords ? 'Hide Password' : 'Show Password'} Url Preview ) } } RequestPane.propTypes = { // Functions sendRequest: 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, // Other showPasswords: PropTypes.bool.isRequired, editorFontSize: PropTypes.number.isRequired, editorLineWrapping: PropTypes.bool.isRequired, // Optional request: PropTypes.object, }; export default RequestPane;
{MOD_SYM}N
{MOD_SYM},
{MOD_SYM}P