Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 1c46b7c68 -> c2ee7cb56


DISPATCH-282: Defer topology updates when adding a new node on topology page


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/fcd0bdf4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/fcd0bdf4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/fcd0bdf4

Branch: refs/heads/master
Commit: fcd0bdf4c63c23203aef72f3960aa3cc246a51ca
Parents: b175a1d
Author: Ernest Allen <eal...@redhat.com>
Authored: Mon Apr 18 13:34:34 2016 -0400
Committer: Ernest Allen <eal...@redhat.com>
Committed: Mon Apr 18 13:34:34 2016 -0400

----------------------------------------------------------------------
 .../hawtio/src/main/webapp/plugin/js/qdrTopology.js | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/fcd0bdf4/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js
----------------------------------------------------------------------
diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js 
b/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js
index dbdc8e3..3416f97 100644
--- a/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js
+++ b/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js
@@ -590,7 +590,7 @@ var QDR = (function (QDR) {
 
                                $scope.$broadcast('showEntityForm', {entity: 
entity, attributes: attributes})
                        }
-                       $scope.$apply();
+                       if (!$scope.$$phase) $scope.$apply()
                }
 
         function getContainerIndex(_id) {
@@ -1067,7 +1067,7 @@ var QDR = (function (QDR) {
                                                // add a link from the clicked 
node to the new node
                                                getLink(d.id, nodes.length-1, 
"in", "temp");
                                                $scope.addingNode.hasLink = 
true;
-                                               $scope.$apply();
+                                               if (!$scope.$$phase) 
$scope.$apply()
                                                // add new elements to the svg
                                                force.links(links).start();
                                                restart();
@@ -1088,7 +1088,7 @@ var QDR = (function (QDR) {
                         links[i]['highlighted'] = false;
                     }
                        mousedown_node = null;
-                    $scope.$apply();
+                                       if (!$scope.$$phase) $scope.$apply()
                     restart(false);
 
                    })
@@ -1099,14 +1099,14 @@ var QDR = (function (QDR) {
                        }
                        if (QDRService.nameFromId(d.key) == '__internal__') {
                            editNode();
-                           $scope.$apply();
+                                               if (!$scope.$$phase) 
$scope.$apply()
                        }
                    })
                    .on("contextmenu", function(d) {
                        $(document).click();
                     d3.event.preventDefault();
                        $scope.contextNode = d;
-                       $scope.$apply();    // we just changed a scope valiable 
during an async event
+                                       if (!$scope.$$phase) $scope.$apply()    
 // we just changed a scope valiable during an async event
                     d3.select('#node_context_menu')
                       .style('left', (mouseX + $(document).scrollLeft()) + 
"px")
                       .style('top', (mouseY + $(document).scrollTop()) + "px")
@@ -1126,7 +1126,7 @@ var QDR = (function (QDR) {
                     d.normals.forEach( function (n) {
                         $scope.multiData.push(n)
                     })
-                    $scope.$apply();
+                                       if (!$scope.$$phase) $scope.$apply()
                     d3.select('#multiple_details')
                         .style({
                             display: 'block',
@@ -1301,6 +1301,10 @@ var QDR = (function (QDR) {
         });
 
                function hasChanged () {
+                       // Don't update the underlying topology diagram if we 
are adding a new node.
+                       // Once adding is completed, the topology will update 
automatically if it has changed
+                       if ($scope.addingNode.step > 0)
+                               return false;
                        var nodeInfo = QDRService.topology.nodeInfo();
                        if (Object.keys(nodeInfo).length != 
Object.keys(savedKeys).length)
                                return true;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to