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