Add regex filter to job page graphs
This commit add regex filters to the job page graphs. The graph's regex filter was introduced in the home/group page. However, I forgot to care about the job page at that time. Change-Id: If4bcebda66d83a26b9ef16429e1fca17ffedd918 Closes-Bug: #1590059
This commit is contained in:
parent
dcec891e5f
commit
6ebb2e932c
|
@ -29,7 +29,7 @@ function JobController(
|
||||||
vm.hold -= 1;
|
vm.hold -= 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.processData = function(data) {
|
vm.processData = function(data, regex) {
|
||||||
vm.chartData = [];
|
vm.chartData = [];
|
||||||
vm.chartDataRate = [];
|
vm.chartDataRate = [];
|
||||||
vm.tests = [];
|
vm.tests = [];
|
||||||
|
@ -38,12 +38,19 @@ function JobController(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pattern = null;
|
||||||
|
try {
|
||||||
|
pattern = new RegExp(regex);
|
||||||
|
} catch (e) {
|
||||||
|
pattern = '';
|
||||||
|
}
|
||||||
// prepare chart data
|
// prepare chart data
|
||||||
var tests = {};
|
var tests = {};
|
||||||
var passEntries = [];
|
var passEntries = [];
|
||||||
var failEntries = [];
|
var failEntries = [];
|
||||||
var skipEntries = [];
|
var skipEntries = [];
|
||||||
var failRateEntries = [];
|
var failRateEntries = [];
|
||||||
|
var DEFAULT_FAIL_RATE = 0;
|
||||||
|
|
||||||
var date = '';
|
var date = '';
|
||||||
for (date in data.tests) {
|
for (date in data.tests) {
|
||||||
|
@ -65,6 +72,9 @@ function JobController(
|
||||||
|
|
||||||
var testData = testsInDate[testName];
|
var testData = testsInDate[testName];
|
||||||
var cleanTestName = testService.removeIdNoise(testName);
|
var cleanTestName = testService.removeIdNoise(testName);
|
||||||
|
if (!pattern.test(cleanTestName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!tests[cleanTestName]) {
|
if (!tests[cleanTestName]) {
|
||||||
var testMetrics = {
|
var testMetrics = {
|
||||||
|
@ -115,9 +125,10 @@ function JobController(
|
||||||
y: totalFail
|
y: totalFail
|
||||||
});
|
});
|
||||||
|
|
||||||
|
failRate = totalFail / (totalFail + totalPass) || DEFAULT_FAIL_RATE;
|
||||||
failRateEntries.push({
|
failRateEntries.push({
|
||||||
x: new Date(date).getTime(),
|
x: new Date(date).getTime(),
|
||||||
y: totalFail / (totalFail + totalPass)
|
y: failRate
|
||||||
});
|
});
|
||||||
|
|
||||||
skipEntries.push({
|
skipEntries.push({
|
||||||
|
@ -153,7 +164,7 @@ function JobController(
|
||||||
stop_date: viewService.periodEnd(),
|
stop_date: viewService.periodEnd(),
|
||||||
datetime_resolution: viewService.resolution().key
|
datetime_resolution: viewService.resolution().key
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
vm.processData(response.data);
|
vm.processData(response.data, vm.searchTest);
|
||||||
vm.loaded = true;
|
vm.loaded = true;
|
||||||
});
|
});
|
||||||
healthService.getRecentGroupedRuns('build_name', vm.name).then(function(response) {
|
healthService.getRecentGroupedRuns('build_name', vm.name).then(function(response) {
|
||||||
|
@ -179,6 +190,7 @@ function JobController(
|
||||||
|
|
||||||
vm.onSearchChange = function() {
|
vm.onSearchChange = function() {
|
||||||
$location.search('searchTest', $scope.job.searchTest).replace();
|
$location.search('searchTest', $scope.job.searchTest).replace();
|
||||||
|
vm.loadData();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ function HealthService($http, config) {
|
||||||
service.getTestsFromBuildName = function(buildName, options) {
|
service.getTestsFromBuildName = function(buildName, options) {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/build_name/' + buildName + '/test_runs', {
|
return $http.jsonp(config.apiRoot + '/build_name/' + buildName + '/test_runs', {
|
||||||
|
cache: true,
|
||||||
params: angular.extend(options, { callback: 'JSON_CALLBACK' })
|
params: angular.extend(options, { callback: 'JSON_CALLBACK' })
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,8 +17,18 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading panel-controls">
|
||||||
<h3 class="panel-title">Tests</h3>
|
<h3 class="panel-title">Tests</h3>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-addon"><i class="fa fa-search"></i></div>
|
||||||
|
<input type="text"
|
||||||
|
class="form-control"
|
||||||
|
placeholder="Search for test with regex"
|
||||||
|
ng-model="job.searchTest"
|
||||||
|
ng-model-options="{debounce: 250}"
|
||||||
|
ng-change="job.onSearchChange()"
|
||||||
|
uib-tooltip="You can see {{job.tests.length}} test(s). Details are at the bottom.">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<chart-line data="job.chartData" width="100%" height="250"
|
<chart-line data="job.chartData" width="100%" height="250"
|
||||||
|
@ -26,8 +36,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading panel-controls">
|
||||||
<h3 class="panel-title">Tests Failure Rate</h3>
|
<h3 class="panel-title">Tests Failure Rate</h3>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-addon"><i class="fa fa-search"></i></div>
|
||||||
|
<input type="text"
|
||||||
|
class="form-control"
|
||||||
|
placeholder="Search for test with regex"
|
||||||
|
ng-model="job.searchTest"
|
||||||
|
ng-model-options="{debounce: 250}"
|
||||||
|
ng-change="job.onSearchChange()"
|
||||||
|
uib-tooltip="You can see {{job.tests.length}} test(s). Details are at the bottom.">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<chart-line data="job.chartDataRate" width="100%" height="250"
|
<chart-line data="job.chartDataRate" width="100%" height="250"
|
||||||
|
|
Loading…
Reference in New Issue