diff --git a/history.html b/history.html
index e956de2..2172a5c 100644
--- a/history.html
+++ b/history.html
@@ -176,6 +176,10 @@
Funktioniert nur in wirklich modernen Browsern.
+ Meshdaten
+
+
+
Neue Knoten
diff --git a/history.js b/history.js
index 48ba062..940eb66 100644
--- a/history.js
+++ b/history.js
@@ -158,6 +158,8 @@ function handle_data(config, map) {
addToList(document.getElementById("newnodes"), config.showContact, "firstseen", markers, newnodes)
addToList(document.getElementById("lostnodes"), config.showContact, "lastseen", markers, lostnodes)
addToLongLinksList(document.getElementById("longlinks"), markers, longlinks)
+
+ showMeshstats(document.getElementById("meshstats"), nodes)
}
}
@@ -336,3 +338,33 @@ function addToList(el, showContact, tf, markers, list) {
el.appendChild(row)
})
}
+
+function sum(a) {
+ return a.reduce( function (a, b) {
+ return a + b
+ }, 0)
+}
+
+function one() {
+ return 1
+}
+
+function showMeshstats(el, nodes) {
+ var totalNodes = sum(nodes.filter(online).map(one))
+
+ var totalClients = sum(nodes.filter(online).map( function (d) {
+ return d.statistics.clients
+ }))
+
+ var totalGateways = sum(nodes.filter(online).filter( function (d) {
+ return d.flags.gateway
+ }).map(one))
+
+ el.textContent = totalNodes + " Knoten (online), " +
+ totalClients + " Clients, " +
+ totalGateways + " Gateways"
+}
+
+function showNodeinfo(d) {
+ var object = document.getElementById("nodeinfo")
+}