Merge "Add service to summarize different artifact types"
This commit is contained in:
37
app/js/directives/artifact-summary.js
Normal file
37
app/js/directives/artifact-summary.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var directivesModule = require('./_index.js');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ngInject
|
||||||
|
*/
|
||||||
|
function artifactSummary($compile, datasetService, summaryService) {
|
||||||
|
var link = function(scope, el, attrs, ctrl) {
|
||||||
|
scope.$watch('artifactName', function(artifactName) {
|
||||||
|
el.empty();
|
||||||
|
|
||||||
|
datasetService.artifacts(artifactName).then(function(artifacts) {
|
||||||
|
artifacts.forEach(function(artifact) {
|
||||||
|
summaryService.directivesForType(artifact.artifact_type).forEach(function(d) {
|
||||||
|
var name = d.directiveName;
|
||||||
|
var tag = '<' + name + ' artifact-name="\'' + artifactName + '\'">' +
|
||||||
|
'</' + name + '>';
|
||||||
|
|
||||||
|
var e = $compile(tag)(scope);
|
||||||
|
el.append(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
restrict: 'EA',
|
||||||
|
scope: {
|
||||||
|
'artifactName': '='
|
||||||
|
},
|
||||||
|
link: link
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
directivesModule.directive('artifactSummary', artifactSummary);
|
31
app/js/directives/subunit-failures.js
Normal file
31
app/js/directives/subunit-failures.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var directivesModule = require('./_index.js');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ngInject
|
||||||
|
*/
|
||||||
|
function subunitFailures() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ngInject
|
||||||
|
*/
|
||||||
|
var controller = function($scope, $attrs, datasetService) {
|
||||||
|
$scope.$watch('artifactName', function(artifactName) {
|
||||||
|
datasetService.artifact(artifactName, 'subunit-stats').then(function(response) {
|
||||||
|
$scope.stats = response.data;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
restrict: 'EA',
|
||||||
|
scope: {
|
||||||
|
'artifactName': '='
|
||||||
|
},
|
||||||
|
controller: controller,
|
||||||
|
templateUrl: 'directives/subunit-failures.html'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
directivesModule.directive('subunitFailures', subunitFailures);
|
@@ -5,7 +5,7 @@ var directivesModule = require('./_index.js');
|
|||||||
/**
|
/**
|
||||||
* @ngInject
|
* @ngInject
|
||||||
*/
|
*/
|
||||||
function tempestSummary() {
|
function subunitSummary() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responsible for getting the basic run summary stats via the dataset service.
|
* Responsible for getting the basic run summary stats via the dataset service.
|
||||||
@@ -26,12 +26,11 @@ function tempestSummary() {
|
|||||||
return {
|
return {
|
||||||
restrict: 'EA',
|
restrict: 'EA',
|
||||||
scope: {
|
scope: {
|
||||||
'index': '=',
|
|
||||||
'artifactName': '='
|
'artifactName': '='
|
||||||
},
|
},
|
||||||
controller: controller,
|
controller: controller,
|
||||||
templateUrl: 'directives/tempest-summary.html'
|
templateUrl: 'directives/subunit-summary.html'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
directivesModule.directive('tempestSummary', tempestSummary);
|
directivesModule.directive('subunitSummary', subunitSummary);
|
43
app/js/services/summary.js
Normal file
43
app/js/services/summary.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var servicesModule = require('./_index.js');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ngInject
|
||||||
|
*/
|
||||||
|
function SummaryService() {
|
||||||
|
var mappings = [];
|
||||||
|
|
||||||
|
var service = {
|
||||||
|
directivesForType: function(artifactType) {
|
||||||
|
return mappings.filter(function(mapping) {
|
||||||
|
return mapping.artifactType === artifactType;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
mapType: function(artifactType, directiveName, priority) {
|
||||||
|
if (typeof priority === 'undefined') {
|
||||||
|
priority = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mappings.push({
|
||||||
|
artifactType: artifactType,
|
||||||
|
directiveName: directiveName,
|
||||||
|
priority: priority
|
||||||
|
});
|
||||||
|
|
||||||
|
mappings.sort(function(a, b) {
|
||||||
|
return b.priority - a.priority;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// default mappings
|
||||||
|
service.mapType('subunit-stats', 'subunit-summary', 5);
|
||||||
|
service.mapType('subunit-stats', 'subunit-failures', 4);
|
||||||
|
service.mapType('console', 'console-summary', 5);
|
||||||
|
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
servicesModule.service('summaryService', SummaryService);
|
17
app/views/directives/subunit-failures.html
Normal file
17
app/views/directives/subunit-failures.html
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<div class="panel panel-danger" ng-if="stats.failures.length > 0">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">Failures</h3>
|
||||||
|
</div>
|
||||||
|
<div class="list-group">
|
||||||
|
<a class="list-group-item"
|
||||||
|
ng-repeat="fail in stats.failures"
|
||||||
|
ui-sref="testDetails({artifactName: artifactName, test: fail.name})">
|
||||||
|
<h4 class="list-group-item-heading">
|
||||||
|
{{fail.name | split:'.' | slice:-2 | join:'.'}}
|
||||||
|
</h4>
|
||||||
|
<p ng-repeat="line in fail.details" class="list-group-item-text">
|
||||||
|
{{line}}
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</ul>
|
||||||
|
</div>
|
@@ -37,21 +37,3 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel panel-danger" ng-if="stats.failures.length > 0">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title">Failures</h3>
|
|
||||||
</div>
|
|
||||||
<div class="list-group">
|
|
||||||
<a class="list-group-item"
|
|
||||||
ng-repeat="fail in stats.failures"
|
|
||||||
ui-sref="testDetails({artifactName: artifactName, test: fail.name})">
|
|
||||||
<h4 class="list-group-item-heading">
|
|
||||||
{{fail.name | split:'.' | slice:-2 | join:'.'}}
|
|
||||||
</h4>
|
|
||||||
<p ng-repeat="line in fail.details" class="list-group-item-text">
|
|
||||||
{{line}}
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
@@ -9,20 +9,18 @@
|
|||||||
<div class="row" ng-if="!home.groups.length">
|
<div class="row" ng-if="!home.groups.length">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
No tempest datasets could be loaded!
|
No artifacts could be loaded!
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row" ng-if="!!home.groups.length">
|
<div class="row" ng-if="!!home.groups.length">
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
<tempest-summary ng-if="home.groups.length >= 1"
|
<artifact-summary artifact-name="home.focus"></artifact-summary>
|
||||||
artifact-name="home.focus"
|
|
||||||
index="home.focus"></tempest-summary>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4" ng-if="home.datasets.length > 1">
|
<div class="col-lg-4" ng-if="home.groups.length > 1">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">Additional Datasets</h3>
|
<h3 class="panel-title">Other Artifacts</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
@@ -32,15 +30,6 @@
|
|||||||
ng-click="home.focus = group"
|
ng-click="home.focus = group"
|
||||||
style="cursor: pointer">
|
style="cursor: pointer">
|
||||||
{{ group }}
|
{{ group }}
|
||||||
|
|
||||||
<!--<small class="text-muted" style="font-size: 75%">
|
|
||||||
{{dataset.stats.start | date:'MM/d/yyyy'}}
|
|
||||||
</small>-->
|
|
||||||
|
|
||||||
<a class="btn btn-default btn-xs pull-right"
|
|
||||||
ui-sref="timeline({artifactName: group})">
|
|
||||||
Details
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user