diff --git a/app/components/ContentTypeDropdown.js b/app/components/ContentTypeDropdown.js new file mode 100644 index 0000000000..13f9dbabe9 --- /dev/null +++ b/app/components/ContentTypeDropdown.js @@ -0,0 +1,31 @@ +import React, {Component, PropTypes} from 'react' + +import Dropdown from '../components/base/Dropdown' +import * as contentTypes from '../lib/contentTypes' + +class ContentTypeDropdown extends Component { + render () { + const {updateRequestContentType} = this.props; + + return ( + + + + {contentTypes.CONTENT_TYPES.map(contentType => ( + + updateRequestContentType(contentType)}> + {contentTypes.getContentTypeName(contentType)} + + + ))} + + + ) + } +} + +ContentTypeDropdown.propTypes = { + updateRequestContentType: PropTypes.func.isRequired +}; + +export default ContentTypeDropdown; diff --git a/app/components/RequestBodyEditor.js b/app/components/RequestBodyEditor.js index a3e7165933..bf3826a1dd 100644 --- a/app/components/RequestBodyEditor.js +++ b/app/components/RequestBodyEditor.js @@ -3,7 +3,7 @@ import Editor from './base/Editor' class RequestBodyEditor extends Component { render () { - const {body, contentType, requestId, onChange, className} = this.props; + const {body, contentType, onChange, className} = this.props; return ( - JSON - - - - {/* File Upload*/} - Form Data - XML - Plain Text - - + {getContentTypeName(request.contentType)} + @@ -124,6 +121,7 @@ RequestPane.propTypes = { updateRequestParams: PropTypes.func.isRequired, updateRequestAuthentication: PropTypes.func.isRequired, updateRequestHeaders: PropTypes.func.isRequired, + updateRequestContentType: PropTypes.func.isRequired, // Other request: PropTypes.object diff --git a/app/components/ResponsePane.js b/app/components/ResponsePane.js index 87cf42a31b..c1e96ce8f6 100644 --- a/app/components/ResponsePane.js +++ b/app/components/ResponsePane.js @@ -17,7 +17,13 @@ class ResponsePane extends Component { return ( - + + + Nothing Yet... + Click the Send button to trigger a request + + + ) } diff --git a/app/components/base/Editor.js b/app/components/base/Editor.js index 35ecb5d495..901feb8a64 100644 --- a/app/components/base/Editor.js +++ b/app/components/base/Editor.js @@ -70,14 +70,16 @@ class Editor extends Component { } componentDidMount () { + const {options, value} = this.props; + var textareaNode = this.refs.textarea; this.codeMirror = CodeMirror.fromTextArea(textareaNode, BASE_CODEMIRROR_OPTIONS); this.codeMirror.on('change', this._codemirrorValueChanged.bind(this)); this.codeMirror.on('paste', this._codemirrorValueChanged.bind(this)); - this._currentCodemirrorValue = this.props.value || ''; + this._currentCodemirrorValue = value || ''; this._codemirrorSetValue(this._currentCodemirrorValue); - this._codemirrorSetOptions(this.props.options); + this._codemirrorSetOptions(options); } componentWillUnmount () { @@ -92,22 +94,24 @@ class Editor extends Component { if (!this.codeMirror) { return; } + + const {options, value} = this.props; + + // Reset any options that may have changed + this._codemirrorSetOptions(options); // Don't update if no value passed - if (this.props.value === undefined) { + if (value === undefined) { return; } // Don't update if same value passed again - if (this._currentCodemirrorValue === this.props.value) { + if (this._currentCodemirrorValue === value) { return; } - // Reset any options that may have changed - this._codemirrorSetOptions(this.props.options); - // Set the new value - this._codemirrorSetValue(this.props.value); + this._codemirrorSetValue(value); } /** @@ -184,14 +188,6 @@ class Editor extends Component { this.codeMirror.setValue(code); } - - shouldComponentUpdate (nextProps) { - if (!this.props.uniquenessKey) { - return true; - } else { - return this.props.uniquenessKey !== nextProps.uniquenessKey; - } - } render () { const options = this.props.options || {}; @@ -223,8 +219,7 @@ Editor.propTypes = { value: PropTypes.string, prettify: PropTypes.bool, className: PropTypes.any, - debounceMillis: PropTypes.number, - uniquenessKey: PropTypes.string + debounceMillis: PropTypes.number }; export default Editor; diff --git a/app/containers/App.js b/app/containers/App.js index 143c82fea3..df48fec2d7 100644 --- a/app/containers/App.js +++ b/app/containers/App.js @@ -84,6 +84,7 @@ class App extends Component { updateRequestParams={params => db.requestUpdate(activeRequest, {params})} updateRequestAuthentication={authentication => db.requestUpdate(activeRequest, {authentication})} updateRequestHeaders={headers => db.requestUpdate(activeRequest, {headers})} + updateRequestContentType={contentType => db.requestUpdate(activeRequest, {contentType})} />
Click the Send button to trigger a request