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 2016/05/10 20:17:26 UTC

qpid-dispatch git commit: DISPATCH-310: Use router.id, router.routerId, or container.containerName respectively to match connection.container.

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master c95bb8ae8 -> 6422f523a


DISPATCH-310: Use router.id, router.routerId, or container.containerName respectively to match connection.container.


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

Branch: refs/heads/master
Commit: 6422f523afd3378390c3bbb641a0f734ebe924d3
Parents: c95bb8a
Author: Ernest Allen <ea...@redhat.com>
Authored: Tue May 10 16:16:46 2016 -0400
Committer: Ernest Allen <ea...@redhat.com>
Committed: Tue May 10 16:16:46 2016 -0400

----------------------------------------------------------------------
 .../src/main/webapp/plugin/js/qdrTopology.js    | 35 +++++++++++++++-----
 console/stand-alone/plugin/js/qdrService.js     |  8 ++++-
 console/stand-alone/plugin/js/qdrTopology.js    | 30 +++++++++++++----
 3 files changed, 56 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6422f523/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 4f0f3e7..7e10547 100644
--- a/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js
+++ b/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js
@@ -314,18 +314,21 @@ var QDR = (function (QDR) {
 
 		var aNode = function (id, name, nodeType, nodeInfo, nodeIndex, x, y, resultIndex, fixed, properties) {
 			properties = properties || {};
-			var containerName;
+			var routerId;
 			if (nodeInfo) {
 				var node = nodeInfo[id];
 				if (node) {
-					containerName = node['.container'].results[0][0];
+					var router = node['.router'];
+					routerId = QDRService.valFor(router.attributeNames, router.results[0], 'id')
+					if (!routerId)
+						routerId = QDRService.valFor(router.attributeNames, router.results[0], 'routerId')
 				}
 			}
 			return {   key: id,
 				name: name,
 				nodeType: nodeType,
 				properties: properties,
-				containerName: containerName,
+				routerId: routerId,
 				x: x,
 				y: y,
 				id: nodeIndex,
@@ -597,11 +600,24 @@ var QDR = (function (QDR) {
             var nodeIndex = 0;
             var nodeInfo = QDRService.topology.nodeInfo();
             for (var id in nodeInfo) {
-                var node = nodeInfo[id];
-                if (node['.container'].results[0][0] == _id)
+                var node = nodeInfo[id]['.router'];
+                // there should be only one router entity for each node, so using results[0] should be fine
+                if (QDRService.valFor( node.attributeNames, node.results[0], "id") === _id)
+                    return nodeIndex;
+                if (QDRService.valFor( node.attributeNames, node.results[0], "routerId") === _id)
                     return nodeIndex;
                 nodeIndex++
             }
+			// there was no router.id that matched, check deprecated router.routerId
+            nodeIndex = 0;
+            for (var id in nodeInfo) {
+                var node = nodeInfo[id]['.container'];
+				if (node) {
+					if (QDRService.valFor ( node.attributeNames, node.results[0], "containerName") === _id)
+						return nodeIndex;
+				}
+				nodeIndex++
+			}
             QDR.log.warn("unable to find containerIndex for " + _id);
             return -1;
         }
@@ -807,7 +823,7 @@ var QDR = (function (QDR) {
 				    }
 				    return;
 				  }
-				        //QDR.log.debug("showing connections form");
+			        //QDR.log.debug("showing connections form");
 					var resultIndex = 0; // the connection to use
                     var left = d.left ? d.target : d.source;
 					// right is the node that the arrow points to, left is the other node
@@ -822,7 +838,7 @@ var QDR = (function (QDR) {
                             var conn = onode['.connection'].results[resultIndex];
                             /// find the connection whose container is the right's name
                             var name = QDRService.valFor(onode['.connection'].attributeNames, conn, "container");
-                            if (name == right.containerName) {
+                            if (name == right.routerId) {
                                 break;
                             }
                         }
@@ -832,7 +848,8 @@ var QDR = (function (QDR) {
                             left = d.target;
                             resultIndex = left.resultIndex;
                         }
-                        updateForm(left.key, 'connection', resultIndex);
+						if (resultIndex)
+                            updateForm(left.key, 'connection', resultIndex);
                     }
 
 					mousedown_link = d;
@@ -890,7 +907,7 @@ var QDR = (function (QDR) {
 					var connections = nodeInfo[d.source.key]['.connection'];
 					var containerIndex = connections.attributeNames.indexOf('container');
 					connections.results.some ( function (connection) {
-                        if (connection[containerIndex] == d.target.containerName) {
+                        if (connection[containerIndex] == d.target.routerId) {
                             root.attributeNames = connections.attributeNames;
                             root.obj = connection;
                             root.desc = "Connection";

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6422f523/console/stand-alone/plugin/js/qdrService.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrService.js b/console/stand-alone/plugin/js/qdrService.js
index 28ed680..758e518 100644
--- a/console/stand-alone/plugin/js/qdrService.js
+++ b/console/stand-alone/plugin/js/qdrService.js
@@ -523,10 +523,16 @@ The response looks like:
 			//QDR.log.debug("got all results for  " + entity);
 			// aggregate the responses
 			var newResponse = {};
+			newResponse['aggregates'] = [];
 			var thisNode = responses[selectedNodeId];
+			if (!thisNode) {
+				newResponse['attributeNames'] = ['name'];
+				newResponse['results'] = [''];
+				callback(nodeNames, entity, newResponse);
+				return;
+			}
 			newResponse['attributeNames'] = thisNode.attributeNames;
 			newResponse['results'] = thisNode.results;
-			newResponse['aggregates'] = [];
 			for (var i=0; i<thisNode.results.length; ++i) {
 				var result = thisNode.results[i];
 				var vals = [];

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6422f523/console/stand-alone/plugin/js/qdrTopology.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrTopology.js b/console/stand-alone/plugin/js/qdrTopology.js
index a410753..13da88a 100644
--- a/console/stand-alone/plugin/js/qdrTopology.js
+++ b/console/stand-alone/plugin/js/qdrTopology.js
@@ -328,18 +328,21 @@ var QDR = (function (QDR) {
 
 		var aNode = function (id, name, nodeType, nodeInfo, nodeIndex, x, y, resultIndex, fixed, properties) {
 			properties = properties || {};
-			var containerName;
+			var routerId;
 			if (nodeInfo) {
 				var node = nodeInfo[id];
 				if (node) {
-					containerName = node['.container'].results[0][0];
+					var router = node['.router'];
+					routerId = QDRService.valFor(router.attributeNames, router.results[0], 'id')
+					if (!routerId)
+						routerId = QDRService.valFor(router.attributeNames, router.results[0], 'routerId')
 				}
 			}
 			return {   key: id,
 				name: name,
 				nodeType: nodeType,
 				properties: properties,
-				containerName: containerName,
+				routerId: routerId,
 				x: x,
 				y: y,
 				id: nodeIndex,
@@ -827,11 +830,24 @@ var QDR = (function (QDR) {
             var nodeIndex = 0;
             var nodeInfo = QDRService.topology.nodeInfo();
             for (var id in nodeInfo) {
-                var node = nodeInfo[id];
-                if (node['.container'].results[0][0] == _id)
+                var node = nodeInfo[id]['.router'];
+                // there should be only one router entity for each node, so using results[0] should be fine
+                if (QDRService.valFor( node.attributeNames, node.results[0], "id") === _id)
+                    return nodeIndex;
+                if (QDRService.valFor( node.attributeNames, node.results[0], "routerId") === _id)
                     return nodeIndex;
                 nodeIndex++
             }
+			// there was no router.id that matched, check deprecated router.routerId
+            nodeIndex = 0;
+            for (var id in nodeInfo) {
+                var node = nodeInfo[id]['.container'];
+				if (node) {
+					if (QDRService.valFor ( node.attributeNames, node.results[0], "containerName") === _id)
+						return nodeIndex;
+				}
+				nodeIndex++
+			}
             QDR.log.warn("unable to find containerIndex for " + _id);
             return -1;
         }
@@ -1052,7 +1068,7 @@ var QDR = (function (QDR) {
                             var conn = onode['.connection'].results[resultIndex];
                             /// find the connection whose container is the right's name
                             var name = QDRService.valFor(onode['.connection'].attributeNames, conn, "container");
-                            if (name == right.containerName) {
+                            if (name == right.routerId) {
                                 break;
                             }
                         }
@@ -1120,7 +1136,7 @@ var QDR = (function (QDR) {
 					var connections = nodeInfo[d.source.key]['.connection'];
 					var containerIndex = connections.attributeNames.indexOf('container');
 					connections.results.some ( function (connection) {
-                        if (connection[containerIndex] == d.target.containerName) {
+                        if (connection[containerIndex] == d.target.routerId) {
                             root.attributeNames = connections.attributeNames;
                             root.obj = connection;
                             root.desc = "Connection";


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