statistics: site code statistics

configurable and documented!
This commit is contained in:
PetaByteBoy 2015-07-18 16:28:07 +02:00 committed by Milan Pässler
commit 80967c6259
4 changed files with 62 additions and 0 deletions

View file

@ -53,6 +53,17 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
return release + " / " + base
}
function showSite(d, config) {
var site = dictGet(d.nodeinfo, ["system", "site_code"])
var rt = site
if (config.siteNames)
config.siteNames.forEach( function (t) {
if(site === t.site)
rt = t.name
})
return rt
}
function showUptime(d) {
if (!("uptime" in d.statistics))
return undefined
@ -192,6 +203,7 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
attributeEntry(attributes, "Primäre MAC", dictGet(d.nodeinfo, ["network", "mac"]))
attributeEntry(attributes, "Node ID", dictGet(d.nodeinfo, ["node_id"]))
attributeEntry(attributes, "Firmware", showFirmware(d))
attributeEntry(attributes, "Site", showSite(d, config))
attributeEntry(attributes, "Uptime", showUptime(d))
attributeEntry(attributes, "Teil des Netzes", showFirstseen(d))
attributeEntry(attributes, "Arbeitsspeicher", showRAM(d))

View file

@ -26,6 +26,9 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
var gwTable = document.createElement("table")
gwTable.classList.add("proportion")
var siteTable = document.createElement("table")
siteTable.classList.add("proportion")
function showStatGlobal(o) {
var content, caption
@ -158,6 +161,16 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
return d
})
var siteDict = count(onlineNodes, ["nodeinfo", "system", "site_code"], function (d) {
var rt = d
if (config.siteNames)
config.siteNames.forEach( function (t) {
if(d === t.site)
rt = t.name
})
return rt
})
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] }))
@ -165,6 +178,7 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
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] }))
fillTable("Site", siteTable, siteDict.sort(function (a, b) { return b[1] - a[1] }))
}
self.render = function (el) {
@ -179,6 +193,13 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
el.appendChild(h2)
el.appendChild(fwTable)
if(config.siteNames || config.showSites) {
h2 = document.createElement("h2")
h2.textContent = "Orte"
el.appendChild(h2)
el.appendChild(siteTable)
}
h2 = document.createElement("h2")
h2.textContent = "Hardwaremodelle"
el.appendChild(h2)
@ -204,6 +225,11 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "verc
el.appendChild(h2)
el.appendChild(gwTable)
h2 = document.createElement("h2")
h2.textContent = "Site"
el.appendChild(h2)
el.appendChild(siteTable)
if (config.globalInfos)
config.globalInfos.forEach( function (globalInfo) {
h2 = document.createElement("h2")