infobox/node: move status to attributes table

This commit is contained in:
Nils Schneider 2015-07-07 01:00:30 +02:00
parent 37c3278ded
commit cc3d591bd0

View file

@ -36,6 +36,13 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
} }
} }
function showStatus(d) {
return function (el) {
el.classList.add(d.flags.online ? "online" : "offline")
el.textContent = d.flags.online ? "online" : "offline, " + d.lastseen.fromNow(true)
}
}
function showFirmware(d) { function showFirmware(d) {
var release = dictGet(d.nodeinfo, ["software", "firmware", "release"]) var release = dictGet(d.nodeinfo, ["software", "firmware", "release"])
var base = dictGet(d.nodeinfo, ["software", "firmware", "base"]) var base = dictGet(d.nodeinfo, ["software", "firmware", "base"])
@ -169,15 +176,12 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
return function(config, el, router, d) { return function(config, el, router, d) {
var h2 = document.createElement("h2") var h2 = document.createElement("h2")
h2.textContent = d.nodeinfo.hostname h2.textContent = d.nodeinfo.hostname
var span = document.createElement("span")
span.classList.add(d.flags.online ? "online" : "offline")
span.textContent = " (" + (d.flags.online ? "online" : "offline, " + d.lastseen.fromNow(true)) + ")"
h2.appendChild(span)
el.appendChild(h2) el.appendChild(h2)
var attributes = document.createElement("table") var attributes = document.createElement("table")
attributes.classList.add("attributes") attributes.classList.add("attributes")
attributeEntry(attributes, "Status", showStatus(d))
attributeEntry(attributes, "Gateway", d.flags.gateway ? "ja" : null) attributeEntry(attributes, "Gateway", d.flags.gateway ? "ja" : null)
attributeEntry(attributes, "Koordinaten", showGeoURI(d)) attributeEntry(attributes, "Koordinaten", showGeoURI(d))