Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dashboard/templates: Remove graphs from jobs-job{-branch} templates #144

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 2 additions & 98 deletions app/dashboard/static/js/app/view-jobs-job-branch.2020.10.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ require([
'utils/error',
'utils/table',
'utils/urls',
'charts/passrate',
'utils/html',
'tables/job',
'URI',
Expand All @@ -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', '∞');
}
Expand Down Expand Up @@ -460,8 +364,8 @@ require([
$.when(deferred)
.fail(
e.error,
getBuildsFailed, getBuildsStatsFail, getTestStatsFail)
.done(getTrendsData, getBuildsDone, getBuildTestsCount);
getBuildsFailed)
.done(getBuildsDone, getBuildTestsCount);
}

function getDetailsDone(response) {
Expand Down
92 changes: 2 additions & 90 deletions app/dashboard/static/js/app/view-jobs-job.2020.10.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ require([
'utils/error',
'utils/table',
'utils/urls',
'charts/passrate',
'utils/html',
'tables/job',
'URI',
Expand All @@ -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', '∞');
}
Expand Down Expand Up @@ -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) {
Expand Down
33 changes: 0 additions & 33 deletions app/dashboard/templates/jobs-job-branch.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,39 +62,6 @@ <h3>Available Kernels</h3>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="page-header">
<h3>Trends</h3>
</div>
<div>
<h4>Build Pass Rate</h4>
<div id="build-pass-rate">
<div class="pull-center">
<span id="build-count">
<small>
<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>
&nbsp;calculating build pass rate&hellip;
</small>
</span>
</div>
</div>
</div>
<div>
<h4>Test Pass Rate</h4>
<div id="test-pass-rate">
<div class="pull-center">
<span id="test-count">
<small>
<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>
&nbsp;calculating test pass rate&hellip;
</small>
</span>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" id="job-name" value="{{ job_name }}">
<input type="hidden" id="search-filter" value="{{ search_filter }}">
<input type="hidden" id="page-len" value="{{ page_len }}">
Expand Down
33 changes: 0 additions & 33 deletions app/dashboard/templates/jobs-job.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,39 +62,6 @@ <h3>Available Kernels</h3>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="page-header">
<h3>Trends</h3>
</div>
<div>
<h4>Build Pass Rate</h4>
<div id="build-pass-rate">
<div class="pull-center">
<span id="build-count">
<small>
<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>
&nbsp;calculating build pass rate&hellip;
</small>
</span>
</div>
</div>
</div>
<div>
<h4>Test Pass Rate</h4>
<div id="test-pass-rate">
<div class="pull-center">
<span id="test-count">
<small>
<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>
&nbsp;calculating test pass rate&hellip;
</small>
</span>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" id="job-name" value="{{ job }}">
<input type="hidden" id="search-filter" value="{{ search_filter }}">
<input type="hidden" id="page-len" value="{{ page_len }}">
Expand Down