From bb30f82b26dd71642b17ac980612e85da87e2510 Mon Sep 17 00:00:00 2001 From: Chris Paterson Date: Thu, 25 Nov 2021 21:30:03 +0000 Subject: [PATCH 1/2] dashboard/templates: Remove graphs from jobs-job{-branch} templates In the job// and job// views we often get a "Error loading test data" error for the test pass rate graph at the bottom of the page. When viewing an entire tree at this level the build/test pass rate graphs don't provide any useful information anyway, so let's just remove them. If anyone manages to work out what is causing the issues in future we can always restore one or both of the graphs again. Signed-off-by: Chris Paterson --- app/dashboard/templates/jobs-job-branch.html | 33 -------------------- app/dashboard/templates/jobs-job.html | 33 -------------------- 2 files changed, 66 deletions(-) diff --git a/app/dashboard/templates/jobs-job-branch.html b/app/dashboard/templates/jobs-job-branch.html index ae1f4087f..d1383e80e 100644 --- a/app/dashboard/templates/jobs-job-branch.html +++ b/app/dashboard/templates/jobs-job-branch.html @@ -62,39 +62,6 @@

Available Kernels

-
-
- -
-

Build Pass Rate

-
-
- - - -  calculating build pass rate… - - -
-
-
-
-

Test Pass Rate

-
-
- - - -  calculating test pass rate… - - -
-
-
-
-
diff --git a/app/dashboard/templates/jobs-job.html b/app/dashboard/templates/jobs-job.html index bf2abeb96..fd706b99a 100644 --- a/app/dashboard/templates/jobs-job.html +++ b/app/dashboard/templates/jobs-job.html @@ -62,39 +62,6 @@

Available Kernels

-
-
- -
-

Build Pass Rate

-
-
- - - -  calculating build pass rate… - - -
-
-
-
-

Test Pass Rate

