meshstats: show number of new and lost nodes

This commit is contained in:
Nils Schneider 2015-07-08 23:31:54 +02:00
parent 3eabb5f351
commit 3c77af5ced

View File

@ -6,6 +6,8 @@ define(function () {
self.setData = function (d) {
var totalNodes = sum(d.nodes.all.map(one))
var totalOnlineNodes = sum(d.nodes.all.filter(online).map(one))
var totalNewNodes = sum(d.nodes.new.map(one))
var totalLostNodes = sum(d.nodes.lost.map(one))
var totalClients = sum(d.nodes.all.filter(online).map( function (d) {
return d.statistics.clients
}))
@ -13,8 +15,15 @@ define(function () {
return d.flags.gateway
}).map(one))
stats.textContent = "Insgesamt " + totalNodes + " Knoten, " +
"davon " + totalOnlineNodes + " online, " +
var nodetext = [{ count: totalOnlineNodes, label: "online" },
{ count: totalNewNodes, label: "neu" },
{ count: totalLostNodes, label: "verschwunden" }
].filter( function (d) { return d.count > 0 } )
.map( function (d) { return [d.count, d.label].join(" ") } )
.join(", ")
stats.textContent = totalNodes + " Knoten " +
"(" + nodetext + ") " +
totalClients + " Clients, " +
totalGateways + " Gateways"