diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2014-12-04 13:58:31 +0100 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2014-12-04 13:58:31 +0100 |
commit | ca754898d30f4b738bfd7524bddd27b5224c2e15 (patch) | |
tree | 723c131449375e14b746089e267bd713f6467753 | |
parent | be48c3fc143bcdf67412474d2874f8f79bd761f4 (diff) |
Refactor library using new base one.
Change-Id: I38ad70356730a23a3501d594a55d1986c6fd2948
-rw-r--r-- | app/dashboard/static/js/linaro-boots-all-1.0.9.js | 73 |
1 files changed, 23 insertions, 50 deletions
diff --git a/app/dashboard/static/js/linaro-boots-all-1.0.9.js b/app/dashboard/static/js/linaro-boots-all-1.0.9.js index 2c6f822..6dda942 100644 --- a/app/dashboard/static/js/linaro-boots-all-1.0.9.js +++ b/app/dashboard/static/js/linaro-boots-all-1.0.9.js @@ -212,56 +212,29 @@ $(document).ready(function() { 'use strict'; $('#li-boot').addClass('active'); - - $('body').tooltip({ - 'selector': '[rel=tooltip]', - 'placement': 'auto' - }); - $('#table-div').hide(); - var ajaxCall = null, - errorReason = ''; - - errorReason = 'Boot data call failed.'; - ajaxCall = $.ajax({ - 'url': '/_ajax/boot', - 'traditional': true, - 'cache': true, - 'dataType': 'json', - 'dataSrc': 'result', - 'data': { - 'sort': 'created_on', - 'sort_order': -1, - 'date_range': $('#date-range').val(), - 'field': [ - '_id', 'job', 'kernel', 'board', 'created_on', - 'status', 'lab_name', 'defconfig_full' - ] - }, - 'beforeSend': function(jqXHR) { - setXhrHeader(jqXHR); - }, - 'timeout': 6000, - 'error': function() { - failedAjaxCall(); - }, - 'statusCode': { - 403: function() { - setErrorAlert('boot-403-error', 403, errorReason); - }, - 404: function() { - setErrorAlert('boot-404-error', 404, errorReason); - }, - 408: function() { - errorReason = 'Boot data call failed: timeout.'; - setErrorAlert('boot-408-error', 408, errorReason); - }, - 500: function() { - setErrorAlert('boot-500-error', 500, errorReason); - } - } - }); - - $.when(ajaxCall).then(createBootsTable, failedAjaxCall); + var deferredAjaxCall = null, + ajaxData = null, + errorReason = 'Boot data call failed'; + + ajaxData = { + 'sort': 'created_on', + 'sort_order': -1, + 'date_range': $('#date-range').val(), + 'field': [ + '_id', 'job', 'kernel', 'board', 'created_on', + 'status', 'lab_name', 'defconfig_full' + ] + }; + deferredAjaxCall = JSBase.createDeferredCall( + '/_ajax/boot', + 'GET', + ajaxData, + null, + failedAjaxCall, + errorReason + ); + + $.when(deferredAjaxCall).then(createBootsTable, failedAjaxCall); }); |