add setting to (de)activate live display names in template tags

This commit is contained in:
Alfonso Ruzafa 2020-02-12 09:51:22 +01:00
parent 2e20155d67
commit 8cd70b87b5
35 changed files with 134 additions and 5 deletions

View File

@ -39,6 +39,7 @@ type BaseSettings = {
maxRedirects: number,
maxTimelineDataSizeKB: number,
noProxy: string,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
pluginPath: string,
proxyEnabled: boolean,
@ -92,6 +93,7 @@ export function init(): BaseSettings {
maxRedirects: -1,
maxTimelineDataSizeKB: 10,
noProxy: '',
nunjucksLiveDisplayName: false,
nunjucksPowerUserMode: false,
pluginPath: '',
proxyEnabled: false,

View File

@ -371,6 +371,7 @@ class CodeEditor extends React.Component {
this.props.render,
this.props.getRenderContext,
this.props.isVariableUncovered,
this.props.nunjucksLiveDisplayName,
);
}
@ -996,6 +997,7 @@ CodeEditor.propTypes = {
onPaste: PropTypes.func,
onCodeMirrorInit: PropTypes.func,
render: PropTypes.func,
nunjucksLiveDisplayName: PropTypes.bool,
nunjucksPowerUserMode: PropTypes.bool,
getRenderContext: PropTypes.func,
getAutocompleteConstants: PropTypes.func,

View File

@ -9,6 +9,7 @@ CodeMirror.defineExtension('enableNunjucksTags', function(
handleRender,
handleGetRenderContext,
isVariableUncovered = false,
useLiveDisplayName,
) {
if (!handleRender) {
console.warn("enableNunjucksTags wasn't passed a render function");
@ -20,6 +21,7 @@ CodeMirror.defineExtension('enableNunjucksTags', function(
handleRender,
handleGetRenderContext,
isVariableUncovered,
useLiveDisplayName,
);
const debouncedRefreshFn = misc.debounce(refreshFn);
@ -41,7 +43,7 @@ CodeMirror.defineExtension('enableNunjucksTags', function(
refreshFn();
});
async function _highlightNunjucksTags(render, renderContext, isVariableUncovered) {
async function _highlightNunjucksTags(render, renderContext, isVariableUncovered, useLiveDisplayName) {
const renderCacheKey = Math.random() + '';
const renderString = text => render(text, renderCacheKey);
const activeMarks = [];
@ -126,6 +128,7 @@ async function _highlightNunjucksTags(render, renderContext, isVariableUncovered
tok.string,
renderContext,
isVariableUncovered,
useLiveDisplayName,
);
})();
@ -137,6 +140,7 @@ async function _highlightNunjucksTags(render, renderContext, isVariableUncovered
tok.string,
renderContext,
isVariableUncovered,
useLiveDisplayName,
);
});
@ -232,7 +236,7 @@ async function _highlightNunjucksTags(render, renderContext, isVariableUncovered
}
}
async function _updateElementText(render, mark, text, renderContext, isVariableUncovered) {
async function _updateElementText(render, mark, text, renderContext, isVariableUncovered, useLiveDisplayName) {
const el = mark.replacedWith;
let innerHTML = '';
@ -255,16 +259,18 @@ async function _updateElementText(render, mark, text, renderContext, isVariableU
const tagDefinition = (await getTagDefinitions()).find(d => d.name === tagData.name);
if (tagDefinition) {
const liveDisplayName = tagDefinition.liveDisplayName(tagData.args);
const displayName = useLiveDisplayName
? tagDefinition.liveDisplayName(tagData.args)
: tagDefinition.displayName;
// Try rendering these so we can show errors if needed
const firstArg = tagDefinition.args[0];
if (firstArg && firstArg.type === 'enum') {
const argData = tagData.args[0];
const foundOption = firstArg.options.find(d => d.value === argData.value);
const option = foundOption || firstArg.options[0];
innerHTML = `${liveDisplayName} ⇒ ${option.displayName}`;
innerHTML = `${displayName} ⇒ ${option.displayName}`;
} else {
innerHTML = liveDisplayName || tagData.name;
innerHTML = displayName || tagData.name;
}
title = await render(text);
} else {

View File

@ -299,6 +299,7 @@ class OneLineEditor extends PureComponent {
render,
onPaste,
getRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
getAutocompleteConstants,
isVariableUncovered,
@ -337,6 +338,7 @@ class OneLineEditor extends PureComponent {
onChange={onChange}
render={render}
getRenderContext={getRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
getAutocompleteConstants={getAutocompleteConstants}
className={classnames('editor--single-line', className)}
@ -386,6 +388,7 @@ OneLineEditor.propTypes = {
onPaste: PropTypes.func,
render: PropTypes.func,
getRenderContext: PropTypes.func,
nunjucksLiveDisplayName: PropTypes.bool,
nunjucksPowerUserMode: PropTypes.bool,
getAutocompleteConstants: PropTypes.func,
placeholder: PropTypes.string,

View File

@ -14,6 +14,7 @@ type Props = {
request: Request,
handleRender: Function,
handleGetRenderContext: Function,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
isVariableUncovered: boolean,
onChange: (Request, RequestAuthentication) => Promise<Request>,
@ -91,6 +92,7 @@ class AsapAuth extends React.PureComponent<Props> {
handleRender,
handleGetRenderContext,
request,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -115,6 +117,7 @@ class AsapAuth extends React.PureComponent<Props> {
mode={mode}
onChange={onChange}
defaultValue={authentication[property] || ''}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
render={handleRender}
getRenderContext={handleGetRenderContext}

View File

@ -32,6 +32,7 @@ type Props = {
handleRender: Function,
handleGetRenderContext: Function,
handleUpdateSettingsShowPasswords: (showPasswords: boolean) => Promise<Settings>,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
onChange: (Request, RequestAuthentication) => Promise<Request>,
request: Request,
@ -50,6 +51,7 @@ class AuthWrapper extends React.PureComponent<Props> {
request,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
handleUpdateSettingsShowPasswords,
onChange,
@ -66,6 +68,7 @@ class AuthWrapper extends React.PureComponent<Props> {
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
handleUpdateSettingsShowPasswords={handleUpdateSettingsShowPasswords}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
onChange={onChange}
showPasswords={showPasswords}
@ -79,6 +82,7 @@ class AuthWrapper extends React.PureComponent<Props> {
request={request}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
handleUpdateSettingsShowPasswords={handleUpdateSettingsShowPasswords}
onChange={onChange}
@ -92,6 +96,7 @@ class AuthWrapper extends React.PureComponent<Props> {
request={request}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
onChange={onChange}
isVariableUncovered={isVariableUncovered}
@ -103,6 +108,7 @@ class AuthWrapper extends React.PureComponent<Props> {
request={request}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
showPasswords={showPasswords}
onChange={onChange}
@ -116,6 +122,7 @@ class AuthWrapper extends React.PureComponent<Props> {
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
handleUpdateSettingsShowPasswords={handleUpdateSettingsShowPasswords}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
onChange={onChange}
showPasswords={showPasswords}
@ -128,6 +135,7 @@ class AuthWrapper extends React.PureComponent<Props> {
request={request}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
handleUpdateSettingsShowPasswords={handleUpdateSettingsShowPasswords}
onChange={onChange}
@ -141,6 +149,7 @@ class AuthWrapper extends React.PureComponent<Props> {
request={request}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
onChange={onChange}
isVariableUncovered={isVariableUncovered}
@ -153,6 +162,7 @@ class AuthWrapper extends React.PureComponent<Props> {
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
handleUpdateSettingsShowPasswords={handleUpdateSettingsShowPasswords}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
onChange={onChange}
showPasswords={showPasswords}
@ -167,6 +177,7 @@ class AuthWrapper extends React.PureComponent<Props> {
request={request}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
onChange={onChange}
isVariableUncovered={isVariableUncovered}

View File

@ -10,6 +10,7 @@ import type { Settings } from '../../../../models/settings';
type Props = {
request: Request,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
showPasswords: boolean,
isVariableUncovered: boolean,
@ -57,6 +58,7 @@ class AWSAuth extends React.PureComponent<Props> {
renderRow(key: string, label: string, onChange: Function, help?: string) {
const {
request,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
handleRender,
handleGetRenderContext,
@ -80,6 +82,7 @@ class AWSAuth extends React.PureComponent<Props> {
id={key}
onChange={onChange}
defaultValue={request.authentication[key] || ''}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
render={handleRender}
getRenderContext={handleGetRenderContext}

View File

@ -11,6 +11,7 @@ type Props = {
handleRender: Function,
handleGetRenderContext: Function,
handleUpdateSettingsShowPasswords: boolean => Promise<Settings>,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
onChange: (Request, RequestAuthentication) => Promise<Request>,
request: Request,
@ -44,6 +45,7 @@ class BasicAuth extends React.PureComponent<Props> {
showPasswords,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -71,6 +73,7 @@ class BasicAuth extends React.PureComponent<Props> {
disabled={authentication.disabled}
onChange={this._handleChangeUsername}
defaultValue={authentication.username || ''}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
render={handleRender}
getRenderContext={handleGetRenderContext}
@ -95,6 +98,7 @@ class BasicAuth extends React.PureComponent<Props> {
id="password"
onChange={this._handleChangePassword}
defaultValue={authentication.password || ''}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
render={handleRender}
getRenderContext={handleGetRenderContext}

View File

@ -10,6 +10,7 @@ import type { Request, RequestAuthentication } from '../../../../models/request'
type Props = {
handleRender: Function,
handleGetRenderContext: Function,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
request: Request,
onChange: (Request, RequestAuthentication) => Promise<Request>,
@ -41,6 +42,7 @@ class BearerAuth extends React.PureComponent<Props> {
request,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -68,6 +70,7 @@ class BearerAuth extends React.PureComponent<Props> {
disabled={authentication.disabled}
onChange={this._handleChangeToken}
defaultValue={authentication.token || ''}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
render={handleRender}
getRenderContext={handleGetRenderContext}
@ -96,6 +99,7 @@ class BearerAuth extends React.PureComponent<Props> {
disabled={authentication.disabled}
onChange={this._handleChangePrefix}
defaultValue={authentication.prefix || ''}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
render={handleRender}
getRenderContext={handleGetRenderContext}

View File

@ -12,6 +12,7 @@ type Props = {
handleRender: Function,
handleGetRenderContext: Function,
handleUpdateSettingsShowPasswords: boolean => Promise<Settings>,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
onChange: (Request, RequestAuthentication) => Promise<Request>,
request: Request,
@ -44,6 +45,7 @@ class DigestAuth extends React.PureComponent<Props> {
request,
showPasswords,
handleRender,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
handleGetRenderContext,
isVariableUncovered,
@ -72,6 +74,7 @@ class DigestAuth extends React.PureComponent<Props> {
disabled={authentication.disabled}
onChange={this._handleChangeUsername}
defaultValue={authentication.username || ''}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
render={handleRender}
getRenderContext={handleGetRenderContext}
@ -96,6 +99,7 @@ class DigestAuth extends React.PureComponent<Props> {
id="password"
onChange={this._handleChangePassword}
defaultValue={authentication.password || ''}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
render={handleRender}
getRenderContext={handleGetRenderContext}

View File

@ -13,6 +13,7 @@ type Props = {
request: Request,
handleRender: Function,
handleGetRenderContext: Function,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
isVariableUncovered: boolean,
onChange: (Request, RequestAuthentication) => Promise<Request>,
@ -122,6 +123,7 @@ class HawkAuth extends React.PureComponent<Props> {
handleRender,
handleGetRenderContext,
request,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -146,6 +148,7 @@ class HawkAuth extends React.PureComponent<Props> {
type="text"
onChange={onChange}
defaultValue={authentication[property] || ''}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
render={handleRender}
getRenderContext={handleGetRenderContext}

View File

@ -11,6 +11,7 @@ type Props = {
handleRender: Function,
handleGetRenderContext: Function,
handleUpdateSettingsShowPasswords: boolean => Promise<Settings>,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
onChange: (Request, RequestAuthentication) => Promise<Request>,
request: Request,
@ -44,6 +45,7 @@ class NTLMAuth extends React.PureComponent<Props> {
showPasswords,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -71,6 +73,7 @@ class NTLMAuth extends React.PureComponent<Props> {
disabled={authentication.disabled}
onChange={this._handleChangeUsername}
defaultValue={authentication.username || ''}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
render={handleRender}
getRenderContext={handleGetRenderContext}
@ -95,6 +98,7 @@ class NTLMAuth extends React.PureComponent<Props> {
id="password"
onChange={this._handleChangePassword}
defaultValue={authentication.password || ''}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
render={handleRender}
getRenderContext={handleGetRenderContext}

View File

@ -18,6 +18,7 @@ import Button from '../../base/button';
type Props = {
handleRender: Function,
handleGetRenderContext: Function,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
showPasswords: boolean,
isVariableUncovered: boolean,
@ -195,6 +196,7 @@ class OAuth1Auth extends React.PureComponent<Props> {
handleRender,
handleGetRenderContext,
request,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -220,6 +222,7 @@ class OAuth1Auth extends React.PureComponent<Props> {
onChange={onChange}
defaultValue={request.authentication[property] || ''}
render={handleRender}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
getAutocompleteConstants={handleAutocomplete}
getRenderContext={handleGetRenderContext}

View File

@ -32,6 +32,7 @@ type Props = {
handleRender: Function,
handleGetRenderContext: Function,
handleUpdateSettingsShowPasswords: boolean => Promise<Settings>,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
onChange: (Request, RequestAuthentication) => Promise<Request>,
request: Request,
@ -246,6 +247,7 @@ class OAuth2Auth extends React.PureComponent<Props, State> {
handleRender,
handleGetRenderContext,
request,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -271,6 +273,7 @@ class OAuth2Auth extends React.PureComponent<Props, State> {
onChange={onChange}
defaultValue={request.authentication[property] || ''}
render={handleRender}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
getAutocompleteConstants={handleAutocomplete}
getRenderContext={handleGetRenderContext}

View File

@ -140,6 +140,7 @@ class BodyEditor extends React.PureComponent<Props> {
onChange={this._handleFormUrlEncodedChange}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
parameters={request.body.params || []}
@ -152,6 +153,7 @@ class BodyEditor extends React.PureComponent<Props> {
onChange={this._handleFormChange}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
parameters={request.body.params || []}
@ -171,6 +173,7 @@ class BodyEditor extends React.PureComponent<Props> {
settings={settings}
environmentId={environmentId}
getRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
onChange={this._handleGraphQLChange}
@ -190,6 +193,7 @@ class BodyEditor extends React.PureComponent<Props> {
content={request.body.text || ''}
render={handleRender}
getRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
onChange={this._handleRawChange}

View File

@ -11,6 +11,7 @@ class FormEditor extends PureComponent {
onChange,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -27,6 +28,7 @@ class FormEditor extends PureComponent {
descriptionPlaceholder="description"
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
onChange={onChange}
@ -42,6 +44,7 @@ FormEditor.propTypes = {
// Required
onChange: PropTypes.func.isRequired,
parameters: PropTypes.arrayOf(PropTypes.object).isRequired,
nunjucksLiveDisplayName: PropTypes.bool.isRequired,
nunjucksPowerUserMode: PropTypes.bool.isRequired,
isVariableUncovered: PropTypes.bool.isRequired,

View File

@ -669,6 +669,7 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
getAutocompleteConstants={() => Object.keys(variableTypes || {})}
lintOptions={{ variableToType: variableTypes }}
noLint={!variableTypes}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
onChange={this._handleVariablesChange}

View File

@ -16,6 +16,7 @@ class RawEditor extends PureComponent {
keyMap,
lineWrapping,
indentWithTabs,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
onChange,
@ -36,6 +37,7 @@ class RawEditor extends PureComponent {
className={className}
render={render}
getRenderContext={getRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
onChange={onChange}
@ -57,6 +59,7 @@ RawEditor.propTypes = {
indentSize: PropTypes.number.isRequired,
keyMap: PropTypes.string.isRequired,
lineWrapping: PropTypes.bool.isRequired,
nunjucksLiveDisplayName: PropTypes.bool.isRequired,
nunjucksPowerUserMode: PropTypes.bool.isRequired,
uniquenessKey: PropTypes.string.isRequired,
isVariableUncovered: PropTypes.bool.isRequired,

View File

@ -11,6 +11,7 @@ class UrlEncodedEditor extends PureComponent {
onChange,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -27,6 +28,7 @@ class UrlEncodedEditor extends PureComponent {
onChange={onChange}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
pairs={parameters}
@ -41,6 +43,7 @@ UrlEncodedEditor.propTypes = {
// Required
onChange: PropTypes.func.isRequired,
parameters: PropTypes.arrayOf(PropTypes.object).isRequired,
nunjucksLiveDisplayName: PropTypes.bool.isRequired,
nunjucksPowerUserMode: PropTypes.bool.isRequired,
isVariableUncovered: PropTypes.bool.isRequired,

View File

@ -17,6 +17,7 @@ type Props = {
editorKeyMap: string,
render: Function,
getRenderContext: Function,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
isVariableUncovered: boolean,
lineWrapping: boolean,
@ -100,6 +101,7 @@ class EnvironmentEditor extends React.PureComponent<Props, State> {
editorKeyMap,
render,
getRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
lineWrapping,
@ -125,6 +127,7 @@ class EnvironmentEditor extends React.PureComponent<Props, State> {
keyMap={editorKeyMap}
onChange={this._handleChange}
defaultValue={defaultValue}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
render={render}

View File

@ -16,6 +16,7 @@ type Props = {
editorFontSize: number,
editorIndentSize: number,
editorLineWrapping: boolean,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
isVariableUncovered: boolean,
handleRender: Function,
@ -106,6 +107,7 @@ class RequestHeadersEditor extends React.PureComponent<Props> {
editorLineWrapping,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -115,6 +117,7 @@ class RequestHeadersEditor extends React.PureComponent<Props> {
<CodeEditor
getRenderContext={handleGetRenderContext}
render={handleRender}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
fontSize={editorFontSize}
@ -133,6 +136,7 @@ class RequestHeadersEditor extends React.PureComponent<Props> {
valuePlaceholder="value"
descriptionPlaceholder="description"
pairs={request.headers}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
handleRender={handleRender}

View File

@ -12,6 +12,7 @@ type Props = {
editorFontSize: number,
editorIndentSize: number,
editorLineWrapping: boolean,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
isVariableUncovered: boolean,
handleRender: Function,
@ -84,6 +85,7 @@ class RequestParametersEditor extends React.PureComponent<Props> {
editorLineWrapping,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -92,6 +94,7 @@ class RequestParametersEditor extends React.PureComponent<Props> {
<CodeEditor
getRenderContext={handleGetRenderContext}
render={handleRender}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
fontSize={editorFontSize}
@ -108,6 +111,7 @@ class RequestParametersEditor extends React.PureComponent<Props> {
valuePlaceholder="value"
descriptionPlaceholder="description"
pairs={request.parameters}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
handleRender={handleRender}

View File

@ -362,6 +362,7 @@ class Editor extends PureComponent {
descriptionPlaceholder,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
handleGetAutocompleteNameConstants,
@ -400,6 +401,7 @@ class Editor extends PureComponent {
onBlurValue={this._handleBlurValue}
onBlurDescription={this._handleBlurDescription}
onMove={this._handleMove}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
handleRender={handleRender}
@ -460,6 +462,7 @@ Editor.propTypes = {
// Optional
handleRender: PropTypes.func,
handleGetRenderContext: PropTypes.func,
nunjucksLiveDisplayName: PropTypes.bool,
nunjucksPowerUserMode: PropTypes.bool,
isVariableUncovered: PropTypes.bool,
handleGetAutocompleteNameConstants: PropTypes.func,

View File

@ -201,6 +201,7 @@ class KeyValueEditorRow extends PureComponent {
pair,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -225,6 +226,7 @@ class KeyValueEditorRow extends PureComponent {
onFocus={this._handleFocusDescription}
render={handleRender}
getRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
/>
@ -241,6 +243,7 @@ class KeyValueEditorRow extends PureComponent {
valuePlaceholder,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -282,6 +285,7 @@ class KeyValueEditorRow extends PureComponent {
onFocus={this._handleFocusValue}
render={handleRender}
getRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
getAutocompleteConstants={this._handleAutocompleteValues}
@ -342,6 +346,7 @@ class KeyValueEditorRow extends PureComponent {
namePlaceholder,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
sortable,
@ -396,6 +401,7 @@ class KeyValueEditorRow extends PureComponent {
defaultValue={pair.name}
render={handleRender}
getRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
getAutocompleteConstants={this._handleAutocompleteNames}
@ -489,6 +495,7 @@ KeyValueEditorRow.propTypes = {
onBlurDescription: PropTypes.func,
handleRender: PropTypes.func,
handleGetRenderContext: PropTypes.func,
nunjucksLiveDisplayName: PropTypes.bool,
nunjucksPowerUserMode: PropTypes.bool,
isVariableUncovered: PropTypes.bool,
handleGetAutocompleteNameConstants: PropTypes.func,

View File

@ -46,6 +46,7 @@ class MarkdownEditor extends PureComponent {
tall,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -85,6 +86,7 @@ class MarkdownEditor extends PureComponent {
defaultValue={markdown}
render={handleRender}
getRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
onChange={this._handleChange}
@ -110,6 +112,7 @@ MarkdownEditor.propTypes = {
lineWrapping: PropTypes.bool.isRequired,
handleRender: PropTypes.func.isRequired,
handleGetRenderContext: PropTypes.func.isRequired,
nunjucksLiveDisplayName: PropTypes.bool.isRequired,
nunjucksPowerUserMode: PropTypes.bool.isRequired,
isVariableUncovered: PropTypes.bool.isRequired,

View File

@ -90,6 +90,7 @@ class CodePromptModal extends PureComponent {
render() {
const {
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
handleRender,
@ -128,6 +129,7 @@ class CodePromptModal extends PureComponent {
indentSize={editorIndentSize}
fontSize={editorFontSize}
lineWrapping={editorLineWrapping}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
/>
@ -141,6 +143,7 @@ class CodePromptModal extends PureComponent {
defaultValue={defaultValue}
placeholder={placeholder}
onChange={this._handleChange}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
getRenderContext={enableRender ? handleGetRenderContext : null}
@ -187,6 +190,7 @@ CodePromptModal.propTypes = {
editorIndentSize: PropTypes.number.isRequired,
editorKeyMap: PropTypes.string.isRequired,
editorLineWrapping: PropTypes.bool.isRequired,
nunjucksLiveDisplayName: PropTypes.bool.isRequired,
nunjucksPowerUserMode: PropTypes.bool.isRequired,
isVariableUncovered: PropTypes.bool.isRequired,

View File

@ -18,6 +18,7 @@ import type { Workspace } from '../../../models/workspace';
type Props = {
handleRender: Function,
handleGetRenderContext: Function,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
isVariableUncovered: boolean,
workspace: Workspace,
@ -186,6 +187,7 @@ class CookieModifyModal extends React.PureComponent<Props, State> {
const {
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -203,6 +205,7 @@ class CookieModifyModal extends React.PureComponent<Props, State> {
<OneLineEditor
render={handleRender}
getRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
defaultValue={val || ''}

View File

@ -73,6 +73,7 @@ class EnvironmentEditModal extends PureComponent {
lineWrapping,
render,
getRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
...extraProps
@ -100,6 +101,7 @@ class EnvironmentEditModal extends PureComponent {
didChange={this._didChange}
render={render}
getRenderContext={getRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
/>
@ -124,6 +126,7 @@ EnvironmentEditModal.propTypes = {
editorKeyMap: PropTypes.string.isRequired,
render: PropTypes.func.isRequired,
getRenderContext: PropTypes.func.isRequired,
nunjucksLiveDisplayName: PropTypes.bool.isRequired,
nunjucksPowerUserMode: PropTypes.bool.isRequired,
isVariableUncovered: PropTypes.bool.isRequired,
lineWrapping: PropTypes.bool.isRequired,

View File

@ -17,6 +17,7 @@ type Props = {
editorIndentSize: number,
editorKeyMap: string,
editorLineWrapping: boolean,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
isVariableUncovered: boolean,
handleRender: Function,
@ -222,6 +223,7 @@ class RequestSettingsModal extends React.PureComponent<Props, State> {
editorKeyMap,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
workspaces,
@ -263,6 +265,7 @@ class RequestSettingsModal extends React.PureComponent<Props, State> {
lineWrapping={editorLineWrapping}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
defaultValue={request.description}

View File

@ -31,6 +31,7 @@ type Props = {
lineWrapping: boolean,
render: Function,
getRenderContext: Function,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
isVariableUncovered: boolean,
};
@ -386,6 +387,7 @@ class WorkspaceEnvironmentsEditModal extends React.PureComponent<Props, State> {
lineWrapping,
render,
getRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -518,6 +520,7 @@ class WorkspaceEnvironmentsEditModal extends React.PureComponent<Props, State> {
didChange={this._didChange}
render={render}
getRenderContext={getRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
/>

View File

@ -21,6 +21,7 @@ type Props = {
editorIndentSize: number,
editorKeyMap: string,
editorLineWrapping: boolean,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
isVariableUncovered: boolean,
handleRender: Function,
@ -258,6 +259,7 @@ class WorkspaceSettingsModal extends React.PureComponent<Props, State> {
editorKeyMap,
handleRender,
handleGetRenderContext,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
} = this.props;
@ -311,6 +313,7 @@ class WorkspaceSettingsModal extends React.PureComponent<Props, State> {
lineWrapping={editorLineWrapping}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
defaultValue={workspace.description}

View File

@ -264,6 +264,7 @@ class RequestPane extends React.PureComponent<Props> {
handleSend={handleSend}
handleSendAndDownload={handleSendAndDownload}
handleRender={handleRender}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
handleGetRenderContext={handleGetRenderContext}
@ -333,6 +334,7 @@ class RequestPane extends React.PureComponent<Props> {
settings={settings}
onChange={updateRequestBody}
onChangeHeaders={forceUpdateRequestHeaders}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
/>
@ -347,6 +349,7 @@ class RequestPane extends React.PureComponent<Props> {
handleUpdateSettingsShowPasswords={updateSettingsShowPasswords}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
onChange={updateRequestAuthentication}
@ -373,6 +376,7 @@ class RequestPane extends React.PureComponent<Props> {
key={headerEditorKey}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
editorFontSize={settings.editorFontSize}
@ -404,6 +408,7 @@ class RequestPane extends React.PureComponent<Props> {
key={headerEditorKey}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
editorFontSize={settings.editorFontSize}

View File

@ -30,6 +30,7 @@ type Props = {
handleSendAndDownload: (filepath?: string) => Promise<void>,
handleUpdateDownloadPath: Function,
isVariableUncovered: boolean,
nunjucksLiveDisplayName: boolean,
nunjucksPowerUserMode: boolean,
onMethodChange: (r: Request, method: string) => Promise<Request>,
onUrlChange: (r: Request, url: string) => Promise<Request>,
@ -335,6 +336,7 @@ class RequestUrlBar extends React.PureComponent<Props, State> {
const {
request,
handleRender,
nunjucksLiveDisplayName,
nunjucksPowerUserMode,
isVariableUncovered,
handleGetRenderContext,
@ -361,6 +363,7 @@ class RequestUrlBar extends React.PureComponent<Props, State> {
forceEditor
type="text"
render={handleRender}
nunjucksLiveDisplayName={nunjucksLiveDisplayName}
nunjucksPowerUserMode={nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
getAutocompleteConstants={handleAutocompleteUrls}

View File

@ -176,6 +176,7 @@ class General extends React.PureComponent<Props, State> {
{this.renderBooleanSetting('Reveal passwords', 'showPasswords', '')}
{!isMac() && this.renderBooleanSetting('Hide menu bar', 'autoHideMenuBar', '')}
{this.renderBooleanSetting('Raw template syntax', 'nunjucksPowerUserMode', '', true)}
{this.renderBooleanSetting('Live display tags', 'nunjucksLiveDisplayName', '', true)}
</div>
</div>
<div className="row-fill row-fill--top pad-top-sm">

View File

@ -563,6 +563,7 @@ class Wrapper extends React.PureComponent<Props, State> {
ref={registerModal}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
editorFontSize={settings.editorFontSize}
editorIndentSize={settings.editorIndentSize}
@ -579,6 +580,7 @@ class Wrapper extends React.PureComponent<Props, State> {
editorLineWrapping={settings.editorLineWrapping}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
workspaces={workspaces}
isVariableUncovered={isVariableUncovered}
@ -589,6 +591,7 @@ class Wrapper extends React.PureComponent<Props, State> {
<CookiesModal
handleShowModifyCookieModal={Wrapper._handleShowModifyCookieModal}
handleRender={handleRender}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
ref={registerModal}
workspace={activeWorkspace}
@ -600,6 +603,7 @@ class Wrapper extends React.PureComponent<Props, State> {
<CookieModifyModal
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
ref={registerModal}
cookieJar={activeCookieJar}
@ -627,6 +631,7 @@ class Wrapper extends React.PureComponent<Props, State> {
editorLineWrapping={settings.editorLineWrapping}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
handleRemoveWorkspace={this._handleRemoveActiveWorkspace}
handleDuplicateWorkspace={handleDuplicateWorkspace}
@ -677,6 +682,7 @@ class Wrapper extends React.PureComponent<Props, State> {
onChange={models.requestGroup.update}
render={handleRender}
getRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
/>
@ -718,6 +724,7 @@ class Wrapper extends React.PureComponent<Props, State> {
activeEnvironmentId={activeEnvironment ? activeEnvironment._id : null}
render={handleRender}
getRenderContext={handleGetRenderContext}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
/>
@ -810,6 +817,7 @@ class Wrapper extends React.PureComponent<Props, State> {
handleUpdateDownloadPath={handleUpdateDownloadPath}
headerEditorKey={headerEditorKey}
isVariableUncovered={isVariableUncovered}
nunjucksLiveDisplayName={settings.nunjucksLiveDisplayName}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
oAuth2Token={oAuth2Token}
request={activeRequest}