Commit 72e8b7ad authored by Tomi Sarvela's avatar Tomi Sarvela
parents 0afc98ed 87288de2
......@@ -187,3 +187,25 @@ table.queue {
font-size: 14px;
line-height: 20px;
}
.queue-spinner {
border: 16px rgba(1,1,0,0.25) solid;
border-top: 16px black solid;
border-radius: 100%;
animation: spCircRot .8s infinite linear;
width: 12px;
height: 12px;
clear: both;
margin: 20px auto;
}
@keyframes spCircRot {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
......@@ -18,16 +18,12 @@ function format_date(raw_date) {
var BASE_URL="https://patchwork.freedesktop.org/api/1.0/";
function get_json(url, on_success) {
function get_json(url, handler) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {
on_success(JSON.parse(this.responseText));
} else {
document.querySelector('#message').innerHTML += this.responseText + "<br/>";
}
handler(this.status == 200 ? JSON.parse(this.responseText) : undefined);
}
};
......@@ -39,7 +35,8 @@ function get_json(url, on_success) {
function query_series(series_id) {
get_json(BASE_URL + 'series/' + series_id + '/',
function(response) {
document.querySelector('#name'+series_id).innerHTML = response['name'];
var message = response === undefined ? "Error while fetching " + series_id : response['name']
document.querySelector('#name'+series_id).innerHTML = message;
});
}
......@@ -55,17 +52,21 @@ function only_unique(arr) {
function get_events(name, timestamp) {
get_json(BASE_URL + 'projects/' + name + "/events/?name=series-new-revision&since=" + timestamp,
function(response) {
if (response === undefined){
document.getElementById(name + "-spinner").outerHTML = "Error while fetching data";
return;
}
results = only_unique(response['results']).reverse();
var i;
document.getElementById(name + "-spinner").outerHTML = "";
if (results.length == 0) {
document.querySelector('#' + name).innerHTML +=
'<tr><td colspan="4">' +
"There's nothing in this queue!" +
'</td></tr>';
}
for (i = 0; i < results.length; ++i) {
item = results[i];
series_id = item['series'];
......@@ -77,7 +78,7 @@ function get_events(name, timestamp) {
'<td><a href="https://patchwork.freedesktop.org/series/' + series_id + '/">' +
series_id + 'v' + item['parameters']['revision'] +
'</a></td>' +
'<td id="name' + series_id + '"></td>' +
'<td id="name' + series_id + '">fetching...</td>' +
'<td>' + format_date(event_time) + '</td>' +
'</tr>';
query_series(series_id);
......@@ -95,6 +96,7 @@ function query_timestamp(name, timestamp_file) {
get_events(name, this.responseText);
} else {
document.querySelector('#' + name).outerHTML = this.responseText + "<br/>";
document.getElementById(name + "-spinner").outerHTML = "";
}
}
};
......@@ -106,20 +108,19 @@ function query_timestamp(name, timestamp_file) {
function fill_shard_name(series) {
get_json(BASE_URL + 'series/' + series.id + '/',
function(response) {
var name = response['name'];
var td = document.querySelector('#shard-name-' + series.name);
td.innerHTML = name;
var message = response === undefined ? "Error while fetching." : response['name'];
document.querySelector('#shard-name-' + series.name).innerHTML = message;
});
}
function process_shards(name, shards) {
document.getElementById(name + "-spinner").outerHTML = "";
if (shards.length == 0) {
document.querySelector('#' + name).innerHTML +=
'<tr><td colspan="4">' +
"There's nothing in this queue!" +
'</td></tr>';
}
for (var i = 0; i < shards.length; i++) {
var shard = shards[i];
var series = shard.series;
......@@ -132,13 +133,12 @@ function process_shards(name, shards) {
series.name +
'</a>' +
'</td>' +
'<td id="shard-name-' + series.name + '"></td>' +
'<td id="shard-name-' + series.name + '">fetching...</td>' +
'<td>' + format_date(shard.date) + '</td>' +
'</tr>';
fill_shard_name(series);
}
}
function query_shards(name, timestamp_file) {
......@@ -157,6 +157,7 @@ function query_shards(name, timestamp_file) {
worker.postMessage(this.responseText);
} else {
document.querySelector('#' + name).outerHTML = this.responseText + "<br/>";
document.getElementById(name + "-spinner").outerHTML = "";
}
}
};
......
......@@ -24,7 +24,7 @@ function query_bat_result(series) {
}
}
return {};
throw error;
}
onmessage = function(e) {
......@@ -36,9 +36,13 @@ onmessage = function(e) {
continue;
var series = parse_series_rev(shards[i]);
var result = query_bat_result(series);
try {
var result = query_bat_result(series);
} catch (error) {
// discard if didn't return data
continue;
}
result.series = series;
results.push(result);
}
......
......@@ -4,6 +4,7 @@
This page **does not** refresh automatically.
<div id="message"></div>
<table id="igt" class="queue">
<colgroup>
......@@ -15,6 +16,7 @@ This page **does not** refresh automatically.
<tr><th>#</th><th>id</th><th>name</th><th>time posted</th></tr>
<tr><th colspan="4">IGT BAT Queue <a href="#bat-queues">(?)</a></th></tr>
</table>
<div class="queue-spinner" id="igt-spinner"></div>
<table id="intel-gfx" class="queue">
<colgroup>
......@@ -25,6 +27,7 @@ This page **does not** refresh automatically.
</colgroup>
<tr><th colspan="4">Intel-GFX BAT Queue <a href="#bat-queues">(?)</a></th></tr>
</table>
<div class="queue-spinner" id="intel-gfx-spinner"></div>
<table id="igt-trybot" class="queue">
<colgroup>
......@@ -35,7 +38,7 @@ This page **does not** refresh automatically.
</colgroup>
<tr><th colspan="4">IGT Trybot BAT Queue <a href="#bat-queues">(?)</a></th></tr>
</table>
<div class="queue-spinner" id="igt-trybot-spinner"></div>
<table id="intel-gfx-trybot" class="queue">
<colgroup>
......@@ -46,6 +49,7 @@ This page **does not** refresh automatically.
</colgroup>
<tr><th colspan="4">Kernel Trybot BAT Queue <a href="#bat-queues">(?)</a></th></tr>
</table>
<div class="queue-spinner" id="intel-gfx-trybot-spinner"></div>
<script type="text/javascript" src="/assets/queues.js"></script>
......@@ -68,6 +72,7 @@ This page **does not** refresh automatically.
<tr><th>#</th><th>id</th><th>name</th><th>time queued</th></tr>
<tr><th colspan="4">Shards Queue <a href="#fullshards-queue">(?)</a></th></tr>
</table>
<div class="queue-spinner" id="shards-spinner"></div>
<script type="text/javascript">
query_shards("shards", "/queue/pwqueue.txt");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment