diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2014-12-04 16:27:38 +0100 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2014-12-04 16:27:38 +0100 |
commit | 742aabacf5efbedffaca231d77c701d2145678fb (patch) | |
tree | 7bf3ab5184bb87c15b856e844573393334a95bd0 | |
parent | 58a52795199ba5ff0934112b27b655f9ae9fef9e (diff) |
Refactor using new base lib.
Change-Id: Ib953901de9d440d0ad3a7d59e029bd14d2b67196
-rw-r--r-- | app/dashboard/static/js/linaro-builds-job-kernel-1.0.6.js | 64 |
1 files changed, 18 insertions, 46 deletions
diff --git a/app/dashboard/static/js/linaro-builds-job-kernel-1.0.6.js b/app/dashboard/static/js/linaro-builds-job-kernel-1.0.6.js index 6e1f0a0..55ca3e2 100644 --- a/app/dashboard/static/js/linaro-builds-job-kernel-1.0.6.js +++ b/app/dashboard/static/js/linaro-builds-job-kernel-1.0.6.js @@ -335,55 +335,27 @@ function parseData(data) { $(document).ready(function() { 'use strict'; - $('body').tooltip({ - 'selector': '[rel=tooltip]', - 'placement': 'auto top' - }); - $('#li-build').addClass('active'); - $('.btn-group > .btn').click(function() { - $(this).addClass('active').siblings().removeClass('active'); - }); - - var deferredCall, - errorReason; - - errorReason = 'Defconfig data call failed.'; - deferredCall = $.ajax({ - 'url': '/_ajax/defconf', - 'traditional': true, - 'cache': true, - 'dataType': 'json', - 'data': { - 'job_id': jobId, - 'sort': ['status', '_id'], - 'sort_order': 1 - }, - 'beforeSend': function(jqXHR) { - setXhrHeader(jqXHR); - }, - 'error': function() { - ajaxCallFailed(); - }, - 'statusCode': { - 403: function() { - setErrorAlert('defconfs-403-error', 403, errorReason); - }, - 404: function() { - setErrorAlert('defconfs-404-error', 404, errorReason); - }, - 408: function() { - errorReason = 'Defconfig data call failed: timeout.'; - setErrorAlert('defconfs-408-error', 408, errorReason); - }, - 500: function() { - setErrorAlert('defconfs-500-error', 500, errorReason); - } - } - }); + var ajaxDeferredCall = null, + ajaxData = null, + errorReason = 'Defconfig data call failed'; + + ajaxData = { + 'job_id': jobId, + 'sort': ['status', '_id'], + 'sort_order': 1 + }; + ajaxDeferredCall = JSBase.createDeferredCall( + '/_ajax/defconf', + 'GET', + ajaxData, + null, + ajaxCallFailed, + errorReason + ); - $.when(deferredCall).then(parseData, ajaxCallFailed); + $.when(ajaxDeferredCall).done(parseData); }); |