statistics: re-add "Gateway-Feature"

revert commit c13e648cc6.
This commit is contained in:
PetaByteBoy 2015-11-06 21:10:43 +01:00 committed by Milan Pässler
parent 1e74f319ef
commit 80afc7d162
3 changed files with 26 additions and 2 deletions

View file

@ -182,6 +182,7 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
attributes.classList.add("attributes")
attributeEntry(attributes, "Status", showStatus(d))
attributeEntry(attributes, "Gateway", d.flags.gateway ? "ja" : null)
attributeEntry(attributes, "Koordinaten", showGeoURI(d))
if (config.showContact)

View file

@ -11,6 +11,9 @@ define(function () {
var totalClients = sum(d.nodes.all.filter(online).map( function (d) {
return d.statistics.clients
}))
var totalGateways = sum(d.nodes.all.filter(online).filter( function (d) {
return d.flags.gateway
}).map(one))
var nodetext = [{ count: totalOnlineNodes, label: "online" },
{ count: totalNewNodes, label: "neu" },
@ -20,8 +23,9 @@ define(function () {
.join(", ")
stats.textContent = totalNodes + " Knoten " +
"(" + nodetext + ") mit " +
totalClients + " Client" + ( totalClients === 1 ? "" : "s" )
"(" + nodetext + "), " +
totalClients + " Client" + ( totalClients === 1 ? ", " : "s, " ) +
totalGateways + " Gateways"
timestamp.textContent = "Diese Daten sind von " + d.timestamp.format("LLLL") + "."
}

View file

@ -23,6 +23,9 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
var uplinkTable = document.createElement("table")
uplinkTable.classList.add("proportion")
var gwTable = document.createElement("table")
gwTable.classList.add("proportion")
function showStatGlobal(o) {
var content, caption
@ -145,12 +148,23 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
return d ? "ja" : "nein"
})
var gwDict = count(nodes, ["statistics", "gateway"], function (d) {
if (d === null)
return null
if (d in nodeDict)
return nodeDict[d].nodeinfo.hostname
return d
})
fillTable("Status", statusTable, statusDict.sort(function (a, b) { return b[1] - a[1] }))
fillTable("Firmware", fwTable, fwDict.sort(function (a, b) { return vercomp(b[0], a[0]) }))
fillTable("Hardware", hwTable, hwDict.sort(function (a, b) { return b[1] - a[1] }))
fillTable("Koordinaten", geoTable, geoDict.sort(function (a, b) { return b[1] - a[1] }))
fillTable("Autom. Updates", autoTable, autoDict.sort(function (a, b) { return b[1] - a[1] }))
fillTable("Uplink", uplinkTable, uplinkDict.sort(function (a, b) { return b[1] - a[1] }))
fillTable("Gewähltes Gateway", gwTable, gwDict.sort(function (a, b) { return b[1] - a[1] }))
}
self.render = function (el) {
@ -185,6 +199,11 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
el.appendChild(h2)
el.appendChild(uplinkTable)
h2 = document.createElement("h2")
h2.textContent = "Gewählter Gateway"
el.appendChild(h2)
el.appendChild(gwTable)
if (config.globalInfos)
config.globalInfos.forEach( function (globalInfo) {
h2 = document.createElement("h2")