2018-04-18 16:46:53 -04:00
|
|
|
{% extends "layout.html" %}
|
|
|
|
|
|
|
|
{% block content %}
|
2018-04-21 18:18:20 -04:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-12">
|
|
|
|
<figure>
|
|
|
|
<div id="history_graph">{{history_graph|safe}}</div>
|
2018-04-23 17:03:50 -04:00
|
|
|
<figcaption class="float-right">
|
2018-04-21 18:18:20 -04:00
|
|
|
<span id="history_graph_zoom_out" class="h4 oi oi-zoom-out text-muted" style="cursor:pointer;"></span>
|
|
|
|
<span id="history_graph_zoom_in" class="h4 oi oi-zoom-in text-muted" style="cursor:pointer;"></span>
|
|
|
|
</figcaption>
|
2018-04-23 17:03:50 -04:00
|
|
|
<figcaption class="float-left">
|
|
|
|
<span class="h4 text-muted">{{instance_count}} instances</span>
|
|
|
|
<span class="h4 text-muted">— {{client_count}} clients</span>
|
|
|
|
</figcaption>
|
2018-04-21 18:18:20 -04:00
|
|
|
</figure>
|
|
|
|
|
2018-04-23 17:03:50 -04:00
|
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
|
|
|
2018-04-21 18:18:20 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block scripts %}
|
|
|
|
<script type="text/javascript" src="http://kozea.github.com/pygal.js/latest/pygal-tooltips.min.js"></script>
|
|
|
|
<script>
|
|
|
|
let dataPoints = {{data_points}};
|
|
|
|
let zoomLevel = Math.ceil(dataPoints / 2);
|
2018-04-23 17:03:50 -04:00
|
|
|
let maxPoints = {{max_data_points}}
|
2018-04-21 18:18:20 -04:00
|
|
|
//console.log(dataPoints);
|
|
|
|
|
|
|
|
function updateHistoryGraph() {
|
|
|
|
$.get('/history/' + zoomLevel)
|
|
|
|
.done(function (content) {
|
|
|
|
$('#history_graph').html(content.message);
|
2018-04-22 16:04:18 -04:00
|
|
|
dataPoints = content.data_points
|
2018-04-21 18:18:20 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
setInterval(updateHistoryGraph, 30000);
|
|
|
|
|
|
|
|
$('#history_graph_zoom_out').click(function () {
|
|
|
|
// console.log(zoomLevel);
|
2018-04-23 17:03:50 -04:00
|
|
|
zoomLevel = zoomLevel * 2 <= maxPoints ? Math.ceil(zoomLevel * 2) : dataPoints;
|
2018-04-21 18:18:20 -04:00
|
|
|
updateHistoryGraph();
|
|
|
|
});
|
2018-04-18 16:46:53 -04:00
|
|
|
|
2018-04-21 18:18:20 -04:00
|
|
|
$('#history_graph_zoom_in').click(function () {
|
|
|
|
// console.log(zoomLevel);
|
|
|
|
zoomLevel = zoomLevel / 2 > 2 ? Math.ceil(zoomLevel / 2) : 2;
|
|
|
|
updateHistoryGraph();
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
2018-04-18 16:46:53 -04:00
|
|
|
{% endblock %}
|