summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2017-08-01 13:51:45 +0200
committerJo-Philipp Wich <jo@mein.io>2017-08-05 14:27:27 +0200
commit21ae7f2181d919d3f3e48a97383b95fbc825350c (patch)
tree92008eeb07ac24a12564f550cce483e69b21d73d
parentee54fd7784fd439b36c6877444e1e7033d039c51 (diff)
luci-app-nlbwmon: always fetch latest data
When displaying the most current accounting period, pass an empty timestamp to the backend in order to query the current in-memory data instead of the latest committed values. This ensures that the dashboard always renders the most current data in its default view. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--applications/luci-app-nlbwmon/luasrc/view/nlbw/display.htm8
1 files changed, 5 insertions, 3 deletions
diff --git a/applications/luci-app-nlbwmon/luasrc/view/nlbw/display.htm b/applications/luci-app-nlbwmon/luasrc/view/nlbw/display.htm
index 749b42116..7e85acefb 100644
--- a/applications/luci-app-nlbwmon/luasrc/view/nlbw/display.htm
+++ b/applications/luci-app-nlbwmon/luasrc/view/nlbw/display.htm
@@ -430,19 +430,21 @@ function renderPeriods()
for (var e, i = trafficPeriods.length - 1; e = trafficPeriods[i]; i--) {
var d1 = new Date(e);
- var d2;
+ var d2, pd;
if (i) {
d2 = new Date(trafficPeriods[i - 1]);
d2.setDate(d2.getDate() - 1);
+ pd = '%04d-%02d-%02d'.format(d1.getFullYear(), d1.getMonth() + 1, d1.getDate());
}
else {
d2 = new Date();
+ pd = '';
}
var opt = document.createElement('option');
opt.setAttribute('data-duration', (d2.getTime() - d1.getTime()) / 1000);
- opt.value = '%04d-%02d-%02d'.format(d1.getFullYear(), d1.getMonth() + 1, d1.getDate());
+ opt.value = pd;
opt.text = '%04d-%02d-%02d - %04d-%02d-%02d'.format(
d1.getFullYear(), d1.getMonth() + 1, d1.getDate(),
d2.getFullYear(), d2.getMonth() + 1, d2.getDate());
@@ -1040,7 +1042,7 @@ function bubbleDismiss()
if (res !== null && typeof(res) === 'object' && (res.length % 3) === 0)
ouiData = res;
- fetchData(trafficPeriods[0]);
+ fetchData('');
}
};
xhr.send(null);