From ecf8fe7ec4145a161e0245cd4a1307109cb52b07 Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Sat, 21 Jan 2017 01:53:55 +0100 Subject: [PATCH] [TASK] Optional hardware usage in node infobox --- README.md | 14 ++++++++++---- config.json | 5 ++++- lib/infobox/node.js | 8 +++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5a2d2c5..362722f 100644 --- a/README.md +++ b/README.md @@ -89,10 +89,6 @@ It may help with firewall problems too. Change this to match your communities' name. It will be used in various places. -## showContact (bool) - -Setting this to `false` will hide contact information for nodes. - ## maxAge (integer) Nodes being online for less than maxAge days are considered "new". Likewise, @@ -103,6 +99,16 @@ nodes being offline for more than than maxAge days are considered "lost". Max level to be applied by clicking a node or open a node. With value `18` near by buildings and streets should be visible. Interesting if one of configured map provider has zoom-level under `18`. +## nodeInfobox + +#### contact (bool) + +Setting this to `false` will hide contact information for nodes. + +#### hardwareUsage (bool) + +Setting this to `false` will hide bars of memory usage and load avg for nodes. + ## mapLayers (List) A list of objects describing map layers. Each object has at least `name`, `url` and `config` properties. [Example layers and configuration](http://leaflet-extras.github.io/leaflet-providers/preview/) (map against config.json). diff --git a/config.json b/config.json index cd4d78c..4d2665c 100644 --- a/config.json +++ b/config.json @@ -27,9 +27,12 @@ "dataPath": "https://regensburg.freifunk.net/data/", "reverseGeocodingApi": "https://nominatim.openstreetmap.org/reverse", "siteName": "Freifunk Regensburg", - "showContact": false, "maxAge": 14, "nodeZoom": 18, + "nodeInfobox": { + "contact": false, + "hardwareUsage": true + }, "mapLayers": [ { "name": "Freifunk Regensburg", diff --git a/lib/infobox/node.js b/lib/infobox/node.js index a039751..8df6c41 100644 --- a/lib/infobox/node.js +++ b/lib/infobox/node.js @@ -227,7 +227,7 @@ define(["chroma-js", "moment/moment", "tablesort", "helper", "moment/locale/de"] helper.attributeEntry(attributes, "Gateway", d.flags.gateway ? "ja" : null); helper.attributeEntry(attributes, "Koordinaten", showGeoURI(d)); - if (config.showContact) { + if (config.nodeInfobox && config.nodeInfobox.contact) { helper.attributeEntry(attributes, "Kontakt", helper.dictGet(d.nodeinfo, ["owner", "contact"])); } @@ -238,8 +238,10 @@ define(["chroma-js", "moment/moment", "tablesort", "helper", "moment/locale/de"] helper.attributeEntry(attributes, "Site", showSite(d, config)); helper.attributeEntry(attributes, "Uptime", showUptime(d)); helper.attributeEntry(attributes, "Teil des Netzes", showFirstseen(d)); - helper.attributeEntry(attributes, "Systemlast", showLoad(d)); - helper.attributeEntry(attributes, "Arbeitsspeicher", showRAM(d)); + if (config.nodeInfobox && config.nodeInfobox.hardwareUsage) { + helper.attributeEntry(attributes, "Systemlast", showLoad(d)); + helper.attributeEntry(attributes, "Arbeitsspeicher", showRAM(d)); + } helper.attributeEntry(attributes, "IP Adressen", showIPs(d)); helper.attributeEntry(attributes, "Webseite", showPages(d)); helper.attributeEntry(attributes, "Gewähltes Gateway", helper.dictGet(d.statistics, ["gateway"]));