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/13 16:04:06 UTC
qpid-dispatch git commit: DISPATCH-1184 Fix traffic animations for
similar router names on console's topology page
Repository: qpid-dispatch
Updated Branches:
refs/heads/master 48845b998 -> 368e18108
DISPATCH-1184 Fix traffic animations for similar router names on console's 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/368e1810
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/368e1810
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/368e1810
Branch: refs/heads/master
Commit: 368e181087109f8f838aa3557282e0cff1aa2864
Parents: 48845b9
Author: Ernest Allen <ea...@redhat.com>
Authored: Tue Nov 13 11:03:53 2018 -0500
Committer: Ernest Allen <ea...@redhat.com>
Committed: Tue Nov 13 11:03:53 2018 -0500
----------------------------------------------------------------------
.../stand-alone/plugin/html/qdrTopology.html | 4 ++
console/stand-alone/plugin/js/amqp/topology.js | 45 ++++++++++++++++----
console/stand-alone/plugin/js/topology/links.js | 1 +
console/stand-alone/plugin/js/topology/nodes.js | 5 +--
.../plugin/js/topology/qdrTopology.js | 35 +++++++--------
.../stand-alone/plugin/js/topology/traffic.js | 7 +--
6 files changed, 66 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/368e1810/console/stand-alone/plugin/html/qdrTopology.html
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/html/qdrTopology.html b/console/stand-alone/plugin/html/qdrTopology.html
index 42f06c0..0ad9dc8 100644
--- a/console/stand-alone/plugin/html/qdrTopology.html
+++ b/console/stand-alone/plugin/html/qdrTopology.html
@@ -243,6 +243,10 @@ div.titleBar button {
top: -4px;
}
+td.more-info {
+ font-size: 0.5em;
+ color: blue;
+}
</style>
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/368e1810/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 3fd1764..8c88e50 100644
--- a/console/stand-alone/plugin/js/amqp/topology.js
+++ b/console/stand-alone/plugin/js/amqp/topology.js
@@ -71,20 +71,46 @@ class Topology {
nodeInfo() {
return this._nodeInfo;
}
+ saveResults(workInfo) {
+ let workSet = new Set(Object.keys(workInfo));
+ for (let rId in this._nodeInfo) {
+ if (!workSet.has(rId)) {
+ // mark any routers that went away since the last request as removed
+ this._nodeInfo[rId]['removed'] = true;
+ } else {
+ if (this._nodeInfo[rId]['removed'])
+ delete this._nodeInfo[rId]['removed'];
+ // copy entities
+ for (let entity in workInfo[rId]) {
+ if (!this._nodeInfo[rId][entity] ||
+ (workInfo[rId][entity]['timestamp']+'' > this._nodeInfo[rId][entity]['timestamp']+'')) {
+ this._nodeInfo[rId][entity] = utils.copy(workInfo[rId][entity]);
+ }
+ }
+ }
+ }
+ // add any new routers
+ let nodeSet = new Set(Object.keys(this._nodeInfo));
+ for (let rId in workInfo) {
+ if (!nodeSet.has(rId)) {
+ this._nodeInfo[rId] = utils.copy(workInfo[rId]);
+ }
+ }
+ }
get() {
return new Promise((function (resolve, reject) {
this.connection.sendMgmtQuery('GET-MGMT-NODES')
.then((function (results) {
- let response = results.response;
- if (Object.prototype.toString.call(response) === '[object Array]') {
+ let routerIds = results.response;
+ if (Object.prototype.toString.call(routerIds) === '[object Array]') {
// if there is only one node, it will not be returned
- if (response.length === 0) {
+ if (routerIds.length === 0) {
var parts = this.connection.getReceiverAddress().split('/');
parts[parts.length - 1] = '$management';
- response.push(parts.join('/'));
+ routerIds.push(parts.join('/'));
}
let finish = function (workInfo) {
- this._nodeInfo = utils.copy(workInfo);
+ this.saveResults(workInfo);
this.onDone(this._nodeInfo);
resolve(this._nodeInfo);
};
@@ -109,10 +135,10 @@ class Topology {
}
return routerId;
};
- this.doget(response)
+ this.doget(routerIds)
.then( function (workInfo) {
// test for edge case
- let routerId = connectedToEdge(response, workInfo);
+ let routerId = connectedToEdge(routerIds, workInfo);
if (routerId) {
this.connection.sendMgmtQuery('GET-MGMT-NODES', routerId)
.then((function (results) {
@@ -149,6 +175,7 @@ class Topology {
}
var gotResponse = function (nodeName, entity, response) {
workInfo[nodeName][entity] = response;
+ workInfo[nodeName][entity]['timestamp'] = new Date();
};
var q = d3.queue(this.connection.availableQeueuDepth());
for (var id in workInfo) {
@@ -273,8 +300,9 @@ class Topology {
this.addUpdateEntities(entityAttribs);
this.doget(nodes)
.then( function (results) {
+ this.saveResults(results);
callback(extra, results);
- });
+ }.bind(this));
}
addNodeInfo(id, entity, values) {
// save the results in the nodeInfo object
@@ -284,6 +312,7 @@ class Topology {
}
// copy the values to allow garbage collection
this._nodeInfo[id][entity] = values;
+ this._nodeInfo[id][entity]['timestamp'] = new Date();
}
}
isLargeNetwork() {
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/368e1810/console/stand-alone/plugin/js/topology/links.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/topology/links.js b/console/stand-alone/plugin/js/topology/links.js
index 0ca9967..6caae44 100644
--- a/console/stand-alone/plugin/js/topology/links.js
+++ b/console/stand-alone/plugin/js/topology/links.js
@@ -164,6 +164,7 @@ export class Links {
node.host = connection.host;
node.connectionId = connection.identity;
node.cdir = cdir;
+ node.uuid = `${node.routerId}${node.nodeType}${node.cdir}`;
// determine arrow direction by using the link directions
if (!normalsParent[nodeType+cdir]) {
normalsParent[nodeType+cdir] = node;
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/368e1810/console/stand-alone/plugin/js/topology/nodes.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/topology/nodes.js b/console/stand-alone/plugin/js/topology/nodes.js
index 2b51898..25ecb6c 100644
--- a/console/stand-alone/plugin/js/topology/nodes.js
+++ b/console/stand-alone/plugin/js/topology/nodes.js
@@ -85,7 +85,7 @@ export class Node {
else {
title += `<tr><td>Count</td><td>${this.normals.length}</td></tr>`;
}
- title += '</table>';
+ title += '<tr><td colspan=2 class="more-info">Click circle for more info</td></tr></table>';
return title;
}
@@ -134,8 +134,7 @@ export class Node {
return nodeProperties[this.nodeType].radius;
}
uid(srv) {
- return srv.utilities.nameFromId(this.key).replace(/ /g,'').replace(/\./g,'') +
- (this.connectionId ? this.connectionId : '');
+ return this.uuid ? this.uuid : srv.utilities.nameFromId(this.key);
}
}
const nodeProperties = {
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/368e1810/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 5425bad..2499ca4 100644
--- a/console/stand-alone/plugin/js/topology/qdrTopology.js
+++ b/console/stand-alone/plugin/js/topology/qdrTopology.js
@@ -393,14 +393,17 @@ export class TopologyController {
unknownNodes[unknowns[i].key] = 1;
}
unknownNodes = Object.keys(unknownNodes);
- QDRService.management.topology.ensureEntities(unknownNodes, [
- {entity: 'router.link', attrs: ['linkType','connectionId','linkDir','owningAddr'], force: true}], function (foo, results) {
- forceData.links = links = new Links(QDRService, QDRLog);
- links.initializeLinks(results, nodes, [], localStorage, height);
- animate = true;
- force.nodes(nodes.nodes).links(links.links).start();
- restart(false);
- });
+ QDRService.management.topology.ensureEntities(unknownNodes,
+ [{entity: 'router.link',
+ attrs: ['linkType','connectionId','linkDir','owningAddr'],
+ force: true}],
+ function (foo, results) {
+ forceData.links = links = new Links(QDRService, QDRLog);
+ links.initializeLinks(results, nodes, [], localStorage, height);
+ animate = true;
+ force.nodes(nodes.nodes).links(links.links).start();
+ restart(false);
+ });
};
function resetMouseVars() {
@@ -654,6 +657,10 @@ export class TopologyController {
clearAllHighlights();
$scope.mousedown_node = null;
if (!$scope.$$phase) $scope.$apply();
+ // handle clicking on nodes that represent multiple sub-nodes
+ if (d.normals) {
+ //doDialog(d);
+ }
restart(false);
})
@@ -692,9 +699,6 @@ export class TopologyController {
window.location = $location.protocol() + '://localhost:8161/hawtio' + artemisPath;
}
return;
- } else {
- // handle clicking on nodes that represent multiple sub-nodes
- //doDialog(d);
}
d3.event.stopPropagation();
});
@@ -973,8 +977,6 @@ export class TopologyController {
if (routers.length > cnodes.length) {
return -1;
}
-
-
if (cnodes.length != Object.keys(savedKeys).length) {
return cnodes.length > Object.keys(savedKeys).length ? 1 : -1;
}
@@ -1037,8 +1039,8 @@ export class TopologyController {
// after the graph is displayed fetch all .router.node info. This is done so highlighting between nodes
// doesn't incur a delay
QDRService.management.topology.addUpdateEntities([
- {entity: 'router.node', attrs: ['id','nextHop']},
- {entity: 'router.link', attrs: ['linkType', 'connectionId', 'owningAddr', 'linkDir']}]);
+ {entity: 'router.node', attrs: ['id','nextHop']}
+ ]);
// call this function every time a background update is done
QDRService.management.topology.addUpdatedAction('topology', function() {
let changed = hasChanged();
@@ -1077,8 +1079,7 @@ export class TopologyController {
function setupInitialUpdate() {
// make sure all router nodes have .connection info. if not then fetch any missing info
QDRService.management.topology.ensureAllEntities(
- [{entity: 'connection'},
- {entity: 'router.link', attrs: ['linkType', 'connectionId', 'owningAddr', 'linkDir']}],
+ [{entity: 'connection'}],
handleInitialUpdate);
}
if (!QDRService.management.connection.is_connected()) {
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/368e1810/console/stand-alone/plugin/js/topology/traffic.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/topology/traffic.js b/console/stand-alone/plugin/js/topology/traffic.js
index a7f5c62..610e01f 100644
--- a/console/stand-alone/plugin/js/topology/traffic.js
+++ b/console/stand-alone/plugin/js/topology/traffic.js
@@ -325,7 +325,7 @@ class Dots extends TrafficAnimation {
let matrixMessages = matrix.matrixMessages();
// the fastest traffic rate gets 3 times as many dots as the slowest
let minmax = matrix.getMinMax();
- let flowScale = d3.scale.linear().domain(minmax).range([1, 1.75]);
+ let flowScale = d3.scale.linear().domain(minmax).range([1, 1.1]);
// row is ingress router, col is egress router. Value at [row][col] is the rate
matrixMessages.forEach(function (row, r) {
row.forEach(function (val, c) {
@@ -363,8 +363,9 @@ class Dots extends TrafficAnimation {
let hop = hops[id];
for (let h = 0; h < hop.length; h++) {
let ahop = hop[h];
- let flowId = id + '-' + this.addressIndex(this, ahop.address) + (ahop.back ? 'b' : '');
- let path = d3.select('#path' + id);
+ let pathId = id.replace(/\./g, '\\.').replace(/ /g, '\\ ');
+ let flowId = id.replace(/\./g, '').replace(/ /g, '') + '-' + this.addressIndex(this, ahop.address) + (ahop.back ? 'b' : '');
+ let path = d3.select('#path' + pathId);
// start the animation. If the animation is already running, this will have no effect
this.startAnimation(path, flowId, ahop, flowScale(ahop.val));
keep[flowId] = true;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org