proportions: lookup gateway name

This commit is contained in:
Milan Pssler 2016-11-19 10:57:30 +01:00
parent 2ca2604403
commit 94662cb3dc

View file

@ -23,7 +23,7 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
var uplinkTable = document.createElement("table")
uplinkTable.classList.add("proportion")
var gwNodesTable = document.createElement("table")
var gwNodesTable = document.createElement("table")
gwNodesTable.classList.add("proportion")
var gwClientsTable = document.createElement("table")
@ -119,9 +119,8 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
var onlineNodes = data.nodes.all.filter(online)
var nodes = onlineNodes.concat(data.nodes.lost)
var nodeDict = {}
data.nodes.all.forEach(function (d) {
nodeDict[d.nodeinfo.node_id] = d
data.graph.nodes.forEach(function (d) {
nodeDict[d.id.substr(0, 8)] = d
})
var statusDict = count(nodes, ["flags", "online"], function (d) {
@ -156,11 +155,12 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
if (d === null)
return null
if (d.node)
return d.node.nodeinfo.hostname
if (d.id)
return d.id
var n = nodeDict[d.substr(0, 8)]
if (!n)
return d
var name = dictGet(n, ["node", "nodeinfo", "hostname"])
if (name)
return name
return d
})
@ -169,11 +169,12 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
if (d === null)
return null
if (d.node)
return d.node.nodeinfo.hostname
if (d.id)
return d.id
var n = nodeDict[d.substr(0, 8)]
if (!n)
return d
var name = dictGet(n, ["node", "nodeinfo", "hostname"])
if (name)
return name
return d
})