From 6fb991275600c3dbc335c835122e69d7463f191d Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Fri, 24 Oct 2014 18:49:07 +0200 Subject: js: Bump library version number. Change-Id: Ibc039d248e24583af9860ead75152d10e1f705a0 --- app/dashboard/static/js/linaro-boots-id-1.0.7.js | 391 ----------------------- app/dashboard/static/js/linaro-boots-id-1.0.8.js | 391 +++++++++++++++++++++++ app/dashboard/templates/boots-id.html | 2 +- 3 files changed, 392 insertions(+), 392 deletions(-) delete mode 100644 app/dashboard/static/js/linaro-boots-id-1.0.7.js create mode 100644 app/dashboard/static/js/linaro-boots-id-1.0.8.js diff --git a/app/dashboard/static/js/linaro-boots-id-1.0.7.js b/app/dashboard/static/js/linaro-boots-id-1.0.7.js deleted file mode 100644 index 683085d..0000000 --- a/app/dashboard/static/js/linaro-boots-id-1.0.7.js +++ /dev/null @@ -1,391 +0,0 @@ -var boardId = $('#board-id').val(); -var jobId = $('#job-id').val(); -var kernelId = $('#kernel-id').val(); -var defconfId = $('#defconfig-id').val(); - -function populatePage(data) { - 'use strict'; - - var localData = data.result[0], - bootTime, - displ = '', - fileServer = $('#file-server').val(), - metadata, - nonAvail = '' + - ''; - - bootTime = new Date(localData.time['$date']); - metadata = localData.metadata; - - $('#dd-board-board').empty().append(localData.board); - $('#dd-board-defconfig').empty().append( - localData.defconfig + ' — ' + - '' - ); - $('#dd-board-kernel').empty().append( - '' + localData.kernel + - '' + - ' — ' + - '' - ); - $('#dd-board-tree').empty().append( - '' + - '' + localData.job + - '' + - ' — ' + - '' - ); - - if (localData.endian !== null) { - $('#dd-board-endianness').empty().append(localData.endian); - } else { - $('#dd-board-endianness').empty().append(nonAvail); - } - - if (localData.boot_log !== null || localData.boot_log_html !== null) { - $('#dd-board-boot-log').empty(); - - if (localData.boot_log !== null) { - $('#dd-board-boot-log').append( - 'txt' + - ' ' - ); - } - - if (localData.boot_log_html !== null) { - if (localData.boot_log !== null) { - $('#dd-board-boot-log').append(' — '); - } - $('#dd-board-boot-log').append( - 'html ' - ); - } - } else { - $('#dd-board-boot-log').empty().append(nonAvail); - } - - switch (localData.status) { - case 'PASS': - displ = ''; - break; - case 'FAIL': - displ = '' + - ''; - break; - case 'OFFLINE': - displ = '' + - ''; - break; - default: - displ = '' + - ''; - break; - } - - // Do we have a description for the boot result? - // We might have it directly in the json or in the metadata property. - if (localData.hasOwnProperty('boot_result_description')) { - displ += ' ' + localData.boot_result_description + - ''; - } else if (! $.isEmptyObject(metadata) && - metadata.hasOwnProperty('boot_result_description')) { - displ += ' ' + metadata.boot_result_description + - ''; - } - - $('#dd-board-status').empty().append(displ); - $('#dd-board-boot-time').empty().append(bootTime.getCustomTime()); - - if (localData.warnings !== null) { - $('#dd-board-warnings').empty().append(localData.warnings); - } else { - $('#dd-board-warnings').empty().append(0); - } - - if (localData.dtb !== null && localData.dtb !== '') { - $('#dd-board-dtb').empty().append(localData.dtb); - } else { - $('#dd-board-dtb').empty().append(nonAvail); - } - - if (localData.dtb_addr !== null && localData.dtb_addr !== '') { - $('#dd-board-dtb-address').empty().append(localData.dtb_addr); - } else { - $('#dd-board-dtb-address').empty().append(nonAvail); - } - - if (localData.initrd_addr !== null && localData.initrd_addr !== '') { - $('#dd-board-initrd-address').empty().append(localData.initrd_addr); - } else { - $('#dd-board-initrd-address').empty().append(nonAvail); - } - - if (localData.load_addr !== null && localData.load_addr !== '') { - $('#dd-board-load-address').empty().append(localData.load_addr); - } else { - $('#dd-board-load-address').empty().append(nonAvail); - } - - if (localData.kernel_image !== null && localData.kernel_image !== '') { - $('#dd-board-kernel-image').empty().append(localData.kernel_image); - } else { - $('#dd-board-kernel-image').empty().append(nonAvail); - } -} - -function createBisectScriptURI(badCommit, goodCommit) { - 'use strict'; - var bisectScript = '#!/bin/bash\n' + - 'git bisect start ' + badCommit + goodCommit + '\n'; - - return 'data:text/plain;charset=UTF-8,' + encodeURIComponent(bisectScript); -} - -function createBootBisectTable(data) { - 'use strict'; - $('#loading-content').empty().append("loading bisect data…"); - - var localData = data.result, - localLen = localData.length, - i = 0, - bisectData, - gitDescribeCell, - badCommitCell, - unknownCommitCell, - goodCommitCell, - bootStatus, - bisectDefMetadata, - tableRows, - tooltipLink, - tooltipTitle, - gitURLs, - gitDescribeVal, - badCommit = null, - goodCommit = null; - - badCommit = localData[0].defconfig_metadata.git_commit; - - for (i; i < localLen; i++) { - bisectData = localData[i]; - bootStatus = bisectData.boot_status; - bisectDefMetadata = bisectData.defconfig_metadata; - gitDescribeVal = bisectDefMetadata.git_describe; - - tooltipLink = '' + - gitDescribeVal + ''; - - tooltipTitle = 'Boot report details for ' + jobId + - ' ‐ ' + gitDescribeVal; - - gitDescribeCell = '' + - '' + - '' + tooltipLink + - ''; - - gitURLs = translateCommitURL( - bisectDefMetadata.git_url, bisectDefMetadata.git_commit); - - switch (bootStatus) { - case 'PASS': - goodCommit = bisectDefMetadata.git_commit; - goodCommitCell = '' + bisectDefMetadata.git_commit + - ' '; - badCommitCell = ''; - unknownCommitCell = ''; - break; - case 'FAIL': - goodCommitCell = ''; - badCommitCell = '' + bisectDefMetadata.git_commit + - ' '; - unknownCommitCell = ''; - break; - default: - goodCommitCell = ''; - badCommitCell = ''; - unknownCommitCell = '' + bisectDefMetadata.git_commit + - ' '; - break; - } - - tableRows += '' + gitDescribeCell + badCommitCell + - unknownCommitCell + goodCommitCell + ''; - } - - $('#loading-div').remove(); - $('#bad-commit').empty().append( - '' + badCommit + ''); - if (goodCommit !== null) { - $('#good-commit').empty().append( - '' + goodCommit + ''); - } else { - $('#good-commit').empty().append( - 'No good commit found'); - } - - if (badCommit !== null && goodCommit !== null) { - $('#dl-bisect-script').removeClass('hidden'); - $('#bisect-script').append( - '' + - '' - ); - } else { - $('#dl-bisect-script').remove(); - } - $('#boot-bisect-table-body').empty().append(tableRows); - $('#table-div').fadeIn("slow", "linear"); -} - -function bisectAjaxCallFailed(data) { - 'use strict'; - $('#loading-div').remove(); - $('#loading-content').empty().append( - '

Error loading bisect data from server.

' - ); -} - -function getBisectData(data) { - 'use strict'; - - var localData = data.result[0], - status = localData.status, - docId, - bisectAjaxCall, - errorReason; - - errorReason = "Bisect data call failed."; - - if (status === "FAIL") { - $('#bisect-div').removeClass('hidden'); - docId = boardId + '-' + jobId + '-' + kernelId + '-' + defconfId; - - bisectAjaxCall = $.ajax({ - 'url': '/_ajax/bisect/boot/' + docId, - 'traditional': true, - 'cache': true, - 'dataType': 'json', - 'beforeSend': function(jqXHR) { - setXhrHeader(jqXHR); - }, - 'timeout': 8000, - 'error': function() { - bisectAjaxCallFailed(); - }, - 'statusCode': { - 400: function() { - setErrorAlert('bisect-400-error', 400, errorReason); - }, - 404: function() { - setErrorAlert('bisect-404-error', 404, errorReason); - }, - 408: function() { - errorReason = "Bisect data call failed: timeout". - setErrorAlert('bisect-408-error', 408, errorReason); - }, - 500: function() { - setErrorAlert('bisect-500-error', 500, errorReason); - } - } - }); - - $.when(bisectAjaxCall).done(createBootBisectTable); - } else { - $('#bisect-div').remove(); - } -} - -$(document).ready(function() { - 'use strict'; - - $('body').tooltip({ - 'selector': '[rel=tooltip]', - 'placement': 'auto top' - }); - - $('#li-boot').addClass('active'); - $('#table-div').hide(); - - var errorReason = 'Data call failed.'; - - $.ajax({ - 'url': '/_ajax/boot', - 'traditional': true, - 'cache': true, - 'dataType': 'json', - 'data': { - 'id': boardId + '-' + jobId + '-' + kernelId + '-' + defconfId - }, - 'beforeSend': function(jqXHR) { - setXhrHeader(jqXHR); - }, - 'statusCode': { - 400: function() { - loadContent( - '#container-content', '/static/html/400-content.html' - ); - setErrorAlert('data-400-error', 400, errorReason); - }, - 404: function() { - loadContent( - '#container-content', '/static/html/404-content.html' - ); - setErrorAlert('data-404-error', 404, errorReason); - }, - 408: function() { - loadContent( - '#container-content', '/static/html/408-content.html' - ); - setErrorAlert('data-408-error', 408, errorReason); - }, - 500: function() { - loadContent( - '#container-content', '/static/html/500-content.html' - ); - setErrorAlert('data-500-error', 500, errorReason); - } - } - }).done(function(data) { - populatePage(data); - getBisectData(data); - }); -}); diff --git a/app/dashboard/static/js/linaro-boots-id-1.0.8.js b/app/dashboard/static/js/linaro-boots-id-1.0.8.js new file mode 100644 index 0000000..683085d --- /dev/null +++ b/app/dashboard/static/js/linaro-boots-id-1.0.8.js @@ -0,0 +1,391 @@ +var boardId = $('#board-id').val(); +var jobId = $('#job-id').val(); +var kernelId = $('#kernel-id').val(); +var defconfId = $('#defconfig-id').val(); + +function populatePage(data) { + 'use strict'; + + var localData = data.result[0], + bootTime, + displ = '', + fileServer = $('#file-server').val(), + metadata, + nonAvail = '' + + ''; + + bootTime = new Date(localData.time['$date']); + metadata = localData.metadata; + + $('#dd-board-board').empty().append(localData.board); + $('#dd-board-defconfig').empty().append( + localData.defconfig + ' — ' + + '' + ); + $('#dd-board-kernel').empty().append( + '' + localData.kernel + + '' + + ' — ' + + '' + ); + $('#dd-board-tree').empty().append( + '' + + '' + localData.job + + '' + + ' — ' + + '' + ); + + if (localData.endian !== null) { + $('#dd-board-endianness').empty().append(localData.endian); + } else { + $('#dd-board-endianness').empty().append(nonAvail); + } + + if (localData.boot_log !== null || localData.boot_log_html !== null) { + $('#dd-board-boot-log').empty(); + + if (localData.boot_log !== null) { + $('#dd-board-boot-log').append( + 'txt' + + ' ' + ); + } + + if (localData.boot_log_html !== null) { + if (localData.boot_log !== null) { + $('#dd-board-boot-log').append(' — '); + } + $('#dd-board-boot-log').append( + 'html ' + ); + } + } else { + $('#dd-board-boot-log').empty().append(nonAvail); + } + + switch (localData.status) { + case 'PASS': + displ = ''; + break; + case 'FAIL': + displ = '' + + ''; + break; + case 'OFFLINE': + displ = '' + + ''; + break; + default: + displ = '' + + ''; + break; + } + + // Do we have a description for the boot result? + // We might have it directly in the json or in the metadata property. + if (localData.hasOwnProperty('boot_result_description')) { + displ += ' ' + localData.boot_result_description + + ''; + } else if (! $.isEmptyObject(metadata) && + metadata.hasOwnProperty('boot_result_description')) { + displ += ' ' + metadata.boot_result_description + + ''; + } + + $('#dd-board-status').empty().append(displ); + $('#dd-board-boot-time').empty().append(bootTime.getCustomTime()); + + if (localData.warnings !== null) { + $('#dd-board-warnings').empty().append(localData.warnings); + } else { + $('#dd-board-warnings').empty().append(0); + } + + if (localData.dtb !== null && localData.dtb !== '') { + $('#dd-board-dtb').empty().append(localData.dtb); + } else { + $('#dd-board-dtb').empty().append(nonAvail); + } + + if (localData.dtb_addr !== null && localData.dtb_addr !== '') { + $('#dd-board-dtb-address').empty().append(localData.dtb_addr); + } else { + $('#dd-board-dtb-address').empty().append(nonAvail); + } + + if (localData.initrd_addr !== null && localData.initrd_addr !== '') { + $('#dd-board-initrd-address').empty().append(localData.initrd_addr); + } else { + $('#dd-board-initrd-address').empty().append(nonAvail); + } + + if (localData.load_addr !== null && localData.load_addr !== '') { + $('#dd-board-load-address').empty().append(localData.load_addr); + } else { + $('#dd-board-load-address').empty().append(nonAvail); + } + + if (localData.kernel_image !== null && localData.kernel_image !== '') { + $('#dd-board-kernel-image').empty().append(localData.kernel_image); + } else { + $('#dd-board-kernel-image').empty().append(nonAvail); + } +} + +function createBisectScriptURI(badCommit, goodCommit) { + 'use strict'; + var bisectScript = '#!/bin/bash\n' + + 'git bisect start ' + badCommit + goodCommit + '\n'; + + return 'data:text/plain;charset=UTF-8,' + encodeURIComponent(bisectScript); +} + +function createBootBisectTable(data) { + 'use strict'; + $('#loading-content').empty().append("loading bisect data…"); + + var localData = data.result, + localLen = localData.length, + i = 0, + bisectData, + gitDescribeCell, + badCommitCell, + unknownCommitCell, + goodCommitCell, + bootStatus, + bisectDefMetadata, + tableRows, + tooltipLink, + tooltipTitle, + gitURLs, + gitDescribeVal, + badCommit = null, + goodCommit = null; + + badCommit = localData[0].defconfig_metadata.git_commit; + + for (i; i < localLen; i++) { + bisectData = localData[i]; + bootStatus = bisectData.boot_status; + bisectDefMetadata = bisectData.defconfig_metadata; + gitDescribeVal = bisectDefMetadata.git_describe; + + tooltipLink = '' + + gitDescribeVal + ''; + + tooltipTitle = 'Boot report details for ' + jobId + + ' ‐ ' + gitDescribeVal; + + gitDescribeCell = '' + + '' + + '' + tooltipLink + + ''; + + gitURLs = translateCommitURL( + bisectDefMetadata.git_url, bisectDefMetadata.git_commit); + + switch (bootStatus) { + case 'PASS': + goodCommit = bisectDefMetadata.git_commit; + goodCommitCell = '' + bisectDefMetadata.git_commit + + ' '; + badCommitCell = ''; + unknownCommitCell = ''; + break; + case 'FAIL': + goodCommitCell = ''; + badCommitCell = '' + bisectDefMetadata.git_commit + + ' '; + unknownCommitCell = ''; + break; + default: + goodCommitCell = ''; + badCommitCell = ''; + unknownCommitCell = '' + bisectDefMetadata.git_commit + + ' '; + break; + } + + tableRows += '' + gitDescribeCell + badCommitCell + + unknownCommitCell + goodCommitCell + ''; + } + + $('#loading-div').remove(); + $('#bad-commit').empty().append( + '' + badCommit + ''); + if (goodCommit !== null) { + $('#good-commit').empty().append( + '' + goodCommit + ''); + } else { + $('#good-commit').empty().append( + 'No good commit found'); + } + + if (badCommit !== null && goodCommit !== null) { + $('#dl-bisect-script').removeClass('hidden'); + $('#bisect-script').append( + '' + + '' + ); + } else { + $('#dl-bisect-script').remove(); + } + $('#boot-bisect-table-body').empty().append(tableRows); + $('#table-div').fadeIn("slow", "linear"); +} + +function bisectAjaxCallFailed(data) { + 'use strict'; + $('#loading-div').remove(); + $('#loading-content').empty().append( + '

Error loading bisect data from server.

' + ); +} + +function getBisectData(data) { + 'use strict'; + + var localData = data.result[0], + status = localData.status, + docId, + bisectAjaxCall, + errorReason; + + errorReason = "Bisect data call failed."; + + if (status === "FAIL") { + $('#bisect-div').removeClass('hidden'); + docId = boardId + '-' + jobId + '-' + kernelId + '-' + defconfId; + + bisectAjaxCall = $.ajax({ + 'url': '/_ajax/bisect/boot/' + docId, + 'traditional': true, + 'cache': true, + 'dataType': 'json', + 'beforeSend': function(jqXHR) { + setXhrHeader(jqXHR); + }, + 'timeout': 8000, + 'error': function() { + bisectAjaxCallFailed(); + }, + 'statusCode': { + 400: function() { + setErrorAlert('bisect-400-error', 400, errorReason); + }, + 404: function() { + setErrorAlert('bisect-404-error', 404, errorReason); + }, + 408: function() { + errorReason = "Bisect data call failed: timeout". + setErrorAlert('bisect-408-error', 408, errorReason); + }, + 500: function() { + setErrorAlert('bisect-500-error', 500, errorReason); + } + } + }); + + $.when(bisectAjaxCall).done(createBootBisectTable); + } else { + $('#bisect-div').remove(); + } +} + +$(document).ready(function() { + 'use strict'; + + $('body').tooltip({ + 'selector': '[rel=tooltip]', + 'placement': 'auto top' + }); + + $('#li-boot').addClass('active'); + $('#table-div').hide(); + + var errorReason = 'Data call failed.'; + + $.ajax({ + 'url': '/_ajax/boot', + 'traditional': true, + 'cache': true, + 'dataType': 'json', + 'data': { + 'id': boardId + '-' + jobId + '-' + kernelId + '-' + defconfId + }, + 'beforeSend': function(jqXHR) { + setXhrHeader(jqXHR); + }, + 'statusCode': { + 400: function() { + loadContent( + '#container-content', '/static/html/400-content.html' + ); + setErrorAlert('data-400-error', 400, errorReason); + }, + 404: function() { + loadContent( + '#container-content', '/static/html/404-content.html' + ); + setErrorAlert('data-404-error', 404, errorReason); + }, + 408: function() { + loadContent( + '#container-content', '/static/html/408-content.html' + ); + setErrorAlert('data-408-error', 408, errorReason); + }, + 500: function() { + loadContent( + '#container-content', '/static/html/500-content.html' + ); + setErrorAlert('data-500-error', 500, errorReason); + } + } + }).done(function(data) { + populatePage(data); + getBisectData(data); + }); +}); diff --git a/app/dashboard/templates/boots-id.html b/app/dashboard/templates/boots-id.html index 14d6e9c..4792762 100644 --- a/app/dashboard/templates/boots-id.html +++ b/app/dashboard/templates/boots-id.html @@ -181,5 +181,5 @@ function translateCommitURL(commitURL, commitId) { return [baseURL, newCommitURL]; } - + {%- endblock %} -- cgit v1.2.3