aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Casagrande <milo.casagrande@linaro.org>2014-12-04 13:50:25 +0100
committerMilo Casagrande <milo.casagrande@linaro.org>2014-12-04 13:50:25 +0100
commit7007b180ebba0a68cc1304e53c44e8e9737840b9 (patch)
treed8e2a5785d3885340a0031d5a3ad81a853cbd0f6
parent111054d8fdc6b193f030323dbe0aad5b5da6cd97 (diff)
Refactor library using new base JS one.
Change-Id: Ib49b6aeec3db7d2efde9baf1b13646f2679d9d09
-rw-r--r--app/dashboard/static/js/linaro-index-1.3.0.js802
1 files changed, 355 insertions, 447 deletions
diff --git a/app/dashboard/static/js/linaro-index-1.3.0.js b/app/dashboard/static/js/linaro-index-1.3.0.js
index 5f3ca4c..26a1563 100644
--- a/app/dashboard/static/js/linaro-index-1.3.0.js
+++ b/app/dashboard/static/js/linaro-index-1.3.0.js
@@ -1,488 +1,396 @@
-function emptyTableOnError(tableId, colspan) {
+function tableErrorDefconfigFunction() {
'use strict';
- var localId = tableId;
- if (tableId[0] !== '#') {
- localId = '#' + tableId;
- }
-
- $(localId).empty().append(
- '<tr><td colspan="' + colspan +
- '" align="center" valign="middle">' +
- '<h4>Error loading data.</h4></td></tr>'
- );
+ var staticContent = '<tr>' +
+ '<td colspan="5" align="center" valign="middle">' +
+ '<h4>Error loading data.</h4></td></tr>';
+ JSBase.replaceContentByID('#failed-builds-body', staticContent);
}
-$(document).ready(function() {
+function tableErrorJobFunction() {
'use strict';
- $('#li-home').addClass('active');
- $('body').tooltip({
- 'selector': '[rel=tooltip]',
- 'placement': 'auto'
- });
-
- $('.clickable-table tbody').on('click', 'tr', function() {
- var url = $(this).data('url');
- if (url) {
- window.location = url;
- }
- });
-});
+ var staticContent = '<tr>' +
+ '<td colspan="3" align="center" valign="middle">' +
+ '<h4>Error loading data.</h4></td></tr>';
+ JSBase.replaceContentByID('#failed-jobs-body', staticContent);
+}
-$(document).ready(function() {
+function tableErrorBootFunction() {
'use strict';
- var errorReason = '',
- ajaxDeferredCall = null;
+ var staticContent = '<tr>' +
+ '<td colspan="8" align="center" valign="middle">' +
+ '<h4>Error loading data.</h4></td></tr>';
+ JSBase.replaceContentByID('#failed-boots-body', staticContent);
+}
- function countFailCallback() {
- $('.fail-badge').each(function() {
- $(this).empty().append('&infin;');
- });
- }
+// Just a wrapper around the real function.
+// Used for being passed to the deferred creation.
+function countErrorFunction() {
+ 'use strict';
+ JSBase.replaceContentByClass('.fail-badge', '&infin;');
+}
- function countDoneCallback(data) {
- var localData = data.result,
- len = localData.length,
- i = 0,
- batchResult = null;
+// Function to be called after countig all the failed defconfigs.
+function countDoneCallback(data) {
+ 'use strict';
- if (len > 0) {
- if (len === 1) {
- $('#fail-count0').empty().append(localData[0].count);
- } else {
- for (i; i < len; i++) {
- batchResult = localData[i].result[0];
- $(localData[i].operation_id).empty().append(
- batchResult.count
- );
- }
- }
- } else {
- countFailCallback();
- }
- }
+ var localData = data.result,
+ len = localData.length,
+ i = 0,
+ batchResult = null;
- function countFailedDefconfigs(data) {
- var localData = data.result,
- i = 0,
- len = localData.length,
- deferredCall = null,
- batchQueries = new Array(len);
-
- if (len > 0) {
- if (len === 1) {
- errorReason = 'Defconfig data call failed.';
- // Peform normal GET.
- deferredCall = $.ajax({
- 'url': '/_ajax/count/defconfig',
- 'traditional': true,
- 'cache': true,
- 'dataType': 'json',
- 'data': {
- 'status': 'FAIL',
- 'job': localData[0].job,
- 'kernel': localData[0].kernel
- },
- 'beforeSend': function(jqXHR) {
- setXhrHeader(jqXHR);
- },
- 'error': function() {
- countFailCallback();
- },
- 'timeout': 6000,
- 'statusCode': {
- 403: function() {
- setErrorAlert('batch-403-error', 403, errorReason);
- },
- 404: function() {
- setErrorAlert('batch-404-error', 404, errorReason);
- },
- 408: function() {
- errorReason = 'Defconfing data call failed: ' +
- 'timeout.';
- setErrorAlert('batch-408-error', 408, errorReason);
- },
- 500: function() {
- setErrorAlert('batch-500-error', 500, errorReason);
- }
- }
- });
- } else {
- // Perform POST on batch API.
- for (i; i < len; i++) {
- batchQueries[i] = {
- 'method': 'GET',
- 'operation_id': '#fail-count' + i,
- 'collection': 'count',
- 'document_id': 'defconfig',
- 'query': 'status=FAIL&job=' + localData[i].job +
- '&kernel=' + localData[i].kernel
- };
- }
-
- errorReason = 'Batch count failed.';
- deferredCall = $.ajax({
- 'url': '/_ajax/batch',
- 'type': 'POST',
- 'traditional': true,
- 'dataType': 'json',
- 'headers': {
- 'Content-Type': 'application/json'
- },
- 'beforeSend': function(jqXHR) {
- setXhrHeader(jqXHR);
- },
- 'data': JSON.stringify({
- 'batch': batchQueries
- }),
- 'error': function() {
- countFailCallback();
- },
- 'timeout': 10000,
- 'statusCode': {
- 403: function() {
- setErrorAlert('batch-403-error', 403, errorReason);
- },
- 404: function() {
- setErrorAlert('batch-404-error', 404, errorReason);
- },
- 408: function() {
- errorReason = 'Batch count failed: timeout.';
- setErrorAlert('batch-408-error', 408, errorReason);
- },
- 500: function() {
- setErrorAlert('batch-500-error', 500, errorReason);
- }
- }
- });
+ if (len > 0) {
+ if (len === 1) {
+ $('#fail-count0').empty().append(localData[0].count);
+ } else {
+ for (i; i < len; i++) {
+ batchResult = localData[i].result[0];
+ $(localData[i].operation_id).empty().append(
+ batchResult.count
+ );
}
-
- $.when(deferredCall).then(countDoneCallback, countFailCallback);
}
+ } else {
+ countErrorFunction();
}
+}
- function populateFailedDefconfigTable(data) {
- var localData = data.result,
- row = '',
- job,
- created,
- col1,
- col2,
- col3,
- col4,
- col5,
- href,
- kernel,
- gitBranch,
- i = 0,
- len = localData.length;
-
- if (len === 0) {
- row = '<tr><td colspan="5" align="center" valign="middle"><h4>' +
- 'No failed builds.</h4></td></tr>';
- $('#failed-builds-body').empty().append(row);
+// Count all the failed defconfigs we have in the page.
+function countFailedDefconfigs(data) {
+ var localData = data.result,
+ i = 0,
+ len = localData.length,
+ deferredCall = null,
+ errorReason = '',
+ ajaxDeferredCall = null,
+ ajaxData = null,
+ batchQueries = new Array(len);
+
+ if (len > 0) {
+ if (len === 1) {
+ // Perform a normal GET.
+ errorReason = 'Defconfig data call failed';
+ ajaxData = {
+ 'status': 'FAIL',
+ 'job': localData[0].job,
+ 'kernel': localData[0].kernel
+ };
+ ajaxDeferredCall = JSBase.createDeferredCall(
+ '/_ajax/count/defconfig',
+ 'GET',
+ ajaxData,
+ null,
+ countErrorFunction,
+ errorReason
+ );
} else {
+ // Perform POST on batch API.
for (i; i < len; i++) {
- job = localData[i].job;
- kernel = localData[i].kernel;
- gitBranch = localData[i].git_branch;
- created = new Date(localData[i].created_on.$date);
- href = '/build/' + job + '/kernel/' + kernel + '/';
-
- col1 = '<td><a class="table-link" href="/job/' + job +
- '/">' + job + '&nbsp;&dash;&nbsp;<small>' +
- gitBranch + '</small></td>';
- col2 = '<td>' + kernel + '</a></td>';
- col3 = '<td class="pull-center">' +
- '<span class="badge alert-danger">' +
- '<span id="fail-count' + i + '" ' +
- 'class="fail-badge">' +
- '<i class="fa fa-cog fa-spin"></i></span></span>' +
- '</td>';
- col4 = '<td class="pull-center">' +
- created.getCustomISODate() + '</td>';
- col5 = '<td class="pull-center">' +
- '<span rel="tooltip" data-toggle="tooltip" ' +
- 'title="Details for job&nbsp;' + job +
- '&nbsp;&dash;&nbsp;' + kernel + '">' +
- '<a href="' + href + '">' +
- '<i class="fa fa-search"></i></a>' +
- '</span></td>';
- row += '<tr data-url="' + href + '">' +
- col1 + col2 + col3 + col4 + col5 + '</tr>';
+ batchQueries[i] = {
+ 'method': 'GET',
+ 'operation_id': '#fail-count' + i,
+ 'collection': 'count',
+ 'document_id': 'defconfig',
+ 'query': 'status=FAIL&job=' + localData[i].job +
+ '&kernel=' + localData[i].kernel
+ };
}
- $('#failed-builds-body').empty().append(row);
+ errorReason = 'Batch count failed';
+ ajaxData = JSON.stringify({
+ 'batch': batchQueries
+ });
+ ajaxDeferredCall = JSBase.createDeferredCall(
+ '/_ajax/batch',
+ 'POST',
+ ajaxData,
+ null,
+ countErrorFunction,
+ errorReason,
+ {'Content-Type': 'application/json'}
+ );
}
+
+ $.when(ajaxDeferredCall).done(countDoneCallback);
}
+}
- errorReason = 'Defconfig data call failed.';
- ajaxDeferredCall = $.ajax({
- 'url': '/_ajax/defconf',
- 'traditional': true,
- 'cache': true,
- 'dataType': 'json',
- 'data': {
- 'aggregate': 'kernel',
- 'status': 'FAIL',
- 'sort': 'created_on',
- 'sort_order': -1,
- 'limit': 25,
- 'date_range': $('#date-range').val(),
- 'field': ['job', 'kernel', 'created_on', 'git_branch']
- },
- 'beforeSend': function(jqXHR) {
- setXhrHeader(jqXHR);
- },
- 'error': function() {
- emptyTableOnError('#failed-builds-body', 5);
- },
- 'timeout': 6000,
- 'statusCode': {
- 403: function() {
- setErrorAlert('defconfs-403-error', 403, errorReason);
- },
- 404: function() {
- setErrorAlert('defconfs-404-error', 404, errorReason);
- },
- 408: function() {
- errorReason = 'Defconfing data call failed: timeout.';
- setErrorAlert('defconfs-408-error', 408, errorReason);
- },
- 500: function() {
- setErrorAlert('defconfs-500-error', 500, errorReason);
- }
+// Populate the defconfigs table.
+function populateDefconfigsTable(data) {
+ 'use strict';
+
+ var localData = data.result,
+ row = '',
+ job,
+ created,
+ col1,
+ col2,
+ col3,
+ col4,
+ col5,
+ href,
+ kernel,
+ gitBranch,
+ failedDefconf,
+ i = 0,
+ len = localData.length;
+
+ if (len === 0) {
+ row = '<tr><td colspan="5" align="center" valign="middle">' +
+ '<h4>No failed builds.</h4></td></tr>';
+ $('#failed-builds-body').empty().append(row);
+ } else {
+ for (i; i < len; i++) {
+ failedDefconf = localData[i];
+ job = failedDefconf.job;
+ kernel = failedDefconf.kernel;
+ gitBranch = failedDefconf.git_branch;
+ created = new Date(failedDefconf.created_on.$date);
+ href = '/build/' + job + '/kernel/' + kernel + '/';
+
+ col1 = '<td><a class="table-link" href="/job/' + job +
+ '/">' + job + '&nbsp;&dash;&nbsp;<small>' +
+ gitBranch + '</small></td>';
+ col2 = '<td>' + kernel + '</a></td>';
+ col3 = '<td class="pull-center">' +
+ '<span class="badge alert-danger">' +
+ '<span id="fail-count' + i + '" ' +
+ 'class="fail-badge">' +
+ '<i class="fa fa-cog fa-spin"></i></span></span>' +
+ '</td>';
+ col4 = '<td class="pull-center">' +
+ created.getCustomISODate() + '</td>';
+ col5 = '<td class="pull-center">' +
+ '<span rel="tooltip" data-toggle="tooltip" ' +
+ 'title="Details for job&nbsp;' + job +
+ '&nbsp;&dash;&nbsp;' + kernel + '">' +
+ '<a href="' + href + '">' +
+ '<i class="fa fa-search"></i></a>' +
+ '</span></td>';
+ row += '<tr data-url="' + href + '">' +
+ col1 + col2 + col3 + col4 + col5 + '</tr>';
}
- }).done(populateFailedDefconfigTable);
- $.when(ajaxDeferredCall).then(countFailedDefconfigs, countFailCallback);
-});
+ $('#failed-builds-body').empty().append(row);
+ }
+}
-$(document).ready(function() {
+function populateJobsTalbe(data) {
'use strict';
- var errorReason = 'Job data call failed.',
- ajaxCall;
-
- function populateJobsTalbe(data) {
- var localData = data.result,
- row = '',
- created,
- col1,
- col2,
- col3,
- href,
- job,
- gitBranch,
- i = 0,
- len = localData.length;
-
- if (len === 0) {
- row = '<tr><td colspan="4" align="center" valign="middle"><h4>' +
- 'No failed jobs.</h4></td></tr>';
- $('#failed-jobs-body').empty().append(row);
- } else {
- for (i; i < len; i++) {
- created = new Date(localData[i].created_on.$date);
- job = localData[i].job;
- gitBranch = localData[i].git_branch;
- href = '/job/' + job + '/';
-
- col1 = '<td><a class="table-link" href="' + href + '">' +
- job + '&nbsp;&dash;&nbsp;<small>' +
- gitBranch + '</small>' + '</a></td>';
- col2 = '<td class="pull-center">' +
- created.getCustomISODate() + '</td>';
- col3 = '<td class="pull-center">' +
- '<span rel="tooltip" data-toggle="tooltip" ' +
- 'title="Details for job&nbsp;' + job + '">' +
- '<a href="' + href + '">' +
- '<i class="fa fa-search"></i></a>' +
- '</span></td>';
- row = '<tr data-url="' + href + '">' +
- col1 + col2 + col3 + '</tr>';
- }
-
- $('#failed-jobs-body').empty().append(row);
+ var localData = data.result,
+ row = '',
+ created,
+ col1,
+ col2,
+ col3,
+ href,
+ job,
+ gitBranch,
+ failedJob,
+ i = 0,
+ len = localData.length;
+
+ if (len === 0) {
+ row = '<tr><td colspan="4" align="center" valign="middle"><h4>' +
+ 'No failed jobs.</h4></td></tr>';
+ $('#failed-jobs-body').empty().append(row);
+ } else {
+ for (i; i < len; i++) {
+ failedJob = localData[i];
+ created = new Date(failedJob.created_on.$date);
+ job = failedJob.job;
+ gitBranch = failedJob.git_branch;
+ href = '/job/' + job + '/';
+
+ col1 = '<td><a class="table-link" href="' + href + '">' +
+ job + '&nbsp;&dash;&nbsp;<small>' +
+ gitBranch + '</small>' + '</a></td>';
+ col2 = '<td class="pull-center">' +
+ created.getCustomISODate() + '</td>';
+ col3 = '<td class="pull-center">' +
+ '<span rel="tooltip" data-toggle="tooltip" ' +
+ 'title="Details for job&nbsp;' + job + '">' +
+ '<a href="' + href + '">' +
+ '<i class="fa fa-search"></i></a>' +
+ '</span></td>';
+ row = '<tr data-url="' + href + '">' +
+ col1 + col2 + col3 + '</tr>';
}
+
+ $('#failed-jobs-body').empty().append(row);
}
+}
+
+function populateBootsTable(data) {
+ var localData = data.result,
+ row = '',
+ created,
+ board,
+ job,
+ kernel,
+ defconfig,
+ defconfigFull,
+ labName,
+ bootId,
+ col1,
+ col2,
+ col3,
+ col4,
+ col5,
+ col6,
+ col7,
+ col8,
+ href,
+ len = localData.length,
+ col6Content,
+ failureReason = null,
+ failedBoot,
+ i = 0;
+
+ if (len === 0) {
+ row = '<tr><td colspan="8" align="center" valign="middle"><h4>' +
+ 'No failed boot reports.</h4></td></tr>';
+ $('#failed-boots-body').empty().append(row);
+ } else {
+ for (i; i < len; i++) {
+ failedBoot = localData[i];
+ failureReason = failedBoot.boot_result_description;
+ if (failureReason === null) {
+ col6Content = '<td class="pull-center">' +
+ '<span rel="tooltip" data-toggle="tooltip"' +
+ 'title="Failure reason unknown">' +
+ '<i class="fa fa-question-circle"></i>' +
+ '</span></td>';
+ } else {
+ col6Content = '<td class="pull-center">' +
+ '<span rel="tooltip" data-toggle="tooltip"' +
+ 'title="' + failureReason + '">' +
+ '<i class="fa fa-exclamation-triangle red-font">' +
+ '</i></span></td>';
+ }
- ajaxCall = $.ajax({
- 'url': '/_ajax/job',
- 'dataType': 'json',
- 'traditional': true,
- 'cache': true,
- 'data': {
- 'status': 'FAIL',
- 'sort': 'created_on',
- 'sort_order': -1,
- 'limit': 25,
- 'date_range': $('#date-range').val(),
- 'field': ['job', 'git_branch', 'created_on']
- },
- 'beforeSend': function(jqXHR) {
- setXhrHeader(jqXHR);
- },
- 'error': function(jqXHR, textStatus, errorThrown) {
- emptyTableOnError('#failed-jobs-body', 3);
- },
- 'timeout': 6000,
- 'statusCode': {
- 403: function() {
- setErrorAlert('jobs-403-error', 403, errorReason);
- },
- 404: function() {
- setErrorAlert('jobs-404-error', 404, errorReason);
- },
- 408: function() {
- errorReason = 'Job data call failed: timeout.';
- setErrorAlert('jobs-408-error', 408, errorReason);
- },
- 500: function() {
- setErrorAlert('jobs-500-error', 500, errorReason);
+ created = new Date(failedBoot.created_on.$date);
+ job = failedBoot.job;
+ kernel = failedBoot.kernel;
+ board = failedBoot.board;
+ defconfig = failedBoot.defconfig;
+ defconfigFull = failedBoot.defconfig_full;
+ labName = failedBoot.lab_name;
+ bootId = failedBoot._id;
+ href = '/boot/' + board + '/job/' + job + '/kernel/' +
+ kernel + '/defconfig/' + defconfigFull +
+ '/lab/' + labName +
+ '/?_id=' + bootId.$oid;
+
+ if (defconfigFull.length > 33) {
+ defconfigFull = '<span rel="tooltip" ' +
+ 'data-toggle="tooltip" ' +
+ 'title="' + defconfigFull + '">' +
+ defconfigFull.slice(0, 33) + '&hellip;</span>';
}
+
+ col1 = '<td><a class="table-link" href="/job/' + job + '/">' +
+ job + '</a></td>';
+ col2 = '<td>' + kernel + '</td>';
+ col3 = '<td>' + board + '</td>';
+ col4 = '<td>' + defconfigFull + '</td>';
+ col5 = '<td><small>' + labName + '</small></td>';
+ col6 = col6Content;
+ col7 = '<td class="pull-center">' +
+ created.getCustomISODate() + '</td>';
+ col8 = '<td class="pull-center">' +
+ '<span rel="tooltip" data-toggle="tooltip" ' +
+ 'title="Details for board&nbsp;' + board + '">' +
+ '<a href="' + href + '">' +
+ '<i class="fa fa-search"></i></a>' +
+ '</span></td>';
+ row += '<tr data-url="' + href + '">' +
+ col1 + col2 + col3 + col4 + col5 + col6 + col7 + col8 +
+ '</tr>';
}
- });
- $.when(ajaxCall).then(populateJobsTalbe);
-});
+ $('#failed-boots-body').empty().append(row);
+ }
+}
$(document).ready(function() {
'use strict';
- var errorReason = 'Boot data call failed.',
- colSpan = 8;
-
- $.ajax({
- 'url': '/_ajax/boot',
- 'traditional': true,
- 'cache': true,
- 'dataType': 'json',
- 'context': $('#failed-boots-body'),
- 'data': {
- 'status': 'FAIL',
- 'sort_order': -1,
- 'sort': 'created_on',
- 'limit': 25,
- 'date_range': $('#date-range').val(),
- 'field': [
- 'board', 'job', 'kernel', 'defconfig', 'created_on',
- 'boot_result_description', 'lab_name', '_id',
- 'defconfig_full'
- ]
- },
- 'beforeSend': function(jqXHR) {
- setXhrHeader(jqXHR);
- },
- 'error': function() {
- emptyTableOnError('#failed-boots-body', colSpan);
- },
- 'timeout': 6000,
- 'statusCode': {
- 403: function() {
- setErrorAlert('boots-403-error', 403, errorReason);
- },
- 404: function() {
- setErrorAlert('boots-404-error', 404, errorReason);
- },
- 408: function() {
- errorReason = 'Boot data call failed: timeout.';
- setErrorAlert('boots-408-error', 408, errorReason);
- },
- 500: function() {
- setErrorAlert('boots-500-error', 500, errorReason);
- }
- }
- }).done(function(data) {
- var localData = data.result,
- row = '',
- created,
- board,
- job,
- kernel,
- defconfig,
- defconfigFull,
- labName,
- bootId,
- col1,
- col2,
- col3,
- col4,
- col5,
- col6,
- col7,
- col8,
- href,
- len = localData.length,
- col6Content,
- failureReason = null,
- i = 0;
-
- if (len === 0) {
- row = '<tr><td colspan="' + colSpan +
- '" align="center" valign="middle"><h4>' +
- 'No failed boot reports.</h4></td></tr>';
- $(this).empty().append(row);
- } else {
- for (i; i < len; i++) {
- failureReason = localData[i].boot_result_description;
- if (failureReason === null) {
- col6Content = '<td class="pull-center">' +
- '<span rel="tooltip" data-toggle="tooltip"' +
- 'title="Failure reason unknown">' +
- '<i class="fa fa-question-circle"></i>' +
- '</span></td>';
- } else {
- col6Content = '<td class="pull-center">' +
- '<span rel="tooltip" data-toggle="tooltip"' +
- 'title="' + failureReason + '">' +
- '<i class="fa fa-exclamation-triangle red-font">' +
- '</i></span></td>';
- }
-
- created = new Date(localData[i].created_on.$date);
- job = localData[i].job;
- kernel = localData[i].kernel;
- board = localData[i].board;
- defconfig = localData[i].defconfig;
- defconfigFull = localData[i].defconfig_full;
- labName = localData[i].lab_name;
- bootId = localData[i]._id;
- href = '/boot/' + board + '/job/' + job + '/kernel/' +
- kernel + '/defconfig/' + defconfigFull +
- '/lab/' + labName +
- '/?_id=' + bootId.$oid;
-
- if (defconfigFull.length > 33) {
- defconfigFull = '<span rel="tooltip" ' +
- 'data-toggle="tooltip" ' +
- 'title="' + defconfigFull + '">' +
- defconfigFull.slice(0, 33) + '&hellip;</span>';
- }
-
- col1 = '<td><a class="table-link" href="/job/' + job + '/">' +
- job + '</a></td>';
- col2 = '<td>' + kernel + '</td>';
- col3 = '<td>' + board + '</td>';
- col4 = '<td>' + defconfigFull + '</td>';
- col5 = '<td><small>' + labName + '</small></td>';
- col6 = col6Content;
- col7 = '<td class="pull-center">' +
- created.getCustomISODate() + '</td>';
- col8 = '<td class="pull-center">' +
- '<span rel="tooltip" data-toggle="tooltip" ' +
- 'title="Details for board&nbsp;' + board + '">' +
- '<a href="' + href + '">' +
- '<i class="fa fa-search"></i></a>' +
- '</span></td>';
- row += '<tr data-url="' + href + '">' +
- col1 + col2 + col3 + col4 + col5 + col6 + col7 + col8 +
- '</tr>';
- }
+ $('#li-home').addClass('active');
- $(this).empty().append(row);
- }
- });
+ var errorReason = '',
+ ajaxDeferredCall = null,
+ ajaxData = null,
+ dateRange = $('#date-range').val();
+
+ // Get failed defconfigs.
+ errorReason = 'Defconfig data call failed';
+ ajaxData = {
+ 'aggregate': 'kernel',
+ 'status': 'FAIL',
+ 'sort': 'created_on',
+ 'sort_order': -1,
+ 'limit': 25,
+ 'date_range': dateRange,
+ 'field': ['job', 'kernel', 'created_on', 'git_branch']
+ };
+ ajaxDeferredCall = JSBase.createDeferredCall(
+ '/_ajax/defconf',
+ 'GET',
+ ajaxData,
+ populateDefconfigsTable,
+ tableErrorDefconfigFunction,
+ errorReason);
+
+ $.when(ajaxDeferredCall)
+ .then(countFailedDefconfigs, countErrorFunction);
+
+ // Get failed boot reports.
+ errorReason = 'Boot data call failed';
+ ajaxData = {
+ 'status': 'FAIL',
+ 'sort_order': -1,
+ 'sort': 'created_on',
+ 'limit': 25,
+ 'date_range': dateRange,
+ 'field': [
+ 'board', 'job', 'kernel', 'defconfig', 'created_on',
+ 'boot_result_description', 'lab_name', '_id',
+ 'defconfig_full'
+ ]
+ };
+ ajaxDeferredCall = JSBase.createDeferredCall(
+ '/_ajax/boot',
+ 'GET',
+ ajaxData,
+ null,
+ tableErrorBootFunction,
+ errorReason
+ );
+
+ $.when(ajaxDeferredCall).done(populateBootsTable);
+
+ // Get failed jobs.
+ errorReason = 'Job data call failed';
+ ajaxData = {
+ 'status': 'FAIL',
+ 'sort': 'created_on',
+ 'sort_order': -1,
+ 'limit': 25,
+ 'date_range': dateRange,
+ 'field': ['job', 'git_branch', 'created_on']
+ };
+ ajaxDeferredCall = JSBase.createDeferredCall(
+ '/_ajax/job',
+ 'GET',
+ ajaxData,
+ null,
+ tableErrorJobFunction,
+ errorReason
+ );
+
+ $.when(ajaxDeferredCall).done(populateJobsTalbe);
});