diff --git a/res/template/admin.html b/res/template/admin.html index 319adbc..d9a3890 100644 --- a/res/template/admin.html +++ b/res/template/admin.html @@ -12,16 +12,16 @@ {{if $isAdmin.IsAdmin}}

Bandwidth and views

- - - - - - - - + + + + + + + +
-
+
@@ -40,8 +40,6 @@ Chart.defaults.global.tooltips.axis = "x"; Chart.defaults.global.tooltips.intersect = false; - var days = 7; - var interval = 60; var graph = new Chart( document.getElementById('bandwidth_chart'), { @@ -116,8 +114,17 @@ } ); - function setData(){ - fetch(apiEndpoint+"/admin/files/timeseries?days="+days+"&interval="+interval).then(resp => { + function setData(days, interval){ + let today = new Date() + let start = new Date() + start.setDate(start.getDate()-days) + + fetch( + apiEndpoint+"/admin/files/timeseries" + + "?start="+start.toISOString() + + "&end="+today.toISOString() + + "&interval="+interval + ).then(resp => { if (!resp.ok) { return Promise.reject("Error: "+resp.status);} return resp.json(); }).then(resp => { @@ -132,7 +139,7 @@ }) } - setData(); + setData(7, 60);
diff --git a/res/template/file_viewer.html b/res/template/file_viewer.html index 85a7d70..bf6f6b8 100644 --- a/res/template/file_viewer.html +++ b/res/template/file_viewer.html @@ -111,7 +111,7 @@

Downloads and views

-
+