update web pages to support additional date info

This makes the web ui support some additional timestamps that will be
brought in from the json data. It's done in a compatible way so that
if this change lands before the data payload updates land it won't
break horribly.

This will let us display how far behind we are with our data
generation.

Change-Id: If4926879569a36cdd29d7e261ef556ef1a64b39d
This commit is contained in:
Sean Dague 2014-09-26 13:16:56 -04:00
parent ee84691e1d
commit 695e9370a7
3 changed files with 41 additions and 1 deletions

View File

@ -29,11 +29,38 @@ function graphite_hit_count(job, color) {
return graph;
}
function update_critical_dates(data) {
var last_updated = new Date(data['now']);
var last_indexed = new Date(data['last_indexed']);
$('#last_updated').text(last_updated.toString());
$('#last_indexed').text(last_indexed.toString());
var hours = parseInt(data['behind'] / 60 / 60 / 1000);
var behind = $('#behind');
if (hours > 0) {
behind.css('font-weight', 'bold');
behind.text("Indexing behind by " + hours + " hours");
$('#behind').text("Indexing behind by " + hours + " hours");
if (hours > 0) {
behind.css('color', 'red');
}
} else {
behind.css('font-weight', 'normal');
$('#behind').text("Up to date");
}
}
function update() {
$.getJSON(data_url, function(data) {
var seen = [];
$.each(data, function(i, bug) {
var buglist = data;
// compatibility while we flip data over
if ('buglist' in data) {
buglist = data['buglist'];
update_critical_dates(data);
}
$.each(buglist, function(i, bug) {
var id = 'bug-'+bug['number'];
seen.push(id);
var div = $('#'+id);

View File

@ -60,6 +60,13 @@
</ul>
</div>
<div id="vital-stats" class="container">
Data Last Updated: <span id="last_updated"></span><br>
Last Elastic Search Index Update: <span id="last_indexed"></span><br>
Delay in Elastic Search: <span id="behind"></span><br>
</div>
<div id="main-container" class="container">
</div>

View File

@ -61,6 +61,12 @@
<p>The elastic-recheck project uses Elasticsearch to classify and track OpenStack gate failures. Documentation can be found here: <a href="http://docs.openstack.org/infra/elastic-recheck/">http://docs.openstack.org/infra/elastic-recheck/</a></p>
</div>
<div id="vital-stats" class="container">
Data Last Updated: <span id="last_updated"></span><br>
Last Elastic Search Index Update: <span id="last_indexed"></span><br>
Delay in Elastic Search: <span id="behind"></span><br>
</div>
<div id="main-container" class="container">
</div>