add day graph and total bandwidth to admin panel

This commit is contained in:
2020-07-19 11:29:39 +02:00
parent d8001d1176
commit 70e39ca11c
4 changed files with 19 additions and 5 deletions

View File

@@ -117,13 +117,22 @@ function loadGraph(minutes, interval, live){
window.graph.data.datasets[0].data = resp.downloads;
window.graph.data.datasets[1].data = resp.views;
window.graph.update();
document.getElementById("time_start").innerText = resp.labels[0];
document.getElementById("time_end").innerText = resp.labels.slice(-1)[0];
let total = 0
resp.downloads.forEach(e => { total += e; });
document.getElementById("total_bandwidth").innerText = formatDataVolume(total, 3);
total = 0
resp.views.forEach(e => { total += e; });
document.getElementById("total_views").innerText = formatThousands(total);
}
}).catch(e => {
alert("Error requesting time series: "+e);
})
}
loadGraph(60, 1, true);
loadGraph(360, 1, true);
// Load performance statistics