Skip to content

Commit 2b47a84

Browse files
committed
Merge pull request #256 from kshiji/master
UI Fixes Part 4
2 parents 772ccc9 + 3bbd59e commit 2b47a84

File tree

3 files changed

+57
-30
lines changed

3 files changed

+57
-30
lines changed

src/main/resources/static/css/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ ul.fancytree-container {
217217
.rf-col-2 {
218218
left: 17%;
219219
border-right: 1px solid lightgray;
220-
height: 100%;
220+
height: 95%;
221221
position: fixed;
222222
overflow-y: hidden;
223223
width:33%;

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){

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

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -113,40 +113,43 @@ var StarView = Backbone.View.extend({
113113
console.log("Event star a node was fired for node Id " + "");
114114
if (APP.appView.getCurrentRequestNodeId() != null) {
115115
var nodeId;
116-
if($('#tree').css('display') == "none"){
116+
if($('#tree').css('display') == "none" && $('#currentStaredNode').val() != null){
117117
nodeId = $('#currentStaredNode').val();
118118
}else{
119119
nodeId = APP.appView.getCurrentRequestNodeId();
120120
}
121121
console.log("conversation id is ..." + APP.appView.getCurrentRequestNodeId());
122-
var node = new NodeModel({
123-
id : nodeId
124-
});
125-
node.fetch({
126-
success : function(response) {
127-
var starred = !response.get("starred");
128-
var starModel = new StarModel();
129-
starModel.set('id', nodeId);
130-
starModel.set('starred', !response.get("starred"));
131-
starModel.save(null, {
132-
success: function () {
133-
console.log("changes saves successfully");
134-
if($('#starred-items').css('display') == 'block'){
135-
$('.starred ').click();
136-
}
137-
if(starred){
138-
$('#starNodeBtn').html('<span class="glyphicon glyphicon-star"></span>&nbsp;Unstar');
139-
}
140-
else{
141-
$('#starNodeBtn').html('<span class="glyphicon glyphicon-star"></span>&nbsp;Star');
142-
}
143-
},
144-
error: function () {
145-
alert('some error occured while saving the request');
146-
}
147-
});
148-
}
149-
});
122+
if(nodeId){
123+
var node = new NodeModel({
124+
id : nodeId
125+
});
126+
node.fetch({
127+
success : function(response) {
128+
var starred = !response.get("starred");
129+
var starModel = new StarModel();
130+
starModel.set('id', nodeId);
131+
starModel.set('starred', !response.get("starred"));
132+
starModel.save(null, {
133+
success: function () {
134+
console.log("changes saves successfully");
135+
if($('#starred-items').css('display') == 'block'){
136+
$('.starred ').click();
137+
}
138+
if(starred){
139+
$('#starNodeBtn').html('<span class="glyphicon glyphicon-star"></span>&nbsp;Unstar');
140+
}
141+
else{
142+
$('#starNodeBtn').html('<span class="glyphicon glyphicon-star"></span>&nbsp;Star');
143+
}
144+
},
145+
error: function () {
146+
alert('some error occured while saving the request');
147+
}
148+
});
149+
}
150+
});
151+
}
152+
150153
}
151154
},
152155

0 commit comments

Comments
 (0)