Skip to content

Commit 3bbd59e

Browse files
committed
Ability to add EL to request url
1 parent b104043 commit 3bbd59e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/main/resources/static/js/views/conversation-view.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ define(function(require) {
99
var AssertView = require('views/assert-view');
1010
var TreeView = require('views/tree-view');
1111
var ManageEnvironmentView = require('views/environment-view');
12+
var Environments = require('collections/environments');
1213

1314
require('libs/prettify/prettify');
1415
require('typeahead');
@@ -393,6 +394,29 @@ define(function(require) {
393394
if(event.keyCode == 13){
394395
$("#run").click();
395396
}
397+
});
398+
$("#apiUrl").change(function(event){
399+
var evaluationExp = /(\{{)(.+)(\}})/
400+
var apiUrlValue = event.currentTarget.value;
401+
var matchedData = apiUrlValue.match(evaluationExp);
402+
if(matchedData.length && matchedData[2]){
403+
var environments = new Environments();
404+
environments.fetch({
405+
success : function(response){
406+
var currenctEnv = _.findWhere(response.models,{id : $(".environmentsSelectBox").val()});
407+
var currenctEnvProperties = currenctEnv.get('properties');
408+
_.each(currenctEnvProperties,function(property,index){
409+
if(matchedData[2] == property.propertyName){
410+
var evaluatedValue = apiUrlValue.replace('{{'+property.propertyName +'}}',property.propertyValue);
411+
$('#apiUrl').typeahead('val', evaluatedValue);
412+
}
413+
})
414+
}
415+
})
416+
}
417+
418+
419+
396420
});
397421

398422
$("#run").unbind('click').bind("click", function(view){

0 commit comments

Comments
 (0)