From abfede7d3f97b12cc0a0b7c93980fa9b98fe4b11 Mon Sep 17 00:00:00 2001 From: kshitijaDharwadkar Date: Wed, 29 Apr 2015 12:34:41 +0530 Subject: [PATCH 1/3] Copy Node not appearing for request in huge project --- src/main/resources/static/css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/static/css/style.css b/src/main/resources/static/css/style.css index ac8ffa5..9c5258b 100644 --- a/src/main/resources/static/css/style.css +++ b/src/main/resources/static/css/style.css @@ -217,7 +217,7 @@ ul.fancytree-container { .rf-col-2 { left: 17%; border-right: 1px solid lightgray; - height: 100%; + height: 95%; position: fixed; overflow-y: hidden; width:33%; From b104043921867f07514e50a52bdbbab5120015cb Mon Sep 17 00:00:00 2001 From: kshitijaDharwadkar Date: Wed, 29 Apr 2015 13:07:43 +0530 Subject: [PATCH 2/3] Do not allow starring if request is null --- .../resources/static/js/views/star-view.js | 61 ++++++++++--------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/src/main/resources/static/js/views/star-view.js b/src/main/resources/static/js/views/star-view.js index 16e0f18..a84057e 100644 --- a/src/main/resources/static/js/views/star-view.js +++ b/src/main/resources/static/js/views/star-view.js @@ -113,40 +113,43 @@ var StarView = Backbone.View.extend({ console.log("Event star a node was fired for node Id " + ""); if (APP.appView.getCurrentRequestNodeId() != null) { var nodeId; - if($('#tree').css('display') == "none"){ + if($('#tree').css('display') == "none" && $('#currentStaredNode').val() != null){ nodeId = $('#currentStaredNode').val(); }else{ nodeId = APP.appView.getCurrentRequestNodeId(); } console.log("conversation id is ..." + APP.appView.getCurrentRequestNodeId()); - var node = new NodeModel({ - id : nodeId - }); - node.fetch({ - success : function(response) { - var starred = !response.get("starred"); - var starModel = new StarModel(); - starModel.set('id', nodeId); - starModel.set('starred', !response.get("starred")); - starModel.save(null, { - success: function () { - console.log("changes saves successfully"); - if($('#starred-items').css('display') == 'block'){ - $('.starred ').click(); - } - if(starred){ - $('#starNodeBtn').html(' Unstar'); - } - else{ - $('#starNodeBtn').html(' Star'); - } - }, - error: function () { - alert('some error occured while saving the request'); - } - }); - } - }); + if(nodeId){ + var node = new NodeModel({ + id : nodeId + }); + node.fetch({ + success : function(response) { + var starred = !response.get("starred"); + var starModel = new StarModel(); + starModel.set('id', nodeId); + starModel.set('starred', !response.get("starred")); + starModel.save(null, { + success: function () { + console.log("changes saves successfully"); + if($('#starred-items').css('display') == 'block'){ + $('.starred ').click(); + } + if(starred){ + $('#starNodeBtn').html(' Unstar'); + } + else{ + $('#starNodeBtn').html(' Star'); + } + }, + error: function () { + alert('some error occured while saving the request'); + } + }); + } + }); + } + } }, From 3bbd59ef38f527c5af3fceb0ad152b1b8c0ce10f Mon Sep 17 00:00:00 2001 From: kshitijaDharwadkar Date: Wed, 29 Apr 2015 15:29:10 +0530 Subject: [PATCH 3/3] Ability to add EL to request url --- .../static/js/views/conversation-view.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/resources/static/js/views/conversation-view.js b/src/main/resources/static/js/views/conversation-view.js index 4402a46..f3519d6 100644 --- a/src/main/resources/static/js/views/conversation-view.js +++ b/src/main/resources/static/js/views/conversation-view.js @@ -9,6 +9,7 @@ define(function(require) { var AssertView = require('views/assert-view'); var TreeView = require('views/tree-view'); var ManageEnvironmentView = require('views/environment-view'); + var Environments = require('collections/environments'); require('libs/prettify/prettify'); require('typeahead'); @@ -393,6 +394,29 @@ define(function(require) { if(event.keyCode == 13){ $("#run").click(); } + }); + $("#apiUrl").change(function(event){ + var evaluationExp = /(\{{)(.+)(\}})/ + var apiUrlValue = event.currentTarget.value; + var matchedData = apiUrlValue.match(evaluationExp); + if(matchedData.length && matchedData[2]){ + var environments = new Environments(); + environments.fetch({ + success : function(response){ + var currenctEnv = _.findWhere(response.models,{id : $(".environmentsSelectBox").val()}); + var currenctEnvProperties = currenctEnv.get('properties'); + _.each(currenctEnvProperties,function(property,index){ + if(matchedData[2] == property.propertyName){ + var evaluatedValue = apiUrlValue.replace('{{'+property.propertyName +'}}',property.propertyValue); + $('#apiUrl').typeahead('val', evaluatedValue); + } + }) + } + }) + } + + + }); $("#run").unbind('click').bind("click", function(view){