meshstats: dynamic gateway count

This commit is contained in:
Milan Pässler 2016-06-02 22:43:53 +02:00
parent 1bcd2b797d
commit 93355f28ba
2 changed files with 5 additions and 4 deletions

View file

@ -4,9 +4,8 @@ define([], function () {
var n = Object.create(data) var n = Object.create(data)
n.nodes = {} n.nodes = {}
for (var key in data.nodes) { for (var key in data.nodes)
n.nodes[key] = data.nodes[key].filter(filter) n.nodes[key] = data.nodes[key].filter(filter)
}
var filteredIds = new Set() var filteredIds = new Set()

View file

@ -11,9 +11,11 @@ define(function () {
var totalClients = sum(d.nodes.all.filter(online).map( function (d) { var totalClients = sum(d.nodes.all.filter(online).map( function (d) {
return d.statistics.clients ? d.statistics.clients : 0 return d.statistics.clients ? d.statistics.clients : 0
})) }))
var totalGateways = sum(d.nodes.all.filter(online).filter( function (d) { var totalGateways = sum(Array.from(new Set(d.nodes.all.filter(online).map( function(d) {
return d.statistics.gateway
}).concat(d.nodes.all.filter( function (d) {
return d.flags.gateway return d.flags.gateway
}).map(one)) })))).map(one))
var nodetext = [{ count: totalOnlineNodes, label: "online" }, var nodetext = [{ count: totalOnlineNodes, label: "online" },
{ count: totalNewNodes, label: "neu" }, { count: totalNewNodes, label: "neu" },