Primitive auto reload for monitoring pane

reload the monitoring page every 30 secondsa
checkbox to enable/disable auto refresh

screenshot:
https://imagebin.ca/v/3UAtqA25IGK5

longer term, we want a more refined implementation with
refreshing partial page and customizable refresh interval.
But this primitive solution works reasonably well to start.

Implements blueprint enhance-congress-dashboard
Partial-Bug:#1670520

Change-Id: I50b678682480d5f2686fb099a6093ac9eb60aa52
This commit is contained in:
Eric Kao 2017-07-19 23:21:46 -07:00
parent 318dd8dba4
commit 08acf71eb2
1 changed files with 20 additions and 0 deletions

View File

@ -8,6 +8,26 @@
{% block main %}
<div id="monitoring_panel">
<script type="text/javascript">
// primitive auto-reload every 30 seconds
function makeReloadInterval() {
return setInterval(function(){location.reload();}, 30000);
}
reloadInterval = makeReloadInterval()
function toggleRefresh() {
checkbox = document.getElementById("checkBox_auto_refresh")
if (!checkbox.checked) {
clearInterval(reloadInterval)
}
else {
reloadInterval = makeReloadInterval()
}
}
</script>
<input id="checkBox_auto_refresh" type="checkbox" checked onclick="toggleRefresh()">
<label for="checkBox_auto_refresh">
Auto refresh (every 30 seconds)
</label>
{{ monitoring_table.render }}
</div>
<script type="text/javascript">