Merge "Add regex filter to job page graphs"
This commit is contained in:
commit
b9fddd5e9a
|
@ -29,7 +29,7 @@ function JobController(
|
|||
vm.hold -= 1;
|
||||
};
|
||||
|
||||
vm.processData = function(data) {
|
||||
vm.processData = function(data, regex) {
|
||||
vm.chartData = [];
|
||||
vm.chartDataRate = [];
|
||||
vm.tests = [];
|
||||
|
@ -38,12 +38,19 @@ function JobController(
|
|||
return;
|
||||
}
|
||||
|
||||
var pattern = null;
|
||||
try {
|
||||
pattern = new RegExp(regex);
|
||||
} catch (e) {
|
||||
pattern = '';
|
||||
}
|
||||
// prepare chart data
|
||||
var tests = {};
|
||||
var passEntries = [];
|
||||
var failEntries = [];
|
||||
var skipEntries = [];
|
||||
var failRateEntries = [];
|
||||
var DEFAULT_FAIL_RATE = 0;
|
||||
|
||||
var date = '';
|
||||
for (date in data.tests) {
|
||||
|
@ -65,6 +72,9 @@ function JobController(
|
|||
|
||||
var testData = testsInDate[testName];
|
||||
var cleanTestName = testService.removeIdNoise(testName);
|
||||
if (!pattern.test(cleanTestName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!tests[cleanTestName]) {
|
||||
var testMetrics = {
|
||||
|
@ -115,9 +125,10 @@ function JobController(
|
|||
y: totalFail
|
||||
});
|
||||
|
||||
failRate = totalFail / (totalFail + totalPass) || DEFAULT_FAIL_RATE;
|
||||
failRateEntries.push({
|
||||
x: new Date(date).getTime(),
|
||||
y: totalFail / (totalFail + totalPass)
|
||||
y: failRate
|
||||
});
|
||||
|
||||
skipEntries.push({
|
||||
|
@ -153,7 +164,7 @@ function JobController(
|
|||
stop_date: viewService.periodEnd(),
|
||||
datetime_resolution: viewService.resolution().key
|
||||
}).then(function(response) {
|
||||
vm.processData(response.data);
|
||||
vm.processData(response.data, vm.searchTest);
|
||||
vm.loaded = true;
|
||||
});
|
||||
healthService.getRecentGroupedRuns('build_name', vm.name).then(function(response) {
|
||||
|
@ -179,6 +190,7 @@ function JobController(
|
|||
|
||||
vm.onSearchChange = function() {
|
||||
$location.search('searchTest', $scope.job.searchTest).replace();
|
||||
vm.loadData();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ function HealthService($http, config) {
|
|||
service.getTestsFromBuildName = function(buildName, options) {
|
||||
return config.get().then(function(config) {
|
||||
return $http.jsonp(config.apiRoot + '/build_name/' + buildName + '/test_runs', {
|
||||
cache: true,
|
||||
params: angular.extend(options, { callback: 'JSON_CALLBACK' })
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,8 +17,18 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-heading panel-controls">
|
||||
<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 class="panel-body">
|
||||
<chart-line data="job.chartData" width="100%" height="250"
|
||||
|
@ -26,8 +36,18 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-heading panel-controls">
|
||||
<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 class="panel-body">
|
||||
<chart-line data="job.chartDataRate" width="100%" height="250"
|
||||
|
|
Loading…
Reference in New Issue