Permalink
Browse files

Display originated routes of nodes in the graph

  • Loading branch information...
1 parent 7322b2c commit fb6df742a5ee5d8ee3beee965883fdf99c4d3106 Baptiste Jonglez committed Jun 23, 2014
Showing with 23 additions and 2 deletions.
  1. +23 −2 static/js/babelweb.js
View
@@ -412,6 +412,26 @@ function babelweb() {
}
};
+ function originated_routes(router_id) {
+ originated = [];
+ if (router_id == current) {
+ /* Return all redistributed routes. */
+ for (var xr_key in babelState[current].xroute) {
+ var xr = babelState[current].xroute[xr_key];
+ originated.push(xr.prefix);
+ }
+ }
+ else {
+ for (var r_key in babelState[current].route) {
+ var r = babelState[current].route[r_key];
+ if (r.id == router_id)
+ originated.push(r.prefix);
+ }
+ }
+
+ return originated;
+ }
+
function redisplay() {
var scale = d3.select("#logscale").property("checked") ?
@@ -443,12 +463,13 @@ function babelweb() {
/* update metric and name in node title */
vis.selectAll("circle.node").each(function(d) {
+ originated = originated_routes(d.nodeId);
d3.select(this).select("title")
.text(
nodeName(d.nodeId)
+ " ["+d.nodeId+"]"
- + " (metric: "+d.metric+")");
-
+ + " (metric: "+d.metric+")"
+ + "\n" + originated.join("\n"));
});
/* Display routes */

0 comments on commit fb6df74

Please sign in to comment.