A few improvements to tag editor enum

This commit is contained in:
Gregory Schier 2017-05-23 15:15:55 -07:00
parent 85c98fc84d
commit 91ad40497b
2 changed files with 11 additions and 19 deletions

View File

@ -6,7 +6,6 @@ import * as models from '../../models';
import BaseExtension from './base/base-extension';
export default class ResponseExtension extends BaseExtension {
<<<<<<< HEAD
getName () {
return 'Response Value';
}
@ -30,9 +29,9 @@ export default class ResponseExtension extends BaseExtension {
label: 'Attribute',
type: 'enum',
options: [
{name: 'Body attribute of response body', value: 'body'},
{name: 'Raw Body entire response body', value: 'raw'},
{name: 'Header value of response header', value: 'header'}
{name: 'Body', description: 'attribute of response body', value: 'body'},
{name: 'Raw Body', description: 'entire response body', value: 'raw'},
{name: 'Header', description: 'value of response header', value: 'header'}
]
},
{
@ -61,15 +60,6 @@ export default class ResponseExtension extends BaseExtension {
async run (context, field, id, filter) {
if (!['body', 'header', 'raw'].includes(field)) {
=======
constructor () {
super();
this.tags = ['response'];
}
async run (context, field, id, query) {
if (field !== 'body') {
>>>>>>> improvement/better-response-tag
throw new Error(`Invalid response field ${field}`);
}
@ -159,7 +149,6 @@ export default class ResponseExtension extends BaseExtension {
}
return results[0].childNodes.toString();
<<<<<<< HEAD
}
matchHeader (headers, name) {
@ -172,7 +161,5 @@ export default class ResponseExtension extends BaseExtension {
}
return header.value;
=======
>>>>>>> improvement/better-response-tag
}
}

View File

@ -7,8 +7,6 @@ import * as db from '../../../common/database';
import {types as allModelTypes} from '../../../models';
import HelpTooltip from '../help-tooltip';
const CUSTOM_TAG_VALUE = `{% custom 'tag' %}`;
@autobind
class TagEditor extends PureComponent {
constructor (props) {
@ -163,9 +161,16 @@ class TagEditor extends PureComponent {
return (
<select value={value} onChange={this._handleChange}>
{options.map(option => {
let label;
if (option.description) {
label = `${option.name} ${option.description}`;
} else {
label = option.name;
}
return (
<option key={option.value} value={option.value}>
{option.name}
{label}
</option>
);
})}