@@ -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