infobox/node: change mac used to lookup nodes

This commit is contained in:
Milan Pssler 2016-11-19 09:37:00 +01:00
parent 0171ebe7e1
commit 2ca2604403
3 changed files with 9 additions and 10 deletions

View file

@ -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)
})

View file

@ -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

View file

@ -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))
}
}