diff --git a/lib/datadistributor.js b/lib/datadistributor.js index 72d1f15..67cf7eb 100644 --- a/lib/datadistributor.js +++ b/lib/datadistributor.js @@ -34,11 +34,6 @@ define(["filters/nodefilter"], function (NodeFilter) { filteredData = new NodeFilter(filter)(data) - filteredData.nodeDict = {} - filteredData.nodes.all.forEach(function (d) { - filteredData.nodeDict[dictGet(d, ["nodeinfo", "network", "mac"]).substr(9)] = d - }) - targets.forEach( function (t) { t.setData(filteredData) }) diff --git a/lib/infobox/main.js b/lib/infobox/main.js index d6e0195..d90497d 100644 --- a/lib/infobox/main.js +++ b/lib/infobox/main.js @@ -48,7 +48,11 @@ define(["infobox/link", "infobox/node", "infobox/location"], function (Link, Nod } self.setData = function (d) { - nodeDict = d.nodeDict + nodeDict = {} + d.graph.nodes.forEach(function (d) { + nodeDict[d.id.substr(0, 8)] = d + }) + } return self diff --git a/lib/infobox/node.js b/lib/infobox/node.js index 9e1f623..fcc5de6 100644 --- a/lib/infobox/node.js +++ b/lib/infobox/node.js @@ -317,11 +317,11 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"], if (!d) return null - var node = nodeDict[d.substr(9)] + var node = nodeDict[d.substr(0, 8)] if (!node) return d - return {node: node} + return node } function showGateway(d, router, nodeDict) { @@ -336,10 +336,10 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"], return function (el) { if (nh) { el.appendChild(createLink(lookupNode(nh, nodeDict), router)) - if (nh.substr(9) !== gw.substr(9)) + if (nh.substr(0, 8) !== gw.substr(0, 8)) el.appendChild(document.createTextNode(" -> ... -> ")) } - if (!nh || nh.substr(9) !== gw.substr(9)) + if (!nh || nh.substr(0, 8) !== gw.substr(0, 8)) el.appendChild(createLink(lookupNode(gw, nodeDict), router)) } }