mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
9e84bc4387
* Start on workspace dropdown and upgrade fontawesome * WorkspaceDropdown start and Elm components! * Lots of CSS shit * Refactor some db stuff and move filter out of sidebar * Adjust dropdown css * Handle duplicate header names, and stuff * Shitty cookies tab * fixed cookie table a bit * Modal refactor * Starteed cookie modal design * Better cookie storage and filter cookie modal * Cookie editor round 1 * Fix kve cursor jumping and form encoding templating * New cookies now show up in filter * Checkpoint * Stuff and fix environments css * Added manage cookies button to cookie pane * Fix accidental sidebar item drag on sidebar resize * Environments modal is looking pretty good now * Pretty much done environments nad cookies * Some changes * Fixed codemirror in modals * Fixed some things * Add basic proxy support * Updated shortcuts * Code snippet generation * Some style * bug fix * Code export now gets cookies for correct domain
71 lines
1.6 KiB
JavaScript
71 lines
1.6 KiB
JavaScript
import React, {Component, PropTypes} from 'react';
|
|
|
|
import Editor from '../base/Editor';
|
|
import ResponseWebview from './ResponseWebview';
|
|
import {PREVIEW_MODE_FRIENDLY, PREVIEW_MODE_SOURCE} from '../../lib/previewModes';
|
|
|
|
class ResponseViewer extends Component {
|
|
shouldComponentUpdate (nextProps) {
|
|
for (let k of Object.keys(nextProps)) {
|
|
if (this.props[k] !== nextProps[k]) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
render () {
|
|
const {
|
|
previewMode,
|
|
contentType,
|
|
editorLineWrapping,
|
|
editorFontSize,
|
|
body,
|
|
url
|
|
} = this.props;
|
|
|
|
switch (previewMode) {
|
|
case PREVIEW_MODE_FRIENDLY:
|
|
return (
|
|
<ResponseWebview
|
|
body={body}
|
|
contentType={contentType}
|
|
url={url}
|
|
/>
|
|
);
|
|
case PREVIEW_MODE_SOURCE:
|
|
return (
|
|
<Editor
|
|
value={body || ''}
|
|
prettify={true}
|
|
mode={contentType}
|
|
readOnly={true}
|
|
lineWrapping={editorLineWrapping}
|
|
fontSize={editorFontSize}
|
|
placeholder="no response body..."
|
|
/>
|
|
);
|
|
default: // Raw
|
|
return (
|
|
<pre className="scrollable wide tall selectable monospace pad">
|
|
{body}
|
|
</pre>
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
ResponseViewer.propTypes = {
|
|
body: PropTypes.string.isRequired,
|
|
previewMode: PropTypes.string.isRequired,
|
|
editorFontSize: PropTypes.number.isRequired,
|
|
editorLineWrapping: PropTypes.bool.isRequired,
|
|
url: PropTypes.string.isRequired,
|
|
|
|
// Optional
|
|
contentType: PropTypes.string
|
|
};
|
|
|
|
export default ResponseViewer;
|