diff --git a/app/js/directives/artifact-summary.js b/app/js/directives/artifact-summary.js new file mode 100644 index 0000000..03b7f52 --- /dev/null +++ b/app/js/directives/artifact-summary.js @@ -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 + '\'">' + + ''; + + var e = $compile(tag)(scope); + el.append(e); + }); + }); + }); + }); + }; + + return { + restrict: 'EA', + scope: { + 'artifactName': '=' + }, + link: link + }; +} + +directivesModule.directive('artifactSummary', artifactSummary); diff --git a/app/js/directives/subunit-failures.js b/app/js/directives/subunit-failures.js new file mode 100644 index 0000000..f45a1f3 --- /dev/null +++ b/app/js/directives/subunit-failures.js @@ -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); diff --git a/app/js/directives/tempest-summary.js b/app/js/directives/subunit-summary.js similarity index 83% rename from app/js/directives/tempest-summary.js rename to app/js/directives/subunit-summary.js index ceddf41..26dd5cf 100644 --- a/app/js/directives/tempest-summary.js +++ b/app/js/directives/subunit-summary.js @@ -5,7 +5,7 @@ var directivesModule = require('./_index.js'); /** * @ngInject */ -function tempestSummary() { +function subunitSummary() { /** * Responsible for getting the basic run summary stats via the dataset service. @@ -26,12 +26,11 @@ function tempestSummary() { return { restrict: 'EA', scope: { - 'index': '=', 'artifactName': '=' }, controller: controller, - templateUrl: 'directives/tempest-summary.html' + templateUrl: 'directives/subunit-summary.html' }; } -directivesModule.directive('tempestSummary', tempestSummary); +directivesModule.directive('subunitSummary', subunitSummary); diff --git a/app/js/services/summary.js b/app/js/services/summary.js new file mode 100644 index 0000000..3477038 --- /dev/null +++ b/app/js/services/summary.js @@ -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); diff --git a/app/views/directives/subunit-failures.html b/app/views/directives/subunit-failures.html new file mode 100644 index 0000000..a9a72e5 --- /dev/null +++ b/app/views/directives/subunit-failures.html @@ -0,0 +1,17 @@ +
+
+

Failures

+
+
+ +

+ {{fail.name | split:'.' | slice:-2 | join:'.'}} +

+

+ {{line}} +

+
+ +
diff --git a/app/views/directives/tempest-summary.html b/app/views/directives/subunit-summary.html similarity index 66% rename from app/views/directives/tempest-summary.html rename to app/views/directives/subunit-summary.html index b02aca3..6046cbc 100644 --- a/app/views/directives/tempest-summary.html +++ b/app/views/directives/subunit-summary.html @@ -37,21 +37,3 @@
- -
-
-

Failures

-
-
- -

- {{fail.name | split:'.' | slice:-2 | join:'.'}} -

-

- {{line}} -

-
- -
diff --git a/app/views/home.html b/app/views/home.html index fb8ef08..8c2a11a 100644 --- a/app/views/home.html +++ b/app/views/home.html @@ -9,20 +9,18 @@
- No tempest datasets could be loaded! + No artifacts could be loaded!
- +
-
+
-

Additional Datasets

+

Other Artifacts

    @@ -32,15 +30,6 @@ ng-click="home.focus = group" style="cursor: pointer"> {{ group }} - - - - - Details -