From c1ee8e4d0afd251af7b46f17fc8c0fdf35805575 Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Fri, 27 Feb 2015 16:40:03 +0100 Subject: Bump JS version number. Change-Id: I4d934b53bd1ff65a5bf07a294c4b423fbd4455f9 --- app/dashboard/static/js/linaro-boots-id-1.2.2.js | 872 ----------------------- app/dashboard/static/js/linaro-boots-id-1.2.3.js | 872 +++++++++++++++++++++++ app/dashboard/templates/boots-id.html | 2 +- 3 files changed, 873 insertions(+), 873 deletions(-) delete mode 100644 app/dashboard/static/js/linaro-boots-id-1.2.2.js create mode 100644 app/dashboard/static/js/linaro-boots-id-1.2.3.js diff --git a/app/dashboard/static/js/linaro-boots-id-1.2.2.js b/app/dashboard/static/js/linaro-boots-id-1.2.2.js deleted file mode 100644 index a5adbdf..0000000 --- a/app/dashboard/static/js/linaro-boots-id-1.2.2.js +++ /dev/null @@ -1,872 +0,0 @@ -var boardName = $('#board-name').val(); -var jobName = $('#job-name').val(); -var kernelName = $('#kernel-name').val(); -var defconfName = $('#defconfig-name').val(); -var labName = $('#lab-name').val(); -var bootId = $('#boot-id').val(); -var fileServer = $('#file-server').val(); -var dateRange = $('#date-range').val(); - -function createBootTableRow(data) { - 'use strict'; - var createdOn = new Date(data.created_on.$date), - resultDescription = data.boot_result_description, - fileServerUrl = data.file_server_url, - fileServerResource = data.file_server_resource, - arch = data.arch, - bootLog = data.boot_log, - bootLogHtml = data.boot_log_html, - defconfigFull = data.defconfig_full, - lab = data.lab_name, - job = data.job, - kernel = data.kernel, - statusDisplay = '', - pathUrl = null, - uriPath = null, - logPath = null, - fileServerUri = null, - rowHref = '', - col0, - col1, - col2, - col3, - col4, - col5; - - if (fileServerUrl !== null && fileServerUrl !== undefined) { - fileServer = fileServerUrl; - } - - if (fileServerResource !== null && - fileServerResource !== undefined) { - pathUrl = fileServerResource; - } else { - pathUrl = job + '/' + kernel + '/' + arch + '-' + - defconfigFull + '/'; - fileServerResource = null; - } - - fileServerUri = new URI(fileServer); - uriPath = fileServerUri.path() + '/' + pathUrl; - - switch (data.status) { - case 'PASS': - statusDisplay = '' + - ''; - break; - case 'FAIL': - statusDisplay = '' + - '' + - '' + - ''; - break; - case 'OFFLINE': - statusDisplay = '' + - ''; - break; - default: - statusDisplay = '' + - ''; - break; - } - - col0 = '' + lab + ''; - if (resultDescription !== null) { - if (resultDescription.length > 64) { - col1 = '' + - '' + - resultDescription.slice(0, 65) + '…' + - ''; - } else { - col1 = '' + resultDescription + ''; - } - } else { - col1 = ' '; - } - - col2 = ''; - if (bootLog !== null || bootLogHtml !== null) { - if (bootLog !== null) { - if (bootLog.search(lab) === -1) { - logPath = uriPath + '/' + lab + '/' + - bootLog; - } else { - logPath = uriPath + '/' + bootLog; - } - col2 += 'txt' + - ' ' + - ''; - } - - if (bootLogHtml !== null) { - if (bootLog !== null) { - col2 += ' — '; - } - if (bootLogHtml.search(lab) === -1) { - logPath = uriPath + '/' + lab + '/' + - bootLogHtml; - } else { - logPath = uriPath + '/' + bootLogHtml; - } - col2 += 'html ' + - ''; - } - } else { - col2 += ' '; - } - col2 += ''; - - col3 = '' + - createdOn.getCustomISODate() + ''; - col4 = '' + statusDisplay + ''; - - rowHref = '/boot/' + boardName + '/job/' + job + - '/kernel/' + kernel + '/defconfig/' + defconfigFull + - '/lab/' + lab + '/?_id=' + data._id.$oid; - - col5 = '' + - ''; - - return '' + - col0 + col1 + col2 + col3 + col4 + col5 + ''; -} - -function populateCompareTables(data, tableId, tableBodyId) { - 'use strict'; - var localData = data.result, - dataLen = localData.length, - i = 0, - rows = '', - tableBody = $(tableBodyId), - table = $(tableId); - - if (dataLen > 0) { - for (i; i < dataLen; i = i + 1) { - rows += createBootTableRow(localData[i]); - } - tableBody.empty().append(rows); - table.removeClass('hidden').fadeIn('slow', 'linear'); - } else { - tableBody.empty() - .append( - '' + - 'No recent results found.' + - ''); - table.removeClass('hidden').fadeIn('slow', 'linear'); - } -} - -function compareToMainlineFailed() { - 'use strict'; - $('#compare-to-mainline-div').empty().append( - '

' + - 'Error comparing with mainline.' + - '

'); -} - -function populateCompareToMainline(data) { - 'use strict'; - populateCompareTables( - data, '#compare-to-mainline-table', '#compare-to-mainline-table-body'); -} - -function compareToNextFailed() { - 'use strict'; - $('#compare-to-next-div').empty().append( - '

' + - 'Error comparing with mainline.' + - '

'); -} - -function populateCompareToNext(data) { - 'use strict'; - populateCompareTables( - data, '#compare-to-next-table', '#compare-to-next-table-body'); -} - -function populateOtherBootTable(data) { - 'use strict'; - var localData = data.result, - localDataLen = localData.length, - validReports = 0, - i = 0, - localReport = null, - localLabName, - allRows = '', - loadingDiv = $('#boot-reports-loading-div'), - tableBody = $('#boot-reports-table-body'); - - loadingDiv.empty() - .append( - ' ' + - 'analyzing boot reports data…'); - - if (localDataLen > 0) { - for (i; i < localDataLen; i = i + 1) { - localReport = localData[i]; - localLabName = localReport.lab_name; - - if (localLabName !== labName) { - validReports = validReports + 1; - allRows += createBootTableRow(localReport); - } - } - - if (validReports === 0) { - tableBody.empty() - .append( - '' + - 'No similar boot reports found.' + - ''); - } else { - tableBody.empty().append(allRows); - } - } else { - tableBody.empty() - .append( - '' + - 'No data available.' + - ''); - } - - loadingDiv.remove(); - $('#multiple-labs-table') - .removeClass('hidden') - .fadeIn('slow', 'linear'); -} - -function populatePage(data) { - 'use strict'; - var localData = data.result[0], - bootTime, - displ = '', - job, - kernel, - arch, - defconfigFull, - localLabName, - localBoard, - fileServer = $('#file-server').val(), - fileServerUri = null, - fileServerUrl = null, - fileServerResource = null, - pathUrl = null, - uriPath = null, - logPath = null, - createdOn = null, - bootLog, - bootLogHtml, - status, - retries, - otherDetails = null, - otherDetailsTxt = '', - otherTxt = '', - nonAvail = '' + - ''; - - bootTime = new Date(localData.time.$date); - - localBoard = localData.board; - job = localData.job; - kernel = localData.kernel; - defconfigFull = localData.defconfig_full; - arch = localData.arch; - localLabName = localData.lab_name; - fileServerUrl = localData.file_server_url; - fileServerResource = localData.file_server_resource; - bootLog = localData.boot_log; - bootLogHtml = localData.boot_log_html; - createdOn = new Date(localData.created_on.$date); - status = localData.status; - retries = localData.retries; - - $('#dd-date').empty().append(createdOn.getCustomISODate()); - - $('#dd-retries').empty().append( - '' + - retries + ''); - - $('#dd-lab-name').empty().append( - '' + - '' + localLabName + - ' '); - - $('#dd-board-board').empty().append( - '' + localBoard + - ' '); - - $('#dd-board-arch').empty().append(arch); - - $('#dd-board-defconfig').empty().append( - '' + - '' + - defconfigFull + '' + - ' — ' + - '' - ); - $('#dd-board-kernel').empty().append( - '' + kernel + - '' + - ' — ' + - '' - ); - $('#dd-board-tree').empty().append( - '' + - '' + job + - '' + - ' — ' + - '' - ); - - if (localData.endian !== null) { - $('#dd-board-endianness').empty().append(localData.endian); - } else { - $('#dd-board-endianness').empty().append(nonAvail); - } - - if (fileServerUrl !== null && fileServerUrl !== undefined) { - fileServer = fileServerUrl; - } - - if (fileServerResource !== null && fileServerResource !== undefined) { - pathUrl = fileServerResource; - } else { - pathUrl = job + '/' + kernel + '/' + arch + '-' + - defconfigFull + '/'; - fileServerResource = null; - } - - fileServerUri = new URI(fileServer); - uriPath = fileServerUri.path() + '/' + pathUrl; - - if (bootLog !== null || bootLogHtml !== null) { - $('#dd-board-boot-log').empty(); - - if (bootLog !== null) { - if (bootLog.search(localLabName) === -1) { - logPath = uriPath + '/' + localLabName + '/' + bootLog; - } else { - logPath = uriPath + '/' + bootLog; - } - $('#dd-board-boot-log').append( - 'txt' + - ' ' - ); - } - - if (bootLogHtml !== null) { - if (bootLog !== null) { - $('#dd-board-boot-log').append(' — '); - } - if (bootLogHtml.search(localLabName) === -1) { - logPath = uriPath + '/' + localLabName + '/' + bootLogHtml; - } else { - logPath = uriPath + '/' + bootLogHtml; - } - $('#dd-board-boot-log').append( - 'html ' - ); - } - } else { - $('#dd-board-boot-log').empty().append(nonAvail); - } - - switch (status) { - case 'PASS': - displ = '' + - ''; - break; - case 'FAIL': - displ = '' + - '' + - ''; - break; - case 'OFFLINE': - displ = '' + - ''; - break; - default: - displ = '' + - ''; - break; - } - - if (localData.boot_result_description !== null && status !== 'PASS') { - displ += ' ' + localData.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); - } - - otherDetails = $('#other-details-div'); - if (localData.qemu !== null && localData.qemu !== '') { - otherTxt = ''; - otherDetailsTxt = '
' + - '' + - '
'; - if (localData.qemu_command !== null && localData.qemu_command !== '') { - otherTxt = '
Command
'; - if (localData.qemu_command.length > 99) { - otherTxt += '' + - localData.qemu_command.slice(0, 99).trimRight() + - '… ' + - ' ' + - ''; - otherDetailsTxt += JSBase.createLargeModalDialog( - 'qemu-command', - 'Qemu Command Line', - '

' + - localData.qemu_command + - '

'); - } else { - otherTxt += '' + localData.qemu_command + - '
'; - } - } - otherDetailsTxt += '
' + - '
Binary
' + localData.qemu + '
' + - otherTxt + - '
'; - otherDetails.append(otherDetailsTxt); - otherDetails.removeClass('hidden'); - } -} - -function bisectCompareToAjaxCallFailed() { - 'use strict'; - $('#bisect-compare-loading-div').remove(); - $('#bisect-compare-content') - .removeClass('hidden') - .empty() - .append('Error loading bisect data from server.') - .addClass('pull-center'); -} - -function bisectComparedToMainline(data) { - 'use strict'; - var bisectData = data.result[0], - bootId, - ajaxDeferredCall, - bisectElements = null, - errorReason = 'Error loading bisect data compared to mainline'; - - if (bisectData.job !== 'mainline') { - $('#bisect-compare-div').removeClass('hidden'); - bootId = bisectData.boot_id.$oid; - ajaxDeferredCall = JSBase.createDeferredCall( - '/_ajax/bisect?collection=boot&compare_to=mainline&' + - 'boot_id=' + bootId, - 'GET', - null, - null, - bisectCompareToAjaxCallFailed, - errorReason, - null, - 'bisect-call-compare-to' - ); - - bisectElements = { - showHideID: '#bootb-compare-showhide', - 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, - bisectShowHideID: '#bisect-compare-hide-div' - }; - - $.when(ajaxDeferredCall).done(function(data) { - Bisect.initBisect( - data, - bisectElements, - true - ); - }); - } else { - JSBase.removeElementByID('#bisect-compare-div'); - } -} - -function bisectAjaxCallFailed() { - 'use strict'; - $('#bisect-loading-div').remove(); - $('#bisect-content') - .removeClass('hidden') - .empty() - .append('Error loading bisect data from server.') - .addClass('pull-center'); -} - -function getBisectData(data) { - 'use strict'; - - var localData = data.result[0], - status = localData.status, - bisectElements = null, - bisectAjaxCall, - errorReason; - - errorReason = 'Bisect data call failed'; - - if (status === 'FAIL') { - JSBase.removeCssClassForID('#bisect', 'hidden'); - JSBase.removeCssClassForID('#bisect-div', 'hidden'); - - if (bootId === 'None') { - bootId = data.result[0]._id.$oid; - } - - bisectAjaxCall = JSBase.createDeferredCall( - '/_ajax/bisect?collection=boot&boot_id=' + bootId, - 'GET', - null, - null, - bisectAjaxCallFailed, - errorReason, - null, - 'bisect-call' - ); - - bisectElements = { - showHideID: '#bootb-showhide', - tableDivID: '#table-div', - tableID: '#bisect-table', - tableBodyID: '#bisect-table-body', - contentDivID: '#bisect-content', - loadingDivID: '#bisect-loading-div', - loadingContentID: '#bisect-loading-content', - loadingContentText: 'loading bisect data…', - badCommitID: '#bad-commit', - goodCommitID: '#good-commit', - bisectScriptContainerID: '#dl-bisect-script', - bisectScriptContentID: '#bisect-script', - bisectCompareDescriptionID: null, - prevBisect: null, - bisectShowHideID: '#bisect-hide-div' - }; - - $.when(bisectAjaxCall) - .done(bisectComparedToMainline) - .done(function(data) { - Bisect.initBisect( - data, - bisectElements, - false - ); - }); - } else { - JSBase.removeElementByID('#bisect'); - } -} - -function removeCompareToLoadingContent() { - 'use strict'; - $('#boot-reports-compared-to-load').remove(); -} - -function compareToOtherTrees(data) { - 'use strict'; - $('#boot-reports-compared-to-load').empty().append( - ' ' + - '' + - 'searching for similar boot reports…' - ); - - var ajaxData = null, - ajaxDeferredCall = null, - errorReason = '', - localData = data.result, - dataLen = localData.length, - createdOn = null; - - if (dataLen > 0) { - createdOn = new Date(localData[0].created_on.$date); - ajaxData = { - 'created_on': createdOn.getCustomISODate(), - 'board': boardName, - 'date_range': dateRange, - 'sort': 'created_on', - 'defconfig_full': defconfName, - 'sort_order': -1, - 'limit': 3 - }; - } - - // Execute the comparison with mainline if it is not mainline. - if (jobName !== 'mainline') { - errorReason = 'Retrieving compare data ' + - 'with «mainline» failed'; - - ajaxData.job = 'mainline'; - ajaxDeferredCall = JSBase.createDeferredCall( - '/_ajax/boot', - 'GET', - ajaxData, - null, - compareToMainlineFailed, - errorReason, - null, - 'compare-to-mainline' - ); - - $.when(ajaxDeferredCall) - .done(populateCompareToMainline, removeCompareToLoadingContent); - } else { - $('#compare-to-mainline-div').remove(); - } - - if (jobName !== 'next' && dataLen === 1) { - errorReason = 'Retrieving compare data ' + - 'with «next» failed'; - - ajaxData.job = 'next'; - ajaxDeferredCall = JSBase.createDeferredCall( - '/_ajax/boot', - 'GET', - ajaxData, - null, - compareToNextFailed, - errorReason, - null, - 'compare-to-next' - ); - - $.when(ajaxDeferredCall) - .done(populateCompareToNext, removeCompareToLoadingContent); - } else { - $('#compare-to-next-div').remove(); - } -} - -function multipleBootReportsFailed() { - 'use strict'; - $('#other-reports-table-div') - .empty() - .addClass('pull-center') - .append('Error loading data.'); -} - -function bootIdAjaxFailed() { - 'use strict'; - - JSBase.replaceContentByClass( - '.loading-content', - '' + - '' - ); -} - -function createBootTimeGraph(data) { - 'use strict'; - var graph = new KG.BootTimeGraph('#time-chart') - .init() - .bind(data) - .draw(); -} - -$(document).ready(function() { - 'use strict'; - $('#li-boot').addClass('active'); - - var errorReason = 'Boot data call failed', - ajaxData = {}, - multiLabData = {}, - deferredAjaxCall; - - if (bootId !== 'None') { - ajaxData.id = bootId; - } else { - ajaxData = { - kernel: kernelName, - job: jobName, - defconfig_full: defconfName, - lab: labName, - board: boardName - }; - } - - multiLabData.kernel = kernelName; - multiLabData.job = jobName; - multiLabData.defconfig_full = defconfName; - multiLabData.board = boardName; - multiLabData.field = [ - '_id', 'lab_name', 'boot_log', 'boot_log_html', - 'boot_result_description', 'defconfig', 'defconfig_full', - 'created_on', 'status', 'arch' - ]; - - deferredAjaxCall = JSBase.createDeferredCall( - '/_ajax/boot', - 'GET', - ajaxData, - null, - bootIdAjaxFailed, - errorReason - ); - - $.when(deferredAjaxCall) - .done(populatePage, getBisectData, compareToOtherTrees); - - deferredAjaxCall = JSBase.createDeferredCall( - '/_ajax/boot', - 'GET', - multiLabData, - null, - multipleBootReportsFailed, - errorReason, - null, - 'multilab' - ); - - $.when(deferredAjaxCall).done(populateOtherBootTable); - - ajaxData = { - // kernel: kernelName, - job: jobName, - defconfig_full: defconfName, - lab: labName, - board: boardName, - date_range: 30, - sort_order: 1, - sort: 'created_on', - status: 'PASS', - field: [ - 'created_on', 'lab_name', 'kernel', 'created_on', 'board', 'time', - 'job', 'defconfig', 'defconfig_full' - ] - }; - deferredAjaxCall = JSBase.createDeferredCall( - '/_ajax/boot', - 'GET', - ajaxData - ); - $.when(deferredAjaxCall).done(createBootTimeGraph); -}); diff --git a/app/dashboard/static/js/linaro-boots-id-1.2.3.js b/app/dashboard/static/js/linaro-boots-id-1.2.3.js new file mode 100644 index 0000000..a5adbdf --- /dev/null +++ b/app/dashboard/static/js/linaro-boots-id-1.2.3.js @@ -0,0 +1,872 @@ +var boardName = $('#board-name').val(); +var jobName = $('#job-name').val(); +var kernelName = $('#kernel-name').val(); +var defconfName = $('#defconfig-name').val(); +var labName = $('#lab-name').val(); +var bootId = $('#boot-id').val(); +var fileServer = $('#file-server').val(); +var dateRange = $('#date-range').val(); + +function createBootTableRow(data) { + 'use strict'; + var createdOn = new Date(data.created_on.$date), + resultDescription = data.boot_result_description, + fileServerUrl = data.file_server_url, + fileServerResource = data.file_server_resource, + arch = data.arch, + bootLog = data.boot_log, + bootLogHtml = data.boot_log_html, + defconfigFull = data.defconfig_full, + lab = data.lab_name, + job = data.job, + kernel = data.kernel, + statusDisplay = '', + pathUrl = null, + uriPath = null, + logPath = null, + fileServerUri = null, + rowHref = '', + col0, + col1, + col2, + col3, + col4, + col5; + + if (fileServerUrl !== null && fileServerUrl !== undefined) { + fileServer = fileServerUrl; + } + + if (fileServerResource !== null && + fileServerResource !== undefined) { + pathUrl = fileServerResource; + } else { + pathUrl = job + '/' + kernel + '/' + arch + '-' + + defconfigFull + '/'; + fileServerResource = null; + } + + fileServerUri = new URI(fileServer); + uriPath = fileServerUri.path() + '/' + pathUrl; + + switch (data.status) { + case 'PASS': + statusDisplay = '' + + ''; + break; + case 'FAIL': + statusDisplay = '' + + '' + + '' + + ''; + break; + case 'OFFLINE': + statusDisplay = '' + + ''; + break; + default: + statusDisplay = '' + + ''; + break; + } + + col0 = '' + lab + ''; + if (resultDescription !== null) { + if (resultDescription.length > 64) { + col1 = '' + + '' + + resultDescription.slice(0, 65) + '…' + + ''; + } else { + col1 = '' + resultDescription + ''; + } + } else { + col1 = ' '; + } + + col2 = ''; + if (bootLog !== null || bootLogHtml !== null) { + if (bootLog !== null) { + if (bootLog.search(lab) === -1) { + logPath = uriPath + '/' + lab + '/' + + bootLog; + } else { + logPath = uriPath + '/' + bootLog; + } + col2 += 'txt' + + ' ' + + ''; + } + + if (bootLogHtml !== null) { + if (bootLog !== null) { + col2 += ' — '; + } + if (bootLogHtml.search(lab) === -1) { + logPath = uriPath + '/' + lab + '/' + + bootLogHtml; + } else { + logPath = uriPath + '/' + bootLogHtml; + } + col2 += 'html ' + + ''; + } + } else { + col2 += ' '; + } + col2 += ''; + + col3 = '' + + createdOn.getCustomISODate() + ''; + col4 = '' + statusDisplay + ''; + + rowHref = '/boot/' + boardName + '/job/' + job + + '/kernel/' + kernel + '/defconfig/' + defconfigFull + + '/lab/' + lab + '/?_id=' + data._id.$oid; + + col5 = '' + + ''; + + return '' + + col0 + col1 + col2 + col3 + col4 + col5 + ''; +} + +function populateCompareTables(data, tableId, tableBodyId) { + 'use strict'; + var localData = data.result, + dataLen = localData.length, + i = 0, + rows = '', + tableBody = $(tableBodyId), + table = $(tableId); + + if (dataLen > 0) { + for (i; i < dataLen; i = i + 1) { + rows += createBootTableRow(localData[i]); + } + tableBody.empty().append(rows); + table.removeClass('hidden').fadeIn('slow', 'linear'); + } else { + tableBody.empty() + .append( + '' + + 'No recent results found.' + + ''); + table.removeClass('hidden').fadeIn('slow', 'linear'); + } +} + +function compareToMainlineFailed() { + 'use strict'; + $('#compare-to-mainline-div').empty().append( + '

' + + 'Error comparing with mainline.' + + '

'); +} + +function populateCompareToMainline(data) { + 'use strict'; + populateCompareTables( + data, '#compare-to-mainline-table', '#compare-to-mainline-table-body'); +} + +function compareToNextFailed() { + 'use strict'; + $('#compare-to-next-div').empty().append( + '

' + + 'Error comparing with mainline.' + + '

'); +} + +function populateCompareToNext(data) { + 'use strict'; + populateCompareTables( + data, '#compare-to-next-table', '#compare-to-next-table-body'); +} + +function populateOtherBootTable(data) { + 'use strict'; + var localData = data.result, + localDataLen = localData.length, + validReports = 0, + i = 0, + localReport = null, + localLabName, + allRows = '', + loadingDiv = $('#boot-reports-loading-div'), + tableBody = $('#boot-reports-table-body'); + + loadingDiv.empty() + .append( + ' ' + + 'analyzing boot reports data…'); + + if (localDataLen > 0) { + for (i; i < localDataLen; i = i + 1) { + localReport = localData[i]; + localLabName = localReport.lab_name; + + if (localLabName !== labName) { + validReports = validReports + 1; + allRows += createBootTableRow(localReport); + } + } + + if (validReports === 0) { + tableBody.empty() + .append( + '' + + 'No similar boot reports found.' + + ''); + } else { + tableBody.empty().append(allRows); + } + } else { + tableBody.empty() + .append( + '' + + 'No data available.' + + ''); + } + + loadingDiv.remove(); + $('#multiple-labs-table') + .removeClass('hidden') + .fadeIn('slow', 'linear'); +} + +function populatePage(data) { + 'use strict'; + var localData = data.result[0], + bootTime, + displ = '', + job, + kernel, + arch, + defconfigFull, + localLabName, + localBoard, + fileServer = $('#file-server').val(), + fileServerUri = null, + fileServerUrl = null, + fileServerResource = null, + pathUrl = null, + uriPath = null, + logPath = null, + createdOn = null, + bootLog, + bootLogHtml, + status, + retries, + otherDetails = null, + otherDetailsTxt = '', + otherTxt = '', + nonAvail = '' + + ''; + + bootTime = new Date(localData.time.$date); + + localBoard = localData.board; + job = localData.job; + kernel = localData.kernel; + defconfigFull = localData.defconfig_full; + arch = localData.arch; + localLabName = localData.lab_name; + fileServerUrl = localData.file_server_url; + fileServerResource = localData.file_server_resource; + bootLog = localData.boot_log; + bootLogHtml = localData.boot_log_html; + createdOn = new Date(localData.created_on.$date); + status = localData.status; + retries = localData.retries; + + $('#dd-date').empty().append(createdOn.getCustomISODate()); + + $('#dd-retries').empty().append( + '' + + retries + ''); + + $('#dd-lab-name').empty().append( + '' + + '' + localLabName + + ' '); + + $('#dd-board-board').empty().append( + '' + localBoard + + ' '); + + $('#dd-board-arch').empty().append(arch); + + $('#dd-board-defconfig').empty().append( + '' + + '' + + defconfigFull + '' + + ' — ' + + '' + ); + $('#dd-board-kernel').empty().append( + '' + kernel + + '' + + ' — ' + + '' + ); + $('#dd-board-tree').empty().append( + '' + + '' + job + + '' + + ' — ' + + '' + ); + + if (localData.endian !== null) { + $('#dd-board-endianness').empty().append(localData.endian); + } else { + $('#dd-board-endianness').empty().append(nonAvail); + } + + if (fileServerUrl !== null && fileServerUrl !== undefined) { + fileServer = fileServerUrl; + } + + if (fileServerResource !== null && fileServerResource !== undefined) { + pathUrl = fileServerResource; + } else { + pathUrl = job + '/' + kernel + '/' + arch + '-' + + defconfigFull + '/'; + fileServerResource = null; + } + + fileServerUri = new URI(fileServer); + uriPath = fileServerUri.path() + '/' + pathUrl; + + if (bootLog !== null || bootLogHtml !== null) { + $('#dd-board-boot-log').empty(); + + if (bootLog !== null) { + if (bootLog.search(localLabName) === -1) { + logPath = uriPath + '/' + localLabName + '/' + bootLog; + } else { + logPath = uriPath + '/' + bootLog; + } + $('#dd-board-boot-log').append( + 'txt' + + ' ' + ); + } + + if (bootLogHtml !== null) { + if (bootLog !== null) { + $('#dd-board-boot-log').append(' — '); + } + if (bootLogHtml.search(localLabName) === -1) { + logPath = uriPath + '/' + localLabName + '/' + bootLogHtml; + } else { + logPath = uriPath + '/' + bootLogHtml; + } + $('#dd-board-boot-log').append( + 'html ' + ); + } + } else { + $('#dd-board-boot-log').empty().append(nonAvail); + } + + switch (status) { + case 'PASS': + displ = '' + + ''; + break; + case 'FAIL': + displ = '' + + '' + + ''; + break; + case 'OFFLINE': + displ = '' + + ''; + break; + default: + displ = '' + + ''; + break; + } + + if (localData.boot_result_description !== null && status !== 'PASS') { + displ += ' ' + localData.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); + } + + otherDetails = $('#other-details-div'); + if (localData.qemu !== null && localData.qemu !== '') { + otherTxt = ''; + otherDetailsTxt = '
' + + '' + + '
'; + if (localData.qemu_command !== null && localData.qemu_command !== '') { + otherTxt = '
Command
'; + if (localData.qemu_command.length > 99) { + otherTxt += '' + + localData.qemu_command.slice(0, 99).trimRight() + + '… ' + + ' ' + + ''; + otherDetailsTxt += JSBase.createLargeModalDialog( + 'qemu-command', + 'Qemu Command Line', + '

' + + localData.qemu_command + + '

'); + } else { + otherTxt += '' + localData.qemu_command + + '
'; + } + } + otherDetailsTxt += '
' + + '
Binary
' + localData.qemu + '
' + + otherTxt + + '
'; + otherDetails.append(otherDetailsTxt); + otherDetails.removeClass('hidden'); + } +} + +function bisectCompareToAjaxCallFailed() { + 'use strict'; + $('#bisect-compare-loading-div').remove(); + $('#bisect-compare-content') + .removeClass('hidden') + .empty() + .append('Error loading bisect data from server.') + .addClass('pull-center'); +} + +function bisectComparedToMainline(data) { + 'use strict'; + var bisectData = data.result[0], + bootId, + ajaxDeferredCall, + bisectElements = null, + errorReason = 'Error loading bisect data compared to mainline'; + + if (bisectData.job !== 'mainline') { + $('#bisect-compare-div').removeClass('hidden'); + bootId = bisectData.boot_id.$oid; + ajaxDeferredCall = JSBase.createDeferredCall( + '/_ajax/bisect?collection=boot&compare_to=mainline&' + + 'boot_id=' + bootId, + 'GET', + null, + null, + bisectCompareToAjaxCallFailed, + errorReason, + null, + 'bisect-call-compare-to' + ); + + bisectElements = { + showHideID: '#bootb-compare-showhide', + 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, + bisectShowHideID: '#bisect-compare-hide-div' + }; + + $.when(ajaxDeferredCall).done(function(data) { + Bisect.initBisect( + data, + bisectElements, + true + ); + }); + } else { + JSBase.removeElementByID('#bisect-compare-div'); + } +} + +function bisectAjaxCallFailed() { + 'use strict'; + $('#bisect-loading-div').remove(); + $('#bisect-content') + .removeClass('hidden') + .empty() + .append('Error loading bisect data from server.') + .addClass('pull-center'); +} + +function getBisectData(data) { + 'use strict'; + + var localData = data.result[0], + status = localData.status, + bisectElements = null, + bisectAjaxCall, + errorReason; + + errorReason = 'Bisect data call failed'; + + if (status === 'FAIL') { + JSBase.removeCssClassForID('#bisect', 'hidden'); + JSBase.removeCssClassForID('#bisect-div', 'hidden'); + + if (bootId === 'None') { + bootId = data.result[0]._id.$oid; + } + + bisectAjaxCall = JSBase.createDeferredCall( + '/_ajax/bisect?collection=boot&boot_id=' + bootId, + 'GET', + null, + null, + bisectAjaxCallFailed, + errorReason, + null, + 'bisect-call' + ); + + bisectElements = { + showHideID: '#bootb-showhide', + tableDivID: '#table-div', + tableID: '#bisect-table', + tableBodyID: '#bisect-table-body', + contentDivID: '#bisect-content', + loadingDivID: '#bisect-loading-div', + loadingContentID: '#bisect-loading-content', + loadingContentText: 'loading bisect data…', + badCommitID: '#bad-commit', + goodCommitID: '#good-commit', + bisectScriptContainerID: '#dl-bisect-script', + bisectScriptContentID: '#bisect-script', + bisectCompareDescriptionID: null, + prevBisect: null, + bisectShowHideID: '#bisect-hide-div' + }; + + $.when(bisectAjaxCall) + .done(bisectComparedToMainline) + .done(function(data) { + Bisect.initBisect( + data, + bisectElements, + false + ); + }); + } else { + JSBase.removeElementByID('#bisect'); + } +} + +function removeCompareToLoadingContent() { + 'use strict'; + $('#boot-reports-compared-to-load').remove(); +} + +function compareToOtherTrees(data) { + 'use strict'; + $('#boot-reports-compared-to-load').empty().append( + ' ' + + '' + + 'searching for similar boot reports…' + ); + + var ajaxData = null, + ajaxDeferredCall = null, + errorReason = '', + localData = data.result, + dataLen = localData.length, + createdOn = null; + + if (dataLen > 0) { + createdOn = new Date(localData[0].created_on.$date); + ajaxData = { + 'created_on': createdOn.getCustomISODate(), + 'board': boardName, + 'date_range': dateRange, + 'sort': 'created_on', + 'defconfig_full': defconfName, + 'sort_order': -1, + 'limit': 3 + }; + } + + // Execute the comparison with mainline if it is not mainline. + if (jobName !== 'mainline') { + errorReason = 'Retrieving compare data ' + + 'with «mainline» failed'; + + ajaxData.job = 'mainline'; + ajaxDeferredCall = JSBase.createDeferredCall( + '/_ajax/boot', + 'GET', + ajaxData, + null, + compareToMainlineFailed, + errorReason, + null, + 'compare-to-mainline' + ); + + $.when(ajaxDeferredCall) + .done(populateCompareToMainline, removeCompareToLoadingContent); + } else { + $('#compare-to-mainline-div').remove(); + } + + if (jobName !== 'next' && dataLen === 1) { + errorReason = 'Retrieving compare data ' + + 'with «next» failed'; + + ajaxData.job = 'next'; + ajaxDeferredCall = JSBase.createDeferredCall( + '/_ajax/boot', + 'GET', + ajaxData, + null, + compareToNextFailed, + errorReason, + null, + 'compare-to-next' + ); + + $.when(ajaxDeferredCall) + .done(populateCompareToNext, removeCompareToLoadingContent); + } else { + $('#compare-to-next-div').remove(); + } +} + +function multipleBootReportsFailed() { + 'use strict'; + $('#other-reports-table-div') + .empty() + .addClass('pull-center') + .append('Error loading data.'); +} + +function bootIdAjaxFailed() { + 'use strict'; + + JSBase.replaceContentByClass( + '.loading-content', + '' + + '' + ); +} + +function createBootTimeGraph(data) { + 'use strict'; + var graph = new KG.BootTimeGraph('#time-chart') + .init() + .bind(data) + .draw(); +} + +$(document).ready(function() { + 'use strict'; + $('#li-boot').addClass('active'); + + var errorReason = 'Boot data call failed', + ajaxData = {}, + multiLabData = {}, + deferredAjaxCall; + + if (bootId !== 'None') { + ajaxData.id = bootId; + } else { + ajaxData = { + kernel: kernelName, + job: jobName, + defconfig_full: defconfName, + lab: labName, + board: boardName + }; + } + + multiLabData.kernel = kernelName; + multiLabData.job = jobName; + multiLabData.defconfig_full = defconfName; + multiLabData.board = boardName; + multiLabData.field = [ + '_id', 'lab_name', 'boot_log', 'boot_log_html', + 'boot_result_description', 'defconfig', 'defconfig_full', + 'created_on', 'status', 'arch' + ]; + + deferredAjaxCall = JSBase.createDeferredCall( + '/_ajax/boot', + 'GET', + ajaxData, + null, + bootIdAjaxFailed, + errorReason + ); + + $.when(deferredAjaxCall) + .done(populatePage, getBisectData, compareToOtherTrees); + + deferredAjaxCall = JSBase.createDeferredCall( + '/_ajax/boot', + 'GET', + multiLabData, + null, + multipleBootReportsFailed, + errorReason, + null, + 'multilab' + ); + + $.when(deferredAjaxCall).done(populateOtherBootTable); + + ajaxData = { + // kernel: kernelName, + job: jobName, + defconfig_full: defconfName, + lab: labName, + board: boardName, + date_range: 30, + sort_order: 1, + sort: 'created_on', + status: 'PASS', + field: [ + 'created_on', 'lab_name', 'kernel', 'created_on', 'board', 'time', + 'job', 'defconfig', 'defconfig_full' + ] + }; + deferredAjaxCall = JSBase.createDeferredCall( + '/_ajax/boot', + 'GET', + ajaxData + ); + $.when(deferredAjaxCall).done(createBootTimeGraph); +}); diff --git a/app/dashboard/templates/boots-id.html b/app/dashboard/templates/boots-id.html index f53b9c2..01cfebd 100644 --- a/app/dashboard/templates/boots-id.html +++ b/app/dashboard/templates/boots-id.html @@ -156,5 +156,5 @@ - + {%- endblock %} -- cgit v1.2.3