Use server side resolving only, add proper support for nexthop resolving (#81)
* Revert "Use resolved data if gateway was already resolved (#78)" This reverts commit44bb8e9d3d
. * Revert "proportions: lookup gateway name" This reverts commit94662cb3dc
. * Revert "infobox/node: change mac used to lookup nodes" This reverts commit2ca2604403
. * Revert "infobox/node: resolve nexthop and gateway from data" This reverts commit9e7049c9e3
. * Resolve nexthop full chain if possible requires hopglass/hopglass-server#79 * Correctly handle sidecase when nodes on route report inconsistent gateway
This commit is contained in:
parent
44bb8e9d3d
commit
5cb88e8d06
|
@ -85,7 +85,6 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Legend, Linklist,
|
||||||
fanoutUnfiltered.add(meshstats)
|
fanoutUnfiltered.add(meshstats)
|
||||||
fanoutUnfiltered.add(newnodeslist)
|
fanoutUnfiltered.add(newnodeslist)
|
||||||
fanoutUnfiltered.add(lostnodeslist)
|
fanoutUnfiltered.add(lostnodeslist)
|
||||||
fanoutUnfiltered.add(infobox)
|
|
||||||
fanout.add(nodelist)
|
fanout.add(nodelist)
|
||||||
fanout.add(linklist)
|
fanout.add(linklist)
|
||||||
fanout.add(statistics)
|
fanout.add(statistics)
|
||||||
|
|
|
@ -2,7 +2,6 @@ define(["infobox/link", "infobox/node", "infobox/location"], function (Link, Nod
|
||||||
return function (config, sidebar, router) {
|
return function (config, sidebar, router) {
|
||||||
var self = this
|
var self = this
|
||||||
var el
|
var el
|
||||||
var nodeDict
|
|
||||||
|
|
||||||
function destroy() {
|
function destroy() {
|
||||||
if (el && el.parentNode) {
|
if (el && el.parentNode) {
|
||||||
|
@ -34,7 +33,7 @@ define(["infobox/link", "infobox/node", "infobox/location"], function (Link, Nod
|
||||||
|
|
||||||
self.gotoNode = function (d) {
|
self.gotoNode = function (d) {
|
||||||
create()
|
create()
|
||||||
new Node(config, el, router, d, nodeDict)
|
new Node(config, el, router, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.gotoLink = function (d) {
|
self.gotoLink = function (d) {
|
||||||
|
@ -47,14 +46,6 @@ define(["infobox/link", "infobox/node", "infobox/location"], function (Link, Nod
|
||||||
new Location(config, el, router, d)
|
new Location(config, el, router, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.setData = function (d) {
|
|
||||||
nodeDict = {}
|
|
||||||
d.graph.nodes.forEach(function (d) {
|
|
||||||
nodeDict[d.id.substr(0, 8)] = d
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -313,21 +313,7 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
|
||||||
return document.createTextNode(text)
|
return document.createTextNode(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
function lookupNode(d, nodeDict) {
|
function showGateway(d, router) {
|
||||||
if (!d)
|
|
||||||
return null
|
|
||||||
|
|
||||||
if (d.node || d.id)
|
|
||||||
return d
|
|
||||||
|
|
||||||
var node = nodeDict[d.substr(0, 8)]
|
|
||||||
if (!node)
|
|
||||||
return d
|
|
||||||
|
|
||||||
return node
|
|
||||||
}
|
|
||||||
|
|
||||||
function showGateway(d, router, nodeDict) {
|
|
||||||
var nh
|
var nh
|
||||||
if (dictGet(d.statistics, ["nexthop"]))
|
if (dictGet(d.statistics, ["nexthop"]))
|
||||||
nh = dictGet(d.statistics, ["nexthop"])
|
nh = dictGet(d.statistics, ["nexthop"])
|
||||||
|
@ -337,13 +323,27 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
|
||||||
|
|
||||||
if (!gw) return null
|
if (!gw) return null
|
||||||
return function (el) {
|
return function (el) {
|
||||||
if (nh) {
|
var num = 0
|
||||||
el.appendChild(createLink(lookupNode(nh, nodeDict), router))
|
while (gw && nh && gw.id !== nh.id && num < 10) {
|
||||||
if (nh.substr(0, 8) !== gw.substr(0, 8))
|
if (num !== 0) el.appendChild(document.createTextNode(" -> "))
|
||||||
el.appendChild(document.createTextNode(" -> ... -> "))
|
el.appendChild(createLink(nh, router))
|
||||||
|
num++
|
||||||
|
if (!nh.node || !nh.node.statistics) break
|
||||||
|
if (dictGet(nh.node.statistics, ["gateway"]).id !== gw.id) break
|
||||||
|
if (dictGet(nh.node.statistics, ["gateway_nexthop"]))
|
||||||
|
nh = dictGet(nh.node.statistics, ["gateway_nexthop"])
|
||||||
|
else if (dictGet(nh.node.statistics, ["nexthop"]))
|
||||||
|
nh = dictGet(nh.node.statistics, ["nexthop"])
|
||||||
|
else
|
||||||
|
break
|
||||||
}
|
}
|
||||||
if (!nh || nh.substr(0, 8) !== gw.substr(0, 8))
|
if (gw && nh && gw.id !== nh.id) {
|
||||||
el.appendChild(createLink(lookupNode(gw, nodeDict), router))
|
if (num !== 0) el.appendChild(document.createTextNode(" -> "))
|
||||||
|
num++
|
||||||
|
el.appendChild(document.createTextNode("..."))
|
||||||
|
}
|
||||||
|
if (num !== 0) el.appendChild(document.createTextNode(" -> "))
|
||||||
|
el.appendChild(createLink(gw, router))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
|
||||||
return showStat(o, subst)
|
return showStat(o, subst)
|
||||||
}
|
}
|
||||||
|
|
||||||
return function(config, el, router, d, nodeDict) {
|
return function(config, el, router, d) {
|
||||||
var attributes = document.createElement("table")
|
var attributes = document.createElement("table")
|
||||||
attributes.classList.add("attributes")
|
attributes.classList.add("attributes")
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
|
||||||
attributeEntry(attributes, "Arbeitsspeicher", showRAM(d))
|
attributeEntry(attributes, "Arbeitsspeicher", showRAM(d))
|
||||||
attributeEntry(attributes, "IP Adressen", showIPs(d))
|
attributeEntry(attributes, "IP Adressen", showIPs(d))
|
||||||
attributeEntry(attributes, "Webseite", showPages(d))
|
attributeEntry(attributes, "Webseite", showPages(d))
|
||||||
attributeEntry(attributes, "Gewähltes Gateway", showGateway(d, router, nodeDict))
|
attributeEntry(attributes, "Gewähltes Gateway", showGateway(d, router))
|
||||||
attributeEntry(attributes, "Autom. Updates", showAutoupdate(d))
|
attributeEntry(attributes, "Autom. Updates", showAutoupdate(d))
|
||||||
attributeEntry(attributes, "Clients", showClients(d), showMeshClients(d))
|
attributeEntry(attributes, "Clients", showClients(d), showMeshClients(d))
|
||||||
|
|
||||||
|
|
|
@ -119,8 +119,9 @@ 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) {
|
|
||||||
nodeDict[d.id.substr(0, 8)] = d
|
data.nodes.all.forEach(function (d) {
|
||||||
|
nodeDict[d.nodeinfo.node_id] = d
|
||||||
})
|
})
|
||||||
|
|
||||||
var statusDict = count(nodes, ["flags", "online"], function (d) {
|
var statusDict = count(nodes, ["flags", "online"], function (d) {
|
||||||
|
@ -161,13 +162,6 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
|
||||||
if (d.id)
|
if (d.id)
|
||||||
return 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
|
return d
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -181,13 +175,6 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
|
||||||
if (d.id)
|
if (d.id)
|
||||||
return 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
|
return d
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue