2017-07-19 01:55:47 +00:00
|
|
|
// @flow
|
|
|
|
import type {Request} from '../../models/request';
|
|
|
|
import type {Workspace} from '../../models/workspace';
|
2017-07-19 04:48:28 +00:00
|
|
|
import type {OAuth2Token} from '../../models/o-auth-2-token';
|
2017-07-19 01:55:47 +00:00
|
|
|
|
2017-07-19 02:54:03 +00:00
|
|
|
import React from 'react';
|
2017-03-03 01:44:07 +00:00
|
|
|
import autobind from 'autobind-decorator';
|
2017-03-23 22:10:42 +00:00
|
|
|
import {Tab, TabList, TabPanel, Tabs} from 'react-tabs';
|
|
|
|
import ContentTypeDropdown from './dropdowns/content-type-dropdown';
|
|
|
|
import AuthDropdown from './dropdowns/auth-dropdown';
|
2017-03-08 05:52:17 +00:00
|
|
|
import KeyValueEditor from './key-value-editor/editor';
|
|
|
|
import RequestHeadersEditor from './editors/request-headers-editor';
|
|
|
|
import RenderedQueryString from './rendered-query-string';
|
|
|
|
import BodyEditor from './editors/body/body-editor';
|
2017-03-23 22:10:42 +00:00
|
|
|
import AuthWrapper from './editors/auth/auth-wrapper';
|
2017-03-08 05:52:17 +00:00
|
|
|
import RequestUrlBar from './request-url-bar.js';
|
2017-07-19 02:54:03 +00:00
|
|
|
import {DEBOUNCE_MILLIS, getAuthTypeName, getContentTypeName} from '../../common/constants';
|
2016-11-23 19:33:24 +00:00
|
|
|
import {trackEvent} from '../../analytics/index';
|
2016-11-28 07:12:17 +00:00
|
|
|
import * as querystring from '../../common/querystring';
|
2017-03-23 22:10:42 +00:00
|
|
|
import * as db from '../../common/database';
|
|
|
|
import * as models from '../../models';
|
2017-04-04 23:06:43 +00:00
|
|
|
import Hotkey from './hotkey';
|
2017-06-16 20:29:22 +00:00
|
|
|
import {showModal} from './modals/index';
|
|
|
|
import RequestSettingsModal from './modals/request-settings-modal';
|
|
|
|
import MarkdownPreview from './markdown-preview';
|
2016-09-17 05:46:44 +00:00
|
|
|
|
2017-07-21 18:59:17 +00:00
|
|
|
@autobind
|
|
|
|
class RequestPane extends React.PureComponent {
|
|
|
|
props: {
|
|
|
|
// Functions
|
|
|
|
forceUpdateRequest: Function,
|
|
|
|
handleSend: Function,
|
|
|
|
handleSendAndDownload: Function,
|
|
|
|
handleCreateRequest: Function,
|
|
|
|
handleGenerateCode: Function,
|
|
|
|
handleRender: Function,
|
|
|
|
handleGetRenderContext: Function,
|
|
|
|
updateRequestUrl: Function,
|
|
|
|
updateRequestMethod: Function,
|
|
|
|
updateRequestBody: Function,
|
|
|
|
updateRequestParameters: Function,
|
|
|
|
updateRequestAuthentication: Function,
|
|
|
|
updateRequestHeaders: Function,
|
|
|
|
updateRequestMimeType: Function,
|
|
|
|
updateSettingsShowPasswords: Function,
|
|
|
|
updateSettingsUseBulkHeaderEditor: Function,
|
|
|
|
handleImport: Function,
|
|
|
|
handleImportFile: Function,
|
2017-07-19 01:55:47 +00:00
|
|
|
|
2017-07-21 18:59:17 +00:00
|
|
|
// Other
|
|
|
|
useBulkHeaderEditor: boolean,
|
|
|
|
showPasswords: boolean,
|
|
|
|
editorFontSize: number,
|
|
|
|
editorIndentSize: number,
|
|
|
|
editorKeyMap: string,
|
|
|
|
editorLineWrapping: boolean,
|
|
|
|
workspace: Workspace,
|
|
|
|
forceRefreshCounter: number,
|
2017-07-19 01:55:47 +00:00
|
|
|
|
2017-07-21 18:59:17 +00:00
|
|
|
// Optional
|
|
|
|
request: ?Request,
|
|
|
|
oAuth2Token: ?OAuth2Token
|
|
|
|
};
|
2016-11-26 00:37:59 +00:00
|
|
|
|
2017-07-19 02:54:03 +00:00
|
|
|
_handleUpdateRequestUrlTimeout: number;
|
2017-03-03 01:44:07 +00:00
|
|
|
|
2017-06-16 20:29:22 +00:00
|
|
|
_handleEditDescriptionAdd () {
|
|
|
|
this._handleEditDescription(true);
|
|
|
|
}
|
|
|
|
|
2017-07-19 01:55:47 +00:00
|
|
|
_handleEditDescription (addDescription: boolean) {
|
2017-06-16 20:29:22 +00:00
|
|
|
showModal(RequestSettingsModal, {
|
|
|
|
request: this.props.request,
|
|
|
|
forceEditMode: addDescription
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-03-23 22:10:42 +00:00
|
|
|
async _autocompleteUrls () {
|
2017-03-28 22:45:23 +00:00
|
|
|
const docs = await db.withDescendants(
|
|
|
|
this.props.workspace,
|
|
|
|
models.request.type
|
|
|
|
);
|
2017-03-03 01:44:07 +00:00
|
|
|
|
2017-03-23 22:10:42 +00:00
|
|
|
const requestId = this.props.request ? this.props.request._id : 'n/a';
|
|
|
|
|
|
|
|
const urls = docs.filter(d => (
|
|
|
|
d.type === models.request.type && // Only requests
|
|
|
|
d._id !== requestId && // Not current request
|
2017-07-19 01:55:47 +00:00
|
|
|
(d.url || '') // Only ones with non-empty URLs
|
|
|
|
)).map(r => r.url || '');
|
2017-03-23 22:10:42 +00:00
|
|
|
|
|
|
|
return Array.from(new Set(urls));
|
2017-03-03 01:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_handleUpdateSettingsUseBulkHeaderEditor () {
|
2016-11-26 00:49:38 +00:00
|
|
|
const {useBulkHeaderEditor, updateSettingsUseBulkHeaderEditor} = this.props;
|
|
|
|
updateSettingsUseBulkHeaderEditor(!useBulkHeaderEditor);
|
|
|
|
trackEvent('Headers', 'Toggle Bulk', !useBulkHeaderEditor ? 'On' : 'Off');
|
2017-03-03 01:44:07 +00:00
|
|
|
}
|
2016-11-26 00:49:38 +00:00
|
|
|
|
2017-03-03 01:44:07 +00:00
|
|
|
_handleImportFile () {
|
2016-11-26 08:29:16 +00:00
|
|
|
this.props.handleImportFile();
|
|
|
|
trackEvent('Request Pane', 'CTA', 'Import');
|
2017-03-03 01:44:07 +00:00
|
|
|
}
|
2016-11-26 08:29:16 +00:00
|
|
|
|
2017-03-03 01:44:07 +00:00
|
|
|
_handleCreateRequest () {
|
2016-11-26 08:29:16 +00:00
|
|
|
this.props.handleCreateRequest(this.props.request);
|
|
|
|
trackEvent('Request Pane', 'CTA', 'New Request');
|
2017-03-03 01:44:07 +00:00
|
|
|
}
|
2016-11-26 08:29:16 +00:00
|
|
|
|
2017-07-19 01:55:47 +00:00
|
|
|
_handleUpdateRequestUrl (url: string) {
|
2017-07-19 02:54:03 +00:00
|
|
|
clearTimeout(this._handleUpdateRequestUrlTimeout);
|
|
|
|
this._handleUpdateRequestUrlTimeout = setTimeout(() => {
|
|
|
|
this.props.updateRequestUrl(url);
|
|
|
|
}, DEBOUNCE_MILLIS);
|
2017-03-03 20:09:08 +00:00
|
|
|
}
|
2017-02-28 21:32:23 +00:00
|
|
|
|
2017-03-03 01:44:07 +00:00
|
|
|
_handleImportQueryFromUrl () {
|
2016-11-28 07:12:17 +00:00
|
|
|
const {request} = this.props;
|
|
|
|
|
2017-07-19 04:48:28 +00:00
|
|
|
if (!request) {
|
|
|
|
console.warn('Tried to import query when no request active');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-03-01 21:15:56 +00:00
|
|
|
let query;
|
2016-11-28 07:12:17 +00:00
|
|
|
try {
|
2017-03-01 21:15:56 +00:00
|
|
|
query = querystring.extractFromUrl(request.url);
|
2016-11-28 07:12:17 +00:00
|
|
|
} catch (e) {
|
|
|
|
console.warn('Failed to parse url to import querystring');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove the search string (?foo=bar&...) from the Url
|
2017-03-01 21:15:56 +00:00
|
|
|
const url = request.url.replace(query, '');
|
2016-11-28 07:12:17 +00:00
|
|
|
const parameters = [
|
|
|
|
...request.parameters,
|
2017-03-03 20:09:08 +00:00
|
|
|
...querystring.deconstructToParams(query)
|
2016-11-28 07:12:17 +00:00
|
|
|
];
|
|
|
|
|
2017-03-01 21:15:56 +00:00
|
|
|
// Only update if url changed
|
|
|
|
if (url !== request.url) {
|
|
|
|
this.props.forceUpdateRequest({url, parameters});
|
|
|
|
}
|
2017-03-03 01:44:07 +00:00
|
|
|
}
|
|
|
|
|
2017-07-19 01:55:47 +00:00
|
|
|
_trackQueryToggle (pair: {disabled: boolean}) {
|
2017-03-03 01:44:07 +00:00
|
|
|
trackEvent('Query', 'Toggle', pair.disabled ? 'Disable' : 'Enable');
|
|
|
|
}
|
|
|
|
|
|
|
|
_trackQueryCreate () {
|
|
|
|
trackEvent('Query', 'Create');
|
|
|
|
}
|
|
|
|
|
|
|
|
_trackQueryDelete () {
|
|
|
|
trackEvent('Query', 'Delete');
|
|
|
|
}
|
2016-11-28 07:12:17 +00:00
|
|
|
|
2016-09-17 05:46:44 +00:00
|
|
|
render () {
|
|
|
|
const {
|
|
|
|
editorFontSize,
|
2017-04-14 21:47:15 +00:00
|
|
|
editorIndentSize,
|
2017-01-24 22:18:11 +00:00
|
|
|
editorKeyMap,
|
2016-09-17 05:46:44 +00:00
|
|
|
editorLineWrapping,
|
2016-11-28 07:12:17 +00:00
|
|
|
forceRefreshCounter,
|
|
|
|
handleGenerateCode,
|
2017-03-23 22:10:42 +00:00
|
|
|
handleGetRenderContext,
|
2017-02-02 18:30:13 +00:00
|
|
|
handleImport,
|
2017-03-23 22:10:42 +00:00
|
|
|
handleRender,
|
|
|
|
handleSend,
|
|
|
|
handleSendAndDownload,
|
|
|
|
oAuth2Token,
|
|
|
|
request,
|
|
|
|
showPasswords,
|
2016-09-17 05:46:44 +00:00
|
|
|
updateRequestAuthentication,
|
2017-03-23 22:10:42 +00:00
|
|
|
updateRequestBody,
|
2016-09-17 05:46:44 +00:00
|
|
|
updateRequestHeaders,
|
2017-03-23 22:10:42 +00:00
|
|
|
updateRequestMethod,
|
2016-11-22 19:42:10 +00:00
|
|
|
updateRequestMimeType,
|
2017-03-23 22:10:42 +00:00
|
|
|
updateRequestParameters,
|
|
|
|
updateSettingsShowPasswords,
|
|
|
|
useBulkHeaderEditor
|
2016-09-17 05:46:44 +00:00
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
if (!request) {
|
|
|
|
return (
|
2016-09-20 21:17:01 +00:00
|
|
|
<section className="request-pane pane">
|
|
|
|
<header className="pane__header"></header>
|
|
|
|
<div className="pane__body pane__body--placeholder">
|
|
|
|
<div>
|
2017-03-23 22:10:42 +00:00
|
|
|
<table className="table--fancy">
|
2016-09-20 21:17:01 +00:00
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>New Request</td>
|
|
|
|
<td className="text-right">
|
2017-04-04 23:06:43 +00:00
|
|
|
<code><Hotkey char="N"/></code>
|
2016-09-20 21:17:01 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Switch Requests</td>
|
|
|
|
<td className="text-right">
|
2017-04-04 23:06:43 +00:00
|
|
|
<code><Hotkey char="P"/></code>
|
2016-09-20 21:17:01 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Edit Environments</td>
|
|
|
|
<td className="text-right">
|
2017-04-04 23:06:43 +00:00
|
|
|
<code><Hotkey char="E"/></code>
|
2016-09-20 21:17:01 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2016-09-17 05:46:44 +00:00
|
|
|
|
2016-09-20 21:17:01 +00:00
|
|
|
<div className="text-center pane__body--placeholder__cta">
|
2016-11-26 08:29:16 +00:00
|
|
|
<button className="btn inline-block btn--clicky" onClick={this._handleImportFile}>
|
2016-09-20 21:17:01 +00:00
|
|
|
Import from File
|
|
|
|
</button>
|
2016-11-26 00:49:38 +00:00
|
|
|
<button className="btn inline-block btn--clicky"
|
2016-11-26 08:29:16 +00:00
|
|
|
onClick={this._handleCreateRequest}>
|
2016-09-20 21:17:01 +00:00
|
|
|
New Request
|
|
|
|
</button>
|
2016-09-17 05:46:44 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-20 21:17:01 +00:00
|
|
|
</div>
|
|
|
|
</section>
|
2017-03-03 20:09:08 +00:00
|
|
|
);
|
2016-09-17 05:46:44 +00:00
|
|
|
}
|
|
|
|
|
2016-11-24 01:24:59 +00:00
|
|
|
let numBodyParams = 0;
|
|
|
|
if (request.body && request.body.params) {
|
|
|
|
numBodyParams = request.body.params.filter(p => !p.disabled).length;
|
|
|
|
}
|
2016-11-26 08:29:16 +00:00
|
|
|
|
2016-11-23 03:07:35 +00:00
|
|
|
const numParameters = request.parameters.filter(p => !p.disabled).length;
|
|
|
|
const numHeaders = request.headers.filter(h => !h.disabled).length;
|
2016-11-28 07:12:17 +00:00
|
|
|
const urlHasQueryParameters = request.url.indexOf('?') >= 0;
|
|
|
|
|
|
|
|
const uniqueKey = `${forceRefreshCounter}::${request._id}`;
|
2016-11-23 03:07:35 +00:00
|
|
|
|
2016-09-17 05:46:44 +00:00
|
|
|
return (
|
2016-09-20 21:17:01 +00:00
|
|
|
<section className="pane request-pane">
|
2016-11-07 20:24:38 +00:00
|
|
|
<header className="pane__header">
|
|
|
|
<RequestUrlBar
|
2017-04-10 20:07:33 +00:00
|
|
|
uniquenessKey={uniqueKey}
|
2016-11-07 20:24:38 +00:00
|
|
|
method={request.method}
|
|
|
|
onMethodChange={updateRequestMethod}
|
2017-02-28 21:32:23 +00:00
|
|
|
onUrlChange={this._handleUpdateRequestUrl}
|
2017-03-23 22:10:42 +00:00
|
|
|
handleAutocompleteUrls={this._autocompleteUrls}
|
2017-02-02 18:30:13 +00:00
|
|
|
handleImport={handleImport}
|
2016-11-28 07:12:17 +00:00
|
|
|
handleGenerateCode={handleGenerateCode}
|
2016-11-16 17:18:39 +00:00
|
|
|
handleSend={handleSend}
|
2017-02-01 20:21:14 +00:00
|
|
|
handleSendAndDownload={handleSendAndDownload}
|
2017-02-27 21:00:13 +00:00
|
|
|
handleRender={handleRender}
|
2017-03-12 00:31:23 +00:00
|
|
|
handleGetRenderContext={handleGetRenderContext}
|
2016-11-07 20:24:38 +00:00
|
|
|
url={request.url}
|
2017-04-10 20:07:33 +00:00
|
|
|
requestId={request._id}
|
2016-11-07 20:24:38 +00:00
|
|
|
/>
|
|
|
|
</header>
|
2017-03-01 21:15:56 +00:00
|
|
|
<Tabs className="pane__body" forceRenderTabPanel>
|
2016-09-20 21:17:01 +00:00
|
|
|
<TabList>
|
2017-07-25 22:28:53 +00:00
|
|
|
<Tab>
|
2016-11-27 21:42:38 +00:00
|
|
|
<ContentTypeDropdown onChange={updateRequestMimeType}
|
2017-07-26 00:49:22 +00:00
|
|
|
contentType={request.body.mimeType || null}
|
2017-03-31 21:59:12 +00:00
|
|
|
request={request}
|
2016-11-27 21:42:38 +00:00
|
|
|
className="tall">
|
2017-07-26 00:49:22 +00:00
|
|
|
{typeof request.body.mimeType === 'string'
|
|
|
|
? getContentTypeName(request.body.mimeType)
|
|
|
|
: 'Body'}
|
2017-06-22 19:37:24 +00:00
|
|
|
{numBodyParams ? <span className="bubble space-left">{numBodyParams}</span> : null}
|
2017-06-16 22:21:41 +00:00
|
|
|
<i className="fa fa-caret-down space-left"/>
|
2016-11-25 19:01:41 +00:00
|
|
|
</ContentTypeDropdown>
|
2016-09-20 21:17:01 +00:00
|
|
|
</Tab>
|
2017-07-25 22:28:53 +00:00
|
|
|
<Tab>
|
2017-03-23 22:10:42 +00:00
|
|
|
<AuthDropdown onChange={updateRequestAuthentication}
|
|
|
|
authentication={request.authentication}
|
|
|
|
className="tall">
|
2017-06-16 22:21:41 +00:00
|
|
|
{getAuthTypeName(request.authentication.type) || 'Auth'}
|
|
|
|
<i className="fa fa-caret-down space-left"/>
|
2017-03-23 22:10:42 +00:00
|
|
|
</AuthDropdown>
|
2016-09-20 21:17:01 +00:00
|
|
|
</Tab>
|
2017-07-25 22:28:53 +00:00
|
|
|
<Tab>
|
2016-10-27 03:41:30 +00:00
|
|
|
<button>
|
2017-06-22 19:37:24 +00:00
|
|
|
Query
|
|
|
|
{numParameters > 0 && <span className="bubble space-left">{numParameters}</span>}
|
2016-09-20 21:17:01 +00:00
|
|
|
</button>
|
|
|
|
</Tab>
|
2017-07-25 22:28:53 +00:00
|
|
|
<Tab>
|
2016-10-27 03:41:30 +00:00
|
|
|
<button>
|
2017-06-22 19:37:24 +00:00
|
|
|
Header
|
|
|
|
{numHeaders > 0 && <span className="bubble space-left">{numHeaders}</span>}
|
2016-09-20 21:17:01 +00:00
|
|
|
</button>
|
|
|
|
</Tab>
|
2017-07-25 22:28:53 +00:00
|
|
|
<Tab>
|
2017-06-16 20:29:22 +00:00
|
|
|
<button>
|
2017-06-22 19:37:24 +00:00
|
|
|
Docs
|
2017-06-16 20:29:22 +00:00
|
|
|
{request.description && (
|
|
|
|
<span className="bubble space-left">
|
|
|
|
<i className="fa fa--skinny fa-check txt-xxs"/>
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
</button>
|
|
|
|
</Tab>
|
2016-09-20 21:17:01 +00:00
|
|
|
</TabList>
|
|
|
|
<TabPanel className="editor-wrapper">
|
|
|
|
<BodyEditor
|
2016-11-25 19:01:41 +00:00
|
|
|
handleUpdateRequestMimeType={updateRequestMimeType}
|
2017-02-13 08:12:02 +00:00
|
|
|
handleRender={handleRender}
|
2017-03-12 00:31:23 +00:00
|
|
|
handleGetRenderContext={handleGetRenderContext}
|
2016-11-28 07:12:17 +00:00
|
|
|
key={uniqueKey}
|
2016-09-20 21:17:01 +00:00
|
|
|
request={request}
|
|
|
|
onChange={updateRequestBody}
|
|
|
|
fontSize={editorFontSize}
|
2017-04-14 21:47:15 +00:00
|
|
|
indentSize={editorIndentSize}
|
2017-01-24 22:18:11 +00:00
|
|
|
keyMap={editorKeyMap}
|
2016-09-20 21:17:01 +00:00
|
|
|
lineWrapping={editorLineWrapping}
|
|
|
|
/>
|
|
|
|
</TabPanel>
|
2016-09-21 00:03:26 +00:00
|
|
|
<TabPanel className="scrollable-container">
|
|
|
|
<div className="scrollable">
|
2017-03-23 22:10:42 +00:00
|
|
|
<AuthWrapper
|
2016-11-28 07:12:17 +00:00
|
|
|
key={uniqueKey}
|
2017-03-23 22:10:42 +00:00
|
|
|
oAuth2Token={oAuth2Token}
|
2016-09-21 00:03:26 +00:00
|
|
|
showPasswords={showPasswords}
|
2017-03-23 22:10:42 +00:00
|
|
|
request={request}
|
2016-11-26 00:37:59 +00:00
|
|
|
handleUpdateSettingsShowPasswords={updateSettingsShowPasswords}
|
2017-02-27 21:00:13 +00:00
|
|
|
handleRender={handleRender}
|
2017-03-12 00:31:23 +00:00
|
|
|
handleGetRenderContext={handleGetRenderContext}
|
2016-09-21 00:03:26 +00:00
|
|
|
onChange={updateRequestAuthentication}
|
|
|
|
/>
|
|
|
|
</div>
|
2016-09-20 21:17:01 +00:00
|
|
|
</TabPanel>
|
2016-11-28 07:12:17 +00:00
|
|
|
<TabPanel className="query-editor">
|
2017-06-12 21:55:04 +00:00
|
|
|
<div className="pad pad-bottom-sm query-editor__preview">
|
2017-03-06 17:51:58 +00:00
|
|
|
<label className="label--small no-pad-top">Url Preview</label>
|
2017-03-09 06:23:23 +00:00
|
|
|
<code className="txt-sm block faint">
|
2016-11-28 07:12:17 +00:00
|
|
|
<RenderedQueryString
|
2017-03-03 20:09:08 +00:00
|
|
|
key={uniqueKey}
|
2017-03-01 21:15:56 +00:00
|
|
|
handleRender={handleRender}
|
2016-11-28 07:12:17 +00:00
|
|
|
request={request}
|
|
|
|
/>
|
|
|
|
</code>
|
|
|
|
</div>
|
|
|
|
<div className="scrollable-container">
|
|
|
|
<div className="scrollable">
|
2017-03-03 20:09:08 +00:00
|
|
|
<KeyValueEditor
|
|
|
|
sortable
|
|
|
|
key={uniqueKey}
|
|
|
|
namePlaceholder="name"
|
|
|
|
valuePlaceholder="value"
|
|
|
|
onToggleDisable={this._trackQueryToggle}
|
|
|
|
onCreate={this._trackQueryCreate}
|
|
|
|
onDelete={this._trackQueryDelete}
|
|
|
|
pairs={request.parameters}
|
|
|
|
handleRender={handleRender}
|
2017-03-12 00:31:23 +00:00
|
|
|
handleGetRenderContext={handleGetRenderContext}
|
2017-03-03 20:09:08 +00:00
|
|
|
onChange={updateRequestParameters}
|
|
|
|
/>
|
2016-09-21 00:03:26 +00:00
|
|
|
</div>
|
2016-11-28 07:12:17 +00:00
|
|
|
</div>
|
|
|
|
<div className="pad-right text-right">
|
|
|
|
<button className="margin-top-sm btn btn--clicky"
|
|
|
|
title={urlHasQueryParameters ? 'Import querystring' : 'No query params to import'}
|
|
|
|
onClick={this._handleImportQueryFromUrl}>
|
|
|
|
Import from Url
|
|
|
|
</button>
|
2016-09-20 21:17:01 +00:00
|
|
|
</div>
|
|
|
|
</TabPanel>
|
2016-09-22 20:02:29 +00:00
|
|
|
<TabPanel className="header-editor">
|
|
|
|
<RequestHeadersEditor
|
2016-11-28 07:12:17 +00:00
|
|
|
key={uniqueKey}
|
2016-09-22 20:02:29 +00:00
|
|
|
headers={request.headers}
|
2017-02-27 21:00:13 +00:00
|
|
|
handleRender={handleRender}
|
2017-03-12 00:31:23 +00:00
|
|
|
handleGetRenderContext={handleGetRenderContext}
|
2017-03-16 17:51:56 +00:00
|
|
|
editorFontSize={editorFontSize}
|
2017-04-14 21:47:15 +00:00
|
|
|
editorIndentSize={editorIndentSize}
|
2017-03-16 17:51:56 +00:00
|
|
|
editorLineWrapping={editorLineWrapping}
|
2016-09-22 20:02:29 +00:00
|
|
|
onChange={updateRequestHeaders}
|
|
|
|
bulk={useBulkHeaderEditor}
|
|
|
|
/>
|
|
|
|
|
2016-09-22 20:04:23 +00:00
|
|
|
<div className="pad-right text-right">
|
2016-11-26 00:49:38 +00:00
|
|
|
<button className="margin-top-sm btn btn--clicky"
|
2016-11-26 08:29:16 +00:00
|
|
|
onClick={this._handleUpdateSettingsUseBulkHeaderEditor}>
|
2016-09-22 20:02:29 +00:00
|
|
|
{useBulkHeaderEditor ? 'Regular Edit' : 'Bulk Edit'}
|
|
|
|
</button>
|
2016-09-20 21:17:01 +00:00
|
|
|
</div>
|
|
|
|
</TabPanel>
|
2017-06-16 21:14:22 +00:00
|
|
|
<TabPanel key={uniqueKey} className="tall scrollable">
|
2017-06-16 20:29:22 +00:00
|
|
|
{request.description ? (
|
|
|
|
<div>
|
|
|
|
<div className="pull-right pad bg-default">
|
|
|
|
<button className="btn btn--clicky" onClick={this._handleEditDescription}>
|
|
|
|
Edit
|
|
|
|
</button>
|
|
|
|
</div>
|
2017-06-17 01:18:31 +00:00
|
|
|
<div className="pad">
|
|
|
|
<MarkdownPreview
|
|
|
|
heading={request.name}
|
|
|
|
debounceMillis={1000}
|
|
|
|
markdown={request.description}
|
|
|
|
handleRender={handleRender}
|
|
|
|
/>
|
|
|
|
</div>
|
2017-06-16 20:29:22 +00:00
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
<div className="overflow-hidden editor vertically-center text-center">
|
|
|
|
<p className="pad text-sm text-center">
|
|
|
|
<span className="super-faint">
|
|
|
|
<i className="fa fa-file-text-o"
|
|
|
|
style={{fontSize: '8rem', opacity: 0.3}}
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
<br/><br/>
|
|
|
|
<button className="btn btn--clicky faint"
|
|
|
|
onClick={this._handleEditDescriptionAdd}>
|
|
|
|
Add Description
|
|
|
|
</button>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</TabPanel>
|
2016-09-20 21:17:01 +00:00
|
|
|
</Tabs>
|
|
|
|
</section>
|
2017-03-03 20:09:08 +00:00
|
|
|
);
|
2016-09-17 05:46:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default RequestPane;
|