-
-
- - - -  calculating test pass rate… - - -
-
-
-
-
From a48b932ad3fa0797b1f8450ad92a8444bab218c4 Mon Sep 17 00:00:00 2001 From: Chris Paterson Date: Mon, 6 Dec 2021 11:51:14 +0000 Subject: [PATCH 2/2] dashboard/js: Remove build/test rates from jobs-job{-branch}*.js scripts Keep charts/passrate.js for now in case it's useful for someone. Signed-off-by: Chris Paterson --- .../js/app/view-jobs-job-branch.2020.10.js | 100 +----------------- .../static/js/app/view-jobs-job.2020.10.js | 92 +--------------- 2 files changed, 4 insertions(+), 188 deletions(-) diff --git a/app/dashboard/static/js/app/view-jobs-job-branch.2020.10.js b/app/dashboard/static/js/app/view-jobs-job-branch.2020.10.js index c121fa39a..4a3c10532 100644 --- a/app/dashboard/static/js/app/view-jobs-job-branch.2020.10.js +++ b/app/dashboard/static/js/app/view-jobs-job-branch.2020.10.js @@ -25,7 +25,6 @@ require([ 'utils/error', 'utils/table', 'utils/urls', - 'charts/passrate', 'utils/html', 'tables/job', 'URI', @@ -44,101 +43,6 @@ require([ gNumberRange = 20; - function getTestStatsFail() { - html.replaceContent( - document.getElementById('test-pass-rate'), - html.errorDiv('Error loading test data.')); - } - - function getTestStatsDone(response) { - chart.testpassrate('test-pass-rate', response); - } - - function getTestStats(startDate, dateRange) { - var data; - var deferred; - - data = { - job: gJobName, - git_branch: gBranchName, - sort: 'created_on', - sort_order: 1, - created_on: startDate, - date_range: dateRange, - field: ['status', 'kernel', 'created_on', 'job'] - }; - - deferred = r.get('/_ajax/test/case', data); - $.when(deferred) - .fail(e.error, getTestStatsFail) - .done(getTestStatsDone); - } - - function getBuildsStatsFail() { - html.replaceContent( - document.getElementById('build-pass-rate'), - html.errorDiv('Error loading build data.')); - } - - function getBuildsStatsDone(response) { - chart.buildpassrate('build-pass-rate', response); - } - - function getBuildsStats(startDate, dateRange) { - var data; - var deferred; - - data = { - job: gJobName, - git_branch: gBranchName, - sort: 'created_on', - sort_order: 1, - created_on: startDate, - date_range: dateRange, - field: ['status', 'kernel', 'created_on', 'job'] - }; - - deferred = r.get('/_ajax/build', data); - $.when(deferred) - .fail(e.error, getBuildsStatsFail) - .done(getBuildsStatsDone); - } - - function getTrendsData(response) { - var firstDate; - var lDateRange; - var lastDate; - var resLen; - var results; - - results = response.result; - resLen = results.length; - lDateRange = 0; - - if (resLen > 0) { - firstDate = new Date(results[0].created_on.$date); - if (resLen > 1) { - lastDate = new Date(results[resLen - 1].created_on.$date); - lDateRange = Math.round((firstDate - lastDate) / 86400000); - } - - setTimeout(function() { - getBuildsStats(firstDate.toCustomISODate(), lDateRange); - }, 25); - setTimeout(function() { - getTestStats(firstDate.toCustomISODate(), lDateRange); - }, 25); - } else { - html.replaceContent( - document.getElementById('build-pass-rate'), - html.errorDiv('No build data available.')); - - html.replaceContent( - document.getElementById('test-pass-rate'), - html.errorDiv('No test data available.')); - } - } - function getBuildTestsCountFail() { html.replaceByClass('count-badge', '∞'); } @@ -460,8 +364,8 @@ require([ $.when(deferred) .fail( e.error, - getBuildsFailed, getBuildsStatsFail, getTestStatsFail) - .done(getTrendsData, getBuildsDone, getBuildTestsCount); + getBuildsFailed) + .done(getBuildsDone, getBuildTestsCount); } function getDetailsDone(response) { diff --git a/app/dashboard/static/js/app/view-jobs-job.2020.10.js b/app/dashboard/static/js/app/view-jobs-job.2020.10.js index bf35b8fec..c14f668a7 100644 --- a/app/dashboard/static/js/app/view-jobs-job.2020.10.js +++ b/app/dashboard/static/js/app/view-jobs-job.2020.10.js @@ -25,7 +25,6 @@ require([ 'utils/error', 'utils/table', 'utils/urls', - 'charts/passrate', 'utils/html', 'tables/job', 'URI', @@ -47,93 +46,6 @@ require([ gNumberRange = 20; - function getTestStatsFail() { - html.replaceContent( - document.getElementById('test-pass-rate'), - html.errorDiv('Error loading test data.')); - } - - function getTestStatsDone(response) { - chart.testpassrate('test-pass-rate', response); - } - - function getTestStats(startDate, dateRange) { - var data; - - data = { - job: gJobName, - sort: 'created_on', - sort_order: 1, - created_on: startDate, - date_range: dateRange, - field: ['status', 'kernel', 'created_on', 'job'], - nfield: ['_id'] - }; - - $.when(r.get('/_ajax/test/case', data)) - .fail(e.error, getTestStatsFail) - .done(getTestStatsDone); - } - - function getBuildsStatsFail() { - html.replaceContent( - document.getElementById('build-pass-rate'), - html.errorDiv('Error loading build data.')); - } - - function getBuildsStatsDone(response) { - chart.buildpassrate('build-pass-rate', response); - } - - function getBuildsStats(startDate, dateRange) { - var data; - - data = { - job: gJobName, - sort: 'created_on', - sort_order: 1, - created_on: startDate, - date_range: dateRange, - field: ['status', 'kernel', 'created_on', 'job'], - nfield: ['_id'] - }; - - $.when(r.get('/_ajax/build', data)) - .fail(e.error, getBuildsStatsFail) - .done(getBuildsStatsDone); - } - - function getTrendsData(response) { - var firstDate; - var lDateRange; - var lastDate; - var resLen; - var results; - - results = response.result; - resLen = results.length; - lDateRange = 0; - - if (resLen > 0) { - firstDate = new Date(results[0].created_on.$date); - if (resLen > 1) { - lastDate = new Date(results[resLen - 1].created_on.$date); - lDateRange = Math.round((firstDate - lastDate) / 86400000); - } - - getBuildsStats(firstDate.toCustomISODate(), lDateRange); - getTestStats(firstDate.toCustomISODate(), lDateRange); - } else { - html.replaceContent( - document.getElementById('build-pass-rate'), - html.errorDiv('No build data available.')); - - html.replaceContent( - document.getElementById('test-pass-rate'), - html.errorDiv('No test data available.')); - } - } - function getBuildTestCountFail() { html.replaceByClass('count-badge', '∞'); } @@ -496,8 +408,8 @@ require([ $.when(r.get('/_ajax/build', data)) .fail( e.error, - getBuildsFailed, getBuildsStatsFail, getTestStatsFail) - .done(getTrendsData, getBuildsDone, getBuildTestCount); + getBuildsFailed) + .done(getBuildsDone, getBuildTestCount); } function getDetailsDone(response) {