Skip to content

Commit

Permalink
Merge pull request #256 from kshiji/master
Browse files Browse the repository at this point in the history
UI Fixes Part 4
  • Loading branch information
AnujaK committed Apr 29, 2015
2 parents 772ccc9 + 3bbd59e commit 2b47a84
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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%;
Expand Down
24 changes: 24 additions & 0 deletions src/main/resources/static/js/views/conversation-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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){
Expand Down
61 changes: 32 additions & 29 deletions src/main/resources/static/js/views/star-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<span class="glyphicon glyphicon-star"></span>&nbsp;Unstar');
}
else{
$('#starNodeBtn').html('<span class="glyphicon glyphicon-star"></span>&nbsp;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('<span class="glyphicon glyphicon-star"></span>&nbsp;Unstar');
}
else{
$('#starNodeBtn').html('<span class="glyphicon glyphicon-star"></span>&nbsp;Star');
}
},
error: function () {
alert('some error occured while saving the request');
}
});
}
});
}

}
},

Expand Down

0 comments on commit 2b47a84

Please sign in to comment.