Graph auto-refresh.
Change-Id: I3625fbba854c26e448e9d4fbbc96e3c2912eaa5b
This commit is contained in:
parent
ecdbb27662
commit
48a40ce9cf
File diff suppressed because one or more lines are too long
|
@ -5,13 +5,29 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" href="{{ url_for('v1.static', filename='design.css') }}"/>
|
<link rel="stylesheet" href="{{ url_for('v1.static', filename='design.css') }}"/>
|
||||||
<link rel="icon" type="image/png" href="{{ url_for('v1.static', filename='favicon.png') }}" />
|
<link rel="icon" type="image/png" href="{{ url_for('v1.static', filename='favicon.png') }}" />
|
||||||
|
<script src="{{ url_for('v1.static', filename='jquery-1.9.1.min.js') }}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
function reloadImage(image)
|
function reloadImage(img) {
|
||||||
{
|
var src = img.attr('src');
|
||||||
if(image.src.indexOf("?") == -1)
|
param_position = src.indexOf('?');
|
||||||
image.src = image.src + "?reload=" + Date.now();
|
if(param_position != -1) {
|
||||||
|
src = src.substring(0, param_position);
|
||||||
|
}
|
||||||
|
src += '?timestamp=' + Date.now();
|
||||||
|
img.attr('src', src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reloadAllImages() {
|
||||||
|
$('.graph').each(function() {
|
||||||
|
reloadImage($(this));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
reloadAllImages();
|
||||||
|
setInterval('reloadAllImages()', 5000);
|
||||||
|
});
|
||||||
// ]]>
|
// ]]>
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -36,11 +52,11 @@
|
||||||
{% if probes|count > 0 %}
|
{% if probes|count > 0 %}
|
||||||
<h2>Summary</h2>
|
<h2>Summary</h2>
|
||||||
<!-- Display summary graph -->
|
<!-- Display summary graph -->
|
||||||
<img id="summary" src="/graph/{{ scale }}" alt="Summary graph" onload="reloadImage(this)"/>
|
<img class="graph" id="summary" src="/graph/{{ scale }}" alt="Summary graph"/>
|
||||||
<h2>Details</h2>
|
<h2>Details</h2>
|
||||||
<!-- Display all probe graphs -->
|
<!-- Display all probe graphs -->
|
||||||
{% for probe in probes %}
|
{% for probe in probes %}
|
||||||
<a href="/probe/{{ probe }}"><img src="/graph/{{ scale }}/{{ probe }}" alt="Graph {{ probe }}" onload="reloadImage(this)"/></a>
|
<a href="/probe/{{ probe }}"><img class="graph" src="/graph/{{ scale }}/{{ probe }}" alt="Graph {{ probe }}"/></a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>No probes found.</p>
|
<p>No probes found.</p>
|
||||||
|
@ -49,7 +65,7 @@
|
||||||
<!-- Probe view (all scales for one probe) -->
|
<!-- Probe view (all scales for one probe) -->
|
||||||
{% elif view == 'probe' %}
|
{% elif view == 'probe' %}
|
||||||
{% for scale in scales %}
|
{% for scale in scales %}
|
||||||
<img src="/graph/{{ scale }}/{{ probe }}" alt="Graph {{ probe }}" onload="reloadImage(this)"/>
|
<img class="graph" src="/graph/{{ scale }}/{{ probe }}" alt="Graph {{ probe }}"/>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue