From 489739c7d87529a3b4bc11b890b82616062e20a9 Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Thu, 2 Feb 2017 00:47:54 +0100 Subject: [PATCH] [TASK] Configurable alert marker --- README.md | 5 +++++ config.json | 1 + lib/map.js | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6e0660c..5774e7b 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,11 @@ Change this to match your communities' name. It will be used in various places. Nodes being online for less than maxAge days are considered "new". Likewise, nodes being offline for more than than maxAge days are considered "lost". +## maxAgeAlert (integer) + +Nodes being offline for more than than maxAge days are considered "lost". +Lost will be splitted in alert and lost. + ## nodeZoom (integer) Max level to be applied by clicking a node or open a node. With value `18` near by buildings and streets should be visible. diff --git a/config.json b/config.json index 113093d..09e41b6 100644 --- a/config.json +++ b/config.json @@ -28,6 +28,7 @@ "reverseGeocodingApi": "https://nominatim.openstreetmap.org/reverse", "siteName": "Freifunk Regensburg", "maxAge": 14, + "maxAgeAlert": 3, "nodeZoom": 18, "nodeInfobox": { "contact": false, diff --git a/lib/map.js b/lib/map.js index 39dec85..74dd6b0 100644 --- a/lib/map.js +++ b/lib/map.js @@ -473,11 +473,11 @@ define(['map/clientlayer', 'map/labelslayer', var markersLost = data.nodes.lost.filter(helper.hasLocation) .map(mkMarker(nodeDict, function (d) { - if (d.lastseen.isAfter(moment(data.now).subtract(3, 'days'))) { + if (d.lastseen.isAfter(moment(data.now).subtract(config.maxAgeAlert, 'days'))) { return iconAlert; } - if (d.lastseen.isAfter(moment(data.now).subtract(14, 'days'))) { + if (d.lastseen.isAfter(moment(data.now).subtract(config.maxAge, 'days'))) { return iconLost; } return null;