From 3c77af5cedcf771d4d969a84d47922a46c4d3845 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 8 Jul 2015 23:31:54 +0200 Subject: [PATCH] meshstats: show number of new and lost nodes --- lib/meshstats.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/meshstats.js b/lib/meshstats.js index 59d18be..9dada63 100644 --- a/lib/meshstats.js +++ b/lib/meshstats.js @@ -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"