diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2015-02-02 16:40:53 +0100 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2015-02-02 16:40:53 +0100 |
commit | 8d95a4acd0c3c1f7aa9b6a56ec4e5c0240b0499c (patch) | |
tree | 0422be2a4d315e0eafe84f256ac84b1d809618a2 | |
parent | f10efd796b46e8deed4e633a5dbbba03b75d5cc3 (diff) |
Implement JS side of bisect comparison.
Change-Id: Ia55165b86deb8c5aae44baa33963ff76685f69f0
-rw-r--r-- | app/dashboard/static/js/linaro-builds-job-kernel-defconfig-1.0.9.js | 80 |
1 files changed, 73 insertions, 7 deletions
diff --git a/app/dashboard/static/js/linaro-builds-job-kernel-defconfig-1.0.9.js b/app/dashboard/static/js/linaro-builds-job-kernel-defconfig-1.0.9.js index 1f90504..dc99abc 100644 --- a/app/dashboard/static/js/linaro-builds-job-kernel-defconfig-1.0.9.js +++ b/app/dashboard/static/js/linaro-builds-job-kernel-defconfig-1.0.9.js @@ -540,6 +540,71 @@ function createBisectTable(data) { } } +function bisectCompareToAjaxCallFailed() { + 'use strict'; + $('#bisect-compare-loading-div').remove(); + $('#bisect-compare-content') + .removeClass('hidden') + .empty() + .append('<strong>Error loading bisect data from server.</strong>') + .addClass('pull-center'); +} + +function buildBisectComparedToMainline(data) { + 'use strict'; + var bisectData = data.result[0], + bootId, + ajaxDeferredCall, + bisectElements = null, + defconfigVal = null, + errorFunc, + errorReason = 'Error loading bisect data compared to mainline'; + + if (bisectData.job !== 'mainline') { + defconfigVal = bisectData.defconfig_id.$oid; + + bisectElements = { + tableDivID: '#table-compare-div', + tableID: '#bisect-compare-table', + tableBodyID: '#bisect-compare-table-body', + contentDivID: '#bisect-compare-content', + loadingDivID: '#bisect-compare-loading-div', + loadingContentID: '#bisect-compare-loading-content', + loadingContentText: 'loading bisect data…', + badCommitID: null, + goodCommitID: null, + bisectScriptContainerID: '#dl-bisect-compare-script', + bisectScriptContentID: '#bisect-compare-script', + bisectCompareDescriptionID: '#bisect-compare-description', + prevBisect: bisectData + }; + + JSBase.removeCssClassForID('#bisect-compare-div', 'hidden'); + + ajaxDeferredCall = JSBase.createDeferredCall( + '/_ajax/bisect?collection=defconfig&compare_to=mainline&' + + 'defconfig_id=' + defconfigVal, + 'GET', + null, + null, + bisectCompareToAjaxCallFailed, + errorReason, + null, + 'bisect-call-compare-to' + ); + + $.when(ajaxDeferredCall).done(function(data) { + Bisect.fillBisectTable( + data, + bisectElements, + true + ); + }); + } else { + JSBase.removeElementByID('#bisect-compare-div'); + } +} + function getBisectData(data) { 'use strict'; var status = data.status, @@ -580,13 +645,14 @@ function getBisectData(data) { prevBisect: null }; - // $.when(deferredAjaxCall).done(createBisectTable); - $.when(deferredAjaxCall).done(function(data) { - Bisect.fillBisectTable( - data, - bisectElements, - false - ); + $.when(deferredAjaxCall) + .done(buildBisectComparedToMainline) + .done(function(data) { + Bisect.fillBisectTable( + data, + bisectElements, + false + ); }); } else { $('#bisect-div').remove(); |