From 8fcbf0ae53530fa5f2048d00c434fc88b934d1ec Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 23 Mar 2015 12:58:16 +0100 Subject: [PATCH] create meshstats in javascript --- history.html | 7 ------- history.js | 24 ++++++++++++++---------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/history.html b/history.html index 493dbfc..e79ac89 100644 --- a/history.html +++ b/history.html @@ -303,13 +303,6 @@
- -

Meshdaten

-

-

- -

-

diff --git a/history.js b/history.js index ba5a124..763661b 100644 --- a/history.js +++ b/history.js @@ -163,15 +163,11 @@ function handle_data(config, map) { gotoAnything.addMarkers(markers) + showMeshstats(document.getElementById("sidebardata"), nodes) mkNodesList(document.getElementById("sidebardata"), config.showContact, "firstseen", gotoAnything.node, "Neue Knoten", newnodes) mkNodesList(document.getElementById("sidebardata"), config.showContact, "lastseen", gotoAnything.node, "Verschwundene Knoten", lostnodes) mkLinkList(document.getElementById("sidebardata"), gotoAnything.link, links) - showMeshstats(document.getElementById("meshstats"), nodes) - - var timestamp = document.getElementById("timestamp") - timestamp.textContent = "Diese Daten sind " + moment.utc(nodes.timestamp).fromNow(true) + " alt." - var historyDict = { nodes: {}, links: {} } nodes.forEach( function (d) { @@ -465,19 +461,27 @@ function one() { } function showMeshstats(el, nodes) { - var totalNodes = sum(nodes.filter(online).map(one)) + var h2 = document.createElement("h2") + h2.textContent = "Übersicht" + el.appendChild(h2) + var p = document.createElement("p") + + 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" + p.textContent = totalNodes + " Knoten (online), " + + totalClients + " Clients, " + + totalGateways + " Gateways" + + p.appendChild(document.createElement("br")) + p.appendChild(document.createTextNode("Diese Daten sind " + moment.utc(nodes.timestamp).fromNow(true) + " alt.")) + el.appendChild(p) } function infobox() {