Merge pull request #20 from oakey-dev/master

add statisik about nodes total, online, with geo
This commit is contained in:
Nils Schneider 2015-06-19 20:28:11 +02:00
commit 3a413463ec

View File

@ -3,7 +3,7 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
return function (config) { return function (config) {
var self = this var self = this
var fwTable, hwTable, autoTable, gwTable var fwTable, hwTable, geoTable, autoTable, gwTable
var scale = Chroma.scale("YlGnBu").mode("lab") var scale = Chroma.scale("YlGnBu").mode("lab")
function showStatGlobal(o) { function showStatGlobal(o) {
@ -98,6 +98,12 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
var fwDict = count(nodes, ["nodeinfo", "software", "firmware", "release"]) var fwDict = count(nodes, ["nodeinfo", "software", "firmware", "release"])
var hwDict = count(nodes, ["nodeinfo", "hardware", "model"]) var hwDict = count(nodes, ["nodeinfo", "hardware", "model"])
var geoDict = count(nodes, ["nodeinfo", "location"], function (d) {
if (d)
return "ja"
else
return "nein"
})
var autoDict = count(nodes, ["nodeinfo", "software", "autoupdater"], function (d) { var autoDict = count(nodes, ["nodeinfo", "software", "autoupdater"], function (d) {
if (d === null) if (d === null)
return null return null
@ -119,6 +125,7 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
fillTable(fwTable, fwDict.sort(function (a, b) { return b[1] - a[1] })) fillTable(fwTable, fwDict.sort(function (a, b) { return b[1] - a[1] }))
fillTable(hwTable, hwDict.sort(function (a, b) { return b[1] - a[1] })) fillTable(hwTable, hwDict.sort(function (a, b) { return b[1] - a[1] }))
fillTable(geoTable, geoDict.sort(function (a, b) { return b[1] - a[1] }))
fillTable(autoTable, autoDict.sort(function (a, b) { return b[1] - a[1] })) fillTable(autoTable, autoDict.sort(function (a, b) { return b[1] - a[1] }))
fillTable(gwTable, gwDict.sort(function (a, b) { return b[1] - a[1] })) fillTable(gwTable, gwDict.sort(function (a, b) { return b[1] - a[1] }))
} }
@ -141,6 +148,14 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
hwTable.classList.add("proportion") hwTable.classList.add("proportion")
el.appendChild(hwTable) el.appendChild(hwTable)
h2 = document.createElement("h2")
h2.textContent = "Auf der Karte sichtbar"
el.appendChild(h2)
geoTable = document.createElement("table")
geoTable.classList.add("proportion")
el.appendChild(geoTable)
h2 = document.createElement("h2") h2 = document.createElement("h2")
h2.textContent = "Autoupdater" h2.textContent = "Autoupdater"
el.appendChild(h2) el.appendChild(h2)