infobox: added wifi channel, airtime and batctl nexthop (#38)
* infobox: added wifi channel, airtime and batctl nexthop * simplify * kill all semicolons * update data locations I'd suggest that channel information go under nodeinfo. Airtime and nexthop are changing variables which should go under statistics. * filter out nodes with faulty nodeinfo * additional nexthop key The nexthop to the batman gateway has now been made available in gluon master where it will be called "gateway_nexthop" the "nexthop" key is also currently in use and should eventually be removed * sidebar/node: cosmetic changes to gateway/nexthop * remove data validity check * move wifi helper function to sidebar/node * cosmetics
This commit is contained in:
parent
2bbdd1e077
commit
f80ea1ca8f
2 changed files with 92 additions and 14 deletions
lib/infobox
|
@ -81,6 +81,54 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
|
|||
return d.firstseen.fromNow(true)
|
||||
}
|
||||
|
||||
function wifiChannelAlias(ch) {
|
||||
var chlist = {
|
||||
"1": "2412 MHz",
|
||||
"2": "2417 MHz",
|
||||
"3": "2422 MHz",
|
||||
"4": "2427 MHz",
|
||||
"5": "2432 MHz",
|
||||
"6": "2437 MHz",
|
||||
"7": "2442 MHz",
|
||||
"8": "2447 MHz",
|
||||
"9": "2452 MHz",
|
||||
"10": "2457 MHz",
|
||||
"11": "2462 MHz",
|
||||
"12": "2467 MHz",
|
||||
"13": "2472 MHz",
|
||||
"36": "5180 MHz (Indoors)",
|
||||
"40": "5200 MHz (Indoors)",
|
||||
"44": "5220 MHz (Indoors)",
|
||||
"48": "5240 MHz (Indoors)",
|
||||
"52": "5260 MHz (Indoors/DFS/TPC)",
|
||||
"56": "5280 MHz (Indoors/DFS/TPC)",
|
||||
"60": "5300 MHz (Indoors/DFS/TPC)",
|
||||
"64": "5320 MHz (Indoors/DFS/TPC)",
|
||||
"100": "5500 MHz (DFS) !!",
|
||||
"104": "5520 MHz (DFS) !!",
|
||||
"108": "5540 MHz (DFS) !!",
|
||||
"112": "5560 MHz (DFS) !!",
|
||||
"116": "5580 MHz (DFS) !!",
|
||||
"120": "5600 MHz (DFS) !!",
|
||||
"124": "5620 MHz (DFS) !!",
|
||||
"128": "5640 MHz (DFS) !!",
|
||||
"132": "5660 MHz (DFS) !!",
|
||||
"136": "5680 MHz (DFS) !!",
|
||||
"140": "5700 MHz (DFS) !!"
|
||||
}
|
||||
if (!(ch in chlist))
|
||||
return ""
|
||||
else
|
||||
return chlist[ch]
|
||||
}
|
||||
|
||||
function showWifiChannel(ch) {
|
||||
if (!ch)
|
||||
return undefined
|
||||
|
||||
return ch + " (" + wifiChannelAlias(ch) + ")"
|
||||
}
|
||||
|
||||
function showClients(d) {
|
||||
if (!d.flags.online)
|
||||
return undefined
|
||||
|
@ -180,6 +228,32 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
|
|||
}
|
||||
}
|
||||
|
||||
function showAirtime(band, val) {
|
||||
if (!val)
|
||||
return undefined
|
||||
|
||||
return function (el) {
|
||||
el.appendChild(showBar("airtime" + band.toString(), val))
|
||||
}
|
||||
}
|
||||
|
||||
function showGateway(d) {
|
||||
var nh
|
||||
if (dictGet(d.statistics, ["nexthop"]))
|
||||
nh = dictGet(d.statistics, ["nexthop"])
|
||||
if (dictGet(d.statistics, ["gateway_nexthop"]))
|
||||
nh = dictGet(d.statistics, ["gateway_nexthop"])
|
||||
var gw = dictGet(d.statistics, ["gateway"])
|
||||
|
||||
if (gw && !nh)
|
||||
return gw
|
||||
if (gw && nh)
|
||||
if (gw === nh)
|
||||
return gw
|
||||
else
|
||||
return nh + " -> ... -> " + gw
|
||||
}
|
||||
|
||||
function showPages(d) {
|
||||
var webpages = dictGet(d.nodeinfo, ["pages"])
|
||||
if (webpages === null)
|
||||
|
@ -248,11 +322,15 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
|
|||
attributeEntry(attributes, "Site", showSite(d, config))
|
||||
attributeEntry(attributes, "Uptime", showUptime(d))
|
||||
attributeEntry(attributes, "Teil des Netzes", showFirstseen(d))
|
||||
attributeEntry(attributes, "Kanal 2.4 GHz", showWifiChannel(dictGet(d.nodeinfo, ["wireless", "chan2"])))
|
||||
attributeEntry(attributes, "Kanal 5 GHz", showWifiChannel(dictGet(d.nodeinfo, ["wireless", "chan5"])))
|
||||
attributeEntry(attributes, "Airtime 2.4 GHz", showAirtime(2, dictGet(d.statistics, ["wireless", "airtime2"])))
|
||||
attributeEntry(attributes, "Airtime 5 GHz", showAirtime(5, dictGet(d.statistics, ["wireless", "airtime5"])))
|
||||
attributeEntry(attributes, "Systemlast", showLoad(d))
|
||||
attributeEntry(attributes, "Arbeitsspeicher", showRAM(d))
|
||||
attributeEntry(attributes, "IP Adressen", showIPs(d))
|
||||
attributeEntry(attributes, "Webseite", showPages(d))
|
||||
attributeEntry(attributes, "Gewähltes Gateway", dictGet(d.statistics, ["gateway"]))
|
||||
attributeEntry(attributes, "Gewähltes Gateway", showGateway(d))
|
||||
attributeEntry(attributes, "Autom. Updates", showAutoupdate(d))
|
||||
attributeEntry(attributes, "Clients", showClients(d))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue