2017-08-10 01:56:27 +00:00
|
|
|
import React, {PureComponent} from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-03-03 01:44:07 +00:00
|
|
|
import autobind from 'autobind-decorator';
|
2017-03-28 22:45:23 +00:00
|
|
|
import HelpTooltip from '../help-tooltip';
|
2017-05-17 16:35:44 +00:00
|
|
|
import {isMac} from '../../../common/constants';
|
2016-11-07 20:24:38 +00:00
|
|
|
|
2017-03-03 01:44:07 +00:00
|
|
|
@autobind
|
2017-03-08 05:52:17 +00:00
|
|
|
class General extends PureComponent {
|
2017-03-03 01:44:07 +00:00
|
|
|
_handleUpdateSetting (e) {
|
2017-02-13 08:12:02 +00:00
|
|
|
let value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
|
2016-11-07 20:24:38 +00:00
|
|
|
|
2017-02-13 08:12:02 +00:00
|
|
|
if (e.target.type === 'number') {
|
|
|
|
value = parseInt(value, 10);
|
|
|
|
}
|
2016-11-07 20:24:38 +00:00
|
|
|
|
2017-02-13 08:12:02 +00:00
|
|
|
this.props.updateSetting(e.target.name, value);
|
2017-03-03 01:44:07 +00:00
|
|
|
}
|
2016-11-07 20:24:38 +00:00
|
|
|
|
2017-05-17 16:35:44 +00:00
|
|
|
_handleToggleMenuBar (e) {
|
|
|
|
this._handleUpdateSetting(e);
|
|
|
|
this.props.handleToggleMenuBar(e.target.checked);
|
|
|
|
}
|
|
|
|
|
2017-02-13 08:12:02 +00:00
|
|
|
render () {
|
|
|
|
const {settings} = this.props;
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div className="form-control form-control--thin">
|
|
|
|
<label className="inline-block">Follow redirects automatically
|
|
|
|
<input type="checkbox"
|
|
|
|
name="followRedirects"
|
|
|
|
checked={settings.followRedirects}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
2016-11-07 20:24:38 +00:00
|
|
|
|
2017-02-13 08:12:02 +00:00
|
|
|
<div className="form-control form-control--thin">
|
|
|
|
<label className="inline-block">Validate SSL Certificates
|
|
|
|
<input type="checkbox"
|
|
|
|
name="validateSSL"
|
|
|
|
checked={settings.validateSSL}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
2016-11-07 20:24:38 +00:00
|
|
|
|
2017-02-13 08:12:02 +00:00
|
|
|
<div className="form-control form-control--thin">
|
|
|
|
<label className="inline-block">Show passwords in plain-text
|
|
|
|
<input type="checkbox"
|
|
|
|
name="showPasswords"
|
|
|
|
checked={settings.showPasswords}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
2016-11-16 17:18:39 +00:00
|
|
|
|
2017-02-13 08:12:02 +00:00
|
|
|
<div className="form-control form-control--thin">
|
|
|
|
<label className="inline-block">Use bulk header editor by default
|
|
|
|
<input type="checkbox"
|
|
|
|
name="useBulkHeaderEditor"
|
|
|
|
checked={settings.useBulkHeaderEditor}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
2016-11-07 20:24:38 +00:00
|
|
|
|
2017-02-13 08:12:02 +00:00
|
|
|
<div className="form-control form-control--thin">
|
|
|
|
<label className="inline-block">Always use vertical layout
|
|
|
|
<input type="checkbox"
|
|
|
|
name="forceVerticalLayout"
|
|
|
|
checked={settings.forceVerticalLayout}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
2017-01-24 22:18:11 +00:00
|
|
|
|
2017-06-07 00:07:09 +00:00
|
|
|
{!isMac() && (
|
2017-05-17 16:35:44 +00:00
|
|
|
<div className="form-control form-control--thin">
|
|
|
|
<label className="inline-block">Hide Menu Bar
|
|
|
|
<input type="checkbox"
|
|
|
|
name="autoHideMenuBar"
|
|
|
|
checked={settings.autoHideMenuBar}
|
|
|
|
onChange={this._handleToggleMenuBar}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
2017-06-07 00:07:09 +00:00
|
|
|
)}
|
2017-05-17 16:35:44 +00:00
|
|
|
|
2017-02-13 08:12:02 +00:00
|
|
|
<div className="form-control form-control--thin">
|
|
|
|
<label className="inline-block">Wrap Long Lines
|
|
|
|
<input type="checkbox"
|
|
|
|
name="editorLineWrapping"
|
|
|
|
checked={settings.editorLineWrapping}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
2017-06-01 13:35:29 +00:00
|
|
|
<div className="form-control form-control--thin">
|
2017-06-09 21:42:19 +00:00
|
|
|
<label className="inline-block">
|
|
|
|
Disable Usage Tracking
|
|
|
|
{' '}
|
|
|
|
<HelpTooltip>Requires restart to take effect</HelpTooltip>
|
2017-06-01 13:35:29 +00:00
|
|
|
<input type="checkbox"
|
|
|
|
name="disableAnalyticsTracking"
|
|
|
|
checked={settings.disableAnalyticsTracking}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
2017-02-13 08:12:02 +00:00
|
|
|
<div className="form-row">
|
|
|
|
<div className="form-control form-control--outlined pad-top-sm">
|
|
|
|
<label>Text Editor Font Size (px)
|
|
|
|
<input type="number"
|
|
|
|
name="editorFontSize"
|
|
|
|
min={8}
|
|
|
|
max={20}
|
|
|
|
defaultValue={settings.editorFontSize}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
2017-04-14 21:47:15 +00:00
|
|
|
<div className="form-control form-control--outlined pad-top-sm">
|
|
|
|
<label>Text Editor Indent Size
|
2017-06-07 00:07:09 +00:00
|
|
|
<input type="number"
|
|
|
|
name="editorIndentSize"
|
|
|
|
min={1}
|
|
|
|
max={16}
|
|
|
|
defaultValue={settings.editorIndentSize}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
2017-04-14 21:47:15 +00:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
2017-02-13 08:12:02 +00:00
|
|
|
<div className="form-control form-control--outlined pad-top-sm">
|
2017-03-28 22:45:23 +00:00
|
|
|
<label>Text Editor Key Map
|
2017-02-13 08:12:02 +00:00
|
|
|
<select defaultValue={settings.editorKeyMap}
|
|
|
|
name="editorKeyMap"
|
|
|
|
onChange={this._handleUpdateSetting}>
|
|
|
|
<option value="default">Default</option>
|
|
|
|
<option value="vim">Vim</option>
|
|
|
|
<option value="emacs">Emacs</option>
|
2017-06-22 17:17:59 +00:00
|
|
|
<option value="sublime">Sublime</option>
|
2017-02-13 08:12:02 +00:00
|
|
|
</select>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="form-control form-control--outlined">
|
2017-03-28 22:45:23 +00:00
|
|
|
<label>Network Request Timeout
|
|
|
|
<HelpTooltip className="space-left">
|
|
|
|
Request timeout in milliseconds (0 for no timeout)
|
|
|
|
</HelpTooltip>
|
2017-02-13 08:12:02 +00:00
|
|
|
<input type="number"
|
|
|
|
name="timeout"
|
|
|
|
min={0}
|
|
|
|
defaultValue={settings.timeout}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
2017-03-28 22:45:23 +00:00
|
|
|
<hr className="pad-top"/>
|
2017-03-29 02:21:49 +00:00
|
|
|
|
|
|
|
<h2>
|
|
|
|
HTTP Network Proxy
|
|
|
|
<HelpTooltip className="space-left txt-md" style={{maxWidth: '20rem', lineWrap: 'word'}}>
|
|
|
|
Enable global network proxy. Supports authentication via Basic Auth, digest, or NTLM
|
|
|
|
</HelpTooltip>
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
<div className="form-control form-control--thin">
|
|
|
|
<label className="inline-block">Enable Proxy
|
|
|
|
<input type="checkbox"
|
|
|
|
name="proxyEnabled"
|
|
|
|
checked={settings.proxyEnabled}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="form-row pad-top-sm">
|
2017-02-13 08:12:02 +00:00
|
|
|
<div className="form-control form-control--outlined">
|
|
|
|
<label>HTTP Proxy
|
|
|
|
<input type="text"
|
|
|
|
name="httpProxy"
|
2017-03-28 22:45:23 +00:00
|
|
|
disabled={!settings.proxyEnabled}
|
2017-02-13 08:12:02 +00:00
|
|
|
placeholder="localhost:8005"
|
|
|
|
defaultValue={settings.httpProxy}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<div className="form-control form-control--outlined">
|
|
|
|
<label>HTTPS Proxy
|
|
|
|
<input placeholder="localhost:8005"
|
2017-03-28 22:45:23 +00:00
|
|
|
disabled={!settings.proxyEnabled}
|
2017-02-13 08:12:02 +00:00
|
|
|
name="httpsProxy"
|
|
|
|
type="text"
|
|
|
|
defaultValue={settings.httpsProxy}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
2017-06-06 20:21:59 +00:00
|
|
|
<div className="form-control form-control--outlined">
|
2017-06-07 00:07:09 +00:00
|
|
|
<label>
|
|
|
|
No Proxy <HelpTooltip>Comma-separated list of hostnames that do not require a
|
|
|
|
proxy to be contacted</HelpTooltip>
|
2017-06-06 20:21:59 +00:00
|
|
|
<input placeholder="localhost,127.0.0.1"
|
|
|
|
disabled={!settings.proxyEnabled}
|
|
|
|
name="noProxy"
|
|
|
|
type="text"
|
|
|
|
defaultValue={settings.noProxy}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
2017-02-13 08:12:02 +00:00
|
|
|
</div>
|
2017-07-20 01:55:40 +00:00
|
|
|
|
|
|
|
<hr className="pad-top"/>
|
|
|
|
|
|
|
|
<h2>Plugins</h2>
|
|
|
|
|
|
|
|
<div className="form-control form-control--outlined">
|
|
|
|
<label>
|
|
|
|
Additional Plugin Path <HelpTooltip>Tell Insomnia to look for plugins in a different
|
|
|
|
directory</HelpTooltip>
|
|
|
|
<input placeholder="~/.insomnia:/other/path"
|
|
|
|
name="pluginPath"
|
|
|
|
type="text"
|
|
|
|
defaultValue={settings.pluginPath}
|
|
|
|
onChange={this._handleUpdateSetting}/>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
2017-02-13 08:12:02 +00:00
|
|
|
<br/>
|
2016-11-07 20:24:38 +00:00
|
|
|
</div>
|
2017-03-03 20:09:08 +00:00
|
|
|
);
|
2017-02-13 08:12:02 +00:00
|
|
|
}
|
|
|
|
}
|
2016-11-07 20:24:38 +00:00
|
|
|
|
2017-03-08 05:52:17 +00:00
|
|
|
General.propTypes = {
|
2016-11-07 20:24:38 +00:00
|
|
|
settings: PropTypes.object.isRequired,
|
2017-05-17 16:35:44 +00:00
|
|
|
updateSetting: PropTypes.func.isRequired,
|
|
|
|
handleToggleMenuBar: PropTypes.func.isRequired
|
2016-11-07 20:24:38 +00:00
|
|
|
};
|
|
|
|
|
2017-03-08 05:52:17 +00:00
|
|
|
export default General;
|