k8srepo field description mandatory; k8scluster placeholder hint for nets field
[osm/LW-UI.git] / static / TopologyComposer / js / model_graph_editor.js
index fd80822..700b432 100644 (file)
@@ -180,10 +180,12 @@ TCD3.ModelGraphEditor = (function () {
      * @returns {boolean}
      */
     ModelGraphEditor.prototype.updateDataNode = function (node, args, success, error) {
-        console.log(node)
+        console.log(node);
+        var self = this;
         var controller = new  TCD3.OsmController();
-        controller.updateNode(this,node, args, function(){
-
+        controller.updateNode(this,node, args, function(result){
+            self.updateData(result);
+            success && success();
         }, error);
     };
 
@@ -193,9 +195,11 @@ TCD3.ModelGraphEditor = (function () {
      * @returns {boolean}
      */
     ModelGraphEditor.prototype.updateGraphParams = function (args, success, error) {
+        var self = this;
         var controller = new  TCD3.OsmController();
-        controller.updateGraphParams(args, function(){
-
+        controller.updateGraphParams(args, function(result){
+            self.updateData(result);
+            success && success();
         }, error);
     };
 
@@ -216,8 +220,9 @@ TCD3.ModelGraphEditor = (function () {
             if (self.model.layer[current_layer].nodes[node_type].removable.callback) {
                 var c = self.model.callback[self.model.layer[current_layer].nodes[node_type].removable.callback].class;
                 var controller = new  TCD3.OsmController();
-                controller[self.model.layer[current_layer].nodes[node_type].removable.callback](self, node, function () {
-                    self.parent.removeNode.call(self, node);
+                controller[self.model.layer[current_layer].nodes[node_type].removable.callback](self, node, function (result) {
+                    self._deselectAllNodes();
+                    self.updateData(result);
                     success && success();
                 }, error);
             } else {
@@ -261,11 +266,10 @@ TCD3.ModelGraphEditor = (function () {
                 link.directed_edge = direct_edge;
                 var c = self.model.callback[callback].class;
                 var controller = new  TCD3.OsmController();
-                controller[callback](self, link, function () {
+                controller[callback](self, link, function (result) {
                     self._deselectAllNodes();
-                    self.parent.addLink.call(self, link);
-                    if (success)
-                        success();
+                    self.updateData(result);
+                    success && success();
                 }, error);
             } else {
                 log('addLink: callback undefined in model spec.');
@@ -292,6 +296,7 @@ TCD3.ModelGraphEditor = (function () {
         var source_type = s.info.type;
         var destination_type = d.info.type;
         var current_layer = self.getCurrentView();
+        console.log(self.model.layer[current_layer])
         if (self.model.layer[current_layer].allowed_edges && self.model.layer[current_layer].allowed_edges[source_type] && self.model.layer[current_layer].allowed_edges[source_type].destination[destination_type] &&
             self.model.layer[current_layer].allowed_edges[source_type].destination[destination_type].removable
         ) {
@@ -299,10 +304,12 @@ TCD3.ModelGraphEditor = (function () {
                 var callback = self.model.layer[current_layer].allowed_edges[source_type].destination[destination_type].removable.callback;
                 var c = self.model.callback[callback].class;
                 var controller = new  TCD3.OsmController();
-                controller[callback](self, link, function () {
+                controller[callback](self, link, function (result) {
                     self._deselectAllNodes();
                     self._deselectAllLinks();
-                    self.parent.removeLink.call(self, link.index);
+                    
+                    self.updateData(result);
+                    // success && success();
                     success && success();
                 }, error);
             } else {