You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ea...@apache.org on 2018/11/02 19:23:48 UTC

qpid-dispatch git commit: DISPATCH-1161 Fix console test

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 04802507f -> 5c1743748


DISPATCH-1161 Fix console test


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

Branch: refs/heads/master
Commit: 5c17437484ed73f935c437d859762cf6520e324f
Parents: 0480250
Author: Ernest Allen <ea...@redhat.com>
Authored: Fri Nov 2 15:23:30 2018 -0400
Committer: Ernest Allen <ea...@redhat.com>
Committed: Fri Nov 2 15:23:30 2018 -0400

----------------------------------------------------------------------
 console/stand-alone/plugin/js/amqp/topology.js   |  1 -
 console/stand-alone/plugin/js/amqp/utilities.js  | 19 +++++++++++++++----
 console/stand-alone/plugin/js/chord/data.js      |  6 +++++-
 .../plugin/js/topology/qdrTopology.js            | 13 ++++++++-----
 console/stand-alone/test/utilities.js            | 16 ++++++++++++++++
 5 files changed, 44 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/5c174374/console/stand-alone/plugin/js/amqp/topology.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/amqp/topology.js b/console/stand-alone/plugin/js/amqp/topology.js
index 6e806c9..edfbbb3 100644
--- a/console/stand-alone/plugin/js/amqp/topology.js
+++ b/console/stand-alone/plugin/js/amqp/topology.js
@@ -114,7 +114,6 @@ class Topology {
                 // test for edge case
                 let routerId = connectedToEdge(response, workInfo);
                 if (routerId) {
-                  let edgeId = response[0];
                   this.connection.sendMgmtQuery('GET-MGMT-NODES', routerId)
                     .then((function (results) {
                       let response = results.response;

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/5c174374/console/stand-alone/plugin/js/amqp/utilities.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/amqp/utilities.js b/console/stand-alone/plugin/js/amqp/utilities.js
index c94b498..37bccb6 100644
--- a/console/stand-alone/plugin/js/amqp/utilities.js
+++ b/console/stand-alone/plugin/js/amqp/utilities.js
@@ -103,11 +103,22 @@ var utils = {
   },
   // extract the name of the router from the router id
   nameFromId: function (id) {
-    // the router id looks like 'amqp:/_topo/0/routerName/$management'
+    // the router id looks like
+    //  amqp:/_topo/0/routerName/$management'
+    //  amqp:/_topo/0/router/Name/$management'
+    //  amqp:/_edge/routerName/$management'
+    //  amqp:/_edge/router/Name/$management'
+
     var parts = id.split('/');
-    // handle cases where the router name contains a /
-    parts.splice(0, parts.length - 2); // remove amqp, _topo, 0
-    parts.pop(); // remove $management
+    // remove $management
+    parts.pop(); 
+
+    // remove the area if present
+    if (parts[2] === '0')
+      parts.splice(2, 1);
+
+    // remove amqp/(_topo or _edge)
+    parts.splice(0, 2);
     return parts.join('/');
   },
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/5c174374/console/stand-alone/plugin/js/chord/data.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/chord/data.js b/console/stand-alone/plugin/js/chord/data.js
index 6116436..64a58fa 100644
--- a/console/stand-alone/plugin/js/chord/data.js
+++ b/console/stand-alone/plugin/js/chord/data.js
@@ -111,7 +111,11 @@ class ChordData { // eslint-disable-line no-unused-vars
           for (let i = 0; routerLinks && (i < routerLinks.results.length); i++) {
             let link = self.QDRService.utilities.flatten(routerLinks.attributeNames, routerLinks.results[i]);
             // if the link is an outbound/enpoint/non console
-            if (link.linkType === 'endpoint' && link.linkDir === 'out' && !link.owningAddr.startsWith('Ltemp.')) {
+            if (link.linkType === 'endpoint' && 
+                link.linkDir === 'out' && 
+                (link.owningAddr && 
+                 !link.owningAddr.startsWith('Ltemp.') &&
+                 !link.owningAddr.startsWith('M0$'))) {
               // keep track of the raw egress values as well as their ingress and egress routers and the address
               for (let j = 0; j < ingressRouters.length; j++) {
                 let messages = link.ingressHistogram ? link.ingressHistogram[j] : 0;

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/5c174374/console/stand-alone/plugin/js/topology/qdrTopology.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/topology/qdrTopology.js b/console/stand-alone/plugin/js/topology/qdrTopology.js
index 667f9ed..c884522 100644
--- a/console/stand-alone/plugin/js/topology/qdrTopology.js
+++ b/console/stand-alone/plugin/js/topology/qdrTopology.js
@@ -410,12 +410,13 @@ export class TopologyController {
       // draw lines with arrows with proper padding from node centers
       path.attr('d', function(d) {
         let sourcePadding, targetPadding;
-        let r = Nodes.radius(d.target.nodeType);
+        let rT = Nodes.radius(d.target.nodeType);
+        let rS = Nodes.radius(d.source.nodeType);
         sourcePadding = targetPadding = 0;
-        let dtx = Math.max(targetPadding, Math.min(width - r, d.target.x)),
-          dty = Math.max(targetPadding, Math.min(height - r, d.target.y)),
-          dsx = Math.max(sourcePadding, Math.min(width - r, d.source.x)),
-          dsy = Math.max(sourcePadding, Math.min(height - r, d.source.y));
+        let dtx = Math.max(targetPadding, Math.min(width - rT, d.target.x)),
+          dty = Math.max(targetPadding, Math.min(height - rT, d.target.y)),
+          dsx = Math.max(sourcePadding, Math.min(width - rS, d.source.x)),
+          dsy = Math.max(sourcePadding, Math.min(height - rS, d.source.y));
 
         let deltaX = dtx - dsx,
           deltaY = dty - dsy,
@@ -705,6 +706,8 @@ export class TopologyController {
               window.location = $location.protocol() + '://localhost:8161/hawtio' + artemisPath;
             }
             return;
+          } else {
+            // TODO: handle clicking on nodes that represent multiple sub-nodes
           }
           d3.event.stopPropagation();
         });

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/5c174374/console/stand-alone/test/utilities.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/test/utilities.js b/console/stand-alone/test/utilities.js
index 56c751e..7882ccc 100644
--- a/console/stand-alone/test/utilities.js
+++ b/console/stand-alone/test/utilities.js
@@ -45,6 +45,22 @@ describe('Management utilities', function() {
       let name = qdrService.utilities.nameFromId('amqp:/topo/0/router/Name/$management');
       assert.equal(name, 'router/Name');
     });
+    it('should extract from edge router id', function() {
+      let name = qdrService.utilities.nameFromId('amqp:/_edge/edgeName/$management');
+      assert.equal(name, 'edgeName');
+    });
+    it('should extract name with / from edge router id', function() {
+      let name = qdrService.utilities.nameFromId('amqp:/_edge/edge/Name/$management');
+      assert.equal(name, 'edge/Name');
+    });
+    it('should extract name with multiple /s from router id', function() {
+      let name = qdrService.utilities.nameFromId('amqp:/_topo/0/router/Name/here/$management');
+      assert.equal(name, 'router/Name/here');
+    });
+    it('should extract name with multiple /s from edge router id', function() {
+      let name = qdrService.utilities.nameFromId('amqp:/_edge/edge/Name/here/$management');
+      assert.equal(name, 'edge/Name/here');
+    });
   });
   describe('#valFor', function() {
     let aAr = ['name', 'value'];


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