Skip to content
Snippets Groups Projects
Commit 848b5b73 authored by Nils Schneider's avatar Nils Schneider
Browse files

proportions: add online/offline statistics

parent ec49c9d5
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,9 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
var self = this
var scale = Chroma.scale("YlGnBu").mode("lab")
var statusTable = document.createElement("table")
statusTable.classList.add("proportion")
var fwTable = document.createElement("table")
fwTable.classList.add("proportion")
......@@ -110,6 +113,9 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
nodeDict[d.nodeinfo.node_id] = d
})
var statusDict = count(nodes, ["flags", "online"], function (d) {
return d ? "online" : "offline"
})
var fwDict = count(nodes, ["nodeinfo", "software", "firmware", "release"])
var hwDict = count(nodes, ["nodeinfo", "hardware", "model"])
var geoDict = count(nodes, ["nodeinfo", "location"], function (d) {
......@@ -137,6 +143,7 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
return d
})
fillTable(statusTable, statusDict.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(geoTable, geoDict.sort(function (a, b) { return b[1] - a[1] }))
......@@ -146,6 +153,11 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
self.render = function (el) {
var h2
h2 = document.createElement("h2")
h2.textContent = "Status"
el.appendChild(h2)
el.appendChild(statusTable)
h2 = document.createElement("h2")
h2.textContent = "Firmwareversionen"
el.appendChild(h2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment