diff --git a/src/main/resources/static/js/views/conversation-view.js b/src/main/resources/static/js/views/conversation-view.js index bd6456c..cc3e0da 100644 --- a/src/main/resources/static/js/views/conversation-view.js +++ b/src/main/resources/static/js/views/conversation-view.js @@ -405,7 +405,7 @@ define(function(require) { var response = conversation.get('rfResponse'); this.$el.find("#apiRequestName").html(conversation.get('name')); - this.$el.find("#apiRequestDescription").html(conversation.get('description')); + this.$el.find("#apiRequestDescription").html(conversation.get('description')); this.$el.find("#apiUrl").val(request.apiUrlString); this.$el.find(".apiRequestType").val(request.methodType); diff --git a/src/main/resources/static/js/views/star-view.js b/src/main/resources/static/js/views/star-view.js index 200a877..f9080bd 100644 --- a/src/main/resources/static/js/views/star-view.js +++ b/src/main/resources/static/js/views/star-view.js @@ -67,15 +67,29 @@ define(function (require) { console.log("Event star a node was fired for node Id " + ""); if (APP.appView.getCurrentRequestNodeId() != null) { console.log("conversation id is ..." + APP.appView.getCurrentRequestNodeId()); - var starModel = new StarModel(); - starModel.set('id', APP.appView.getCurrentRequestNodeId()); - starModel.set('starred', true); - starModel.save(null, { - success: function () { - console.log("changes saves successfully"); - }, - error: function () { - alert('some error occured while saving the request'); + var node = new NodeModel({ + id : APP.appView.getCurrentRequestNodeId() + }); + node.fetch({ + success : function(response) { + var starred = !response.get("starred"); + var starModel = new StarModel(); + starModel.set('id', APP.appView.getCurrentRequestNodeId()); + starModel.set('starred', !response.get("starred")); + starModel.save(null, { + success: function () { + console.log("changes saves successfully"); + if(starred){ + $('#starNodeBtn').html(' Unstar'); + } + else{ + $('#starNodeBtn').html(' Star'); + } + }, + error: function () { + alert('some error occured while saving the request'); + } + }); } }); } diff --git a/src/main/resources/static/js/views/tree-view.js b/src/main/resources/static/js/views/tree-view.js index 77ae3ff..bd52b14 100644 --- a/src/main/resources/static/js/views/tree-view.js +++ b/src/main/resources/static/js/views/tree-view.js @@ -337,6 +337,12 @@ define(function(require) { node.fetch({ success : function(response) { console.log(response.get("conversation")); + if(response.get("starred")){ + $('#starNodeBtn').html(' Unstar'); + } + else{ + $('#starNodeBtn').html(' Star'); + } var conversation = new ConversationModel(response.get("conversation")); conversation.set("id", conversation.get("id")); conversation.set("name", response.get("name"));