diff options
author | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-08-04 15:38:04 +0100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-08-04 15:38:04 +0100 |
commit | f98cac21e3de11cf0bbeeebbe2a216981af9449e (patch) | |
tree | 2d737f304670cfd4e738d373c9fbe8c30d209f17 | |
parent | b32e8a6df8df2417894a13d19b7a831a613e5f83 (diff) |
testreporter: added support for bug list
Some other changes:
- possible to change tag name
- progress/loading indication in reports
Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
-rw-r--r-- | static/testreporter/main.js | 103 | ||||
-rw-r--r-- | static/testreporter/public.js | 9 | ||||
-rw-r--r-- | static/testreporter/templates/index.html | 11 | ||||
-rw-r--r-- | static/testreporter/templates/report.html | 22 | ||||
-rw-r--r-- | static/testreporter/templates/report_private.html | 24 | ||||
-rw-r--r-- | static/testreporter/templates/report_public.html | 16 | ||||
-rw-r--r-- | testmanager/testreporter/urls.py | 1 | ||||
-rw-r--r-- | testmanager/testreporter/views.py | 35 |
8 files changed, 163 insertions, 58 deletions
diff --git a/static/testreporter/main.js b/static/testreporter/main.js index d5dcd5e..6d493c5 100644 --- a/static/testreporter/main.js +++ b/static/testreporter/main.js @@ -1,60 +1,83 @@ APP.config(['$routeProvider', function($routeProvider) { $routeProvider - .when('/', { - templateUrl: '/static/testreporter/templates/index.html', - controller: 'Index' - }) - .when('/new', { - templateUrl: '/static/testreporter/templates/tag_form.html', - controller: 'New' - }) - .when('/:id', { - templateUrl: '/static/testreporter/templates/report_private.html', - controller: 'Report' - }); + .when('/', { + templateUrl: '/static/testreporter/templates/index.html', + controller: 'Index' + }) + .when('/new', { + templateUrl: '/static/testreporter/templates/tag_form.html', + controller: 'New' + }) + .when('/:id', { + templateUrl: '/static/testreporter/templates/report_private.html', + controller: 'Report' + }); }]); -function Index($scope, $window, $routeParams, Tag) { - $scope.tags = Tag.query(); +function Index($scope, $window, $routeParams, Tag){ + $scope.tags_progress = true; + $scope.tags = Tag.query(function(){ + $scope.tags_progress = false; + }); + //$scope.tags_progress = false; - $scope.remove = function(tag) { - Tag.remove({id:tag.id}, function() { - $scope.tags = Tag.query(); - }); - }; + $scope.remove = function(tag) { + Tag.remove({id:tag.id}, function() { + $scope.tags = Tag.query(); + }); + }; } function Report($scope, $window, $routeParams, $http, $sce, Tag) { - $scope.tag = Tag.get({id:$routeParams.id}, function() { - $scope.description_markup = $sce.trustAsHtml($scope.tag.description_markup); - }) + $scope.tag_progress = true; + $scope.data_progress = true; + $scope.bugs_progress = true; + $scope.tag = Tag.get({id:$routeParams.id}, function() { + $scope.description_markup = $sce.trustAsHtml($scope.tag.description_markup); + $scope.tag_progress = false; + }) - $scope.testRunUrl = function(testrun_id) { + $scope.testRunUrl = function(testrun_id) { $window.location.pathname = "/testmanualrunner/#/testrun/" + testrun_id + "/"; } $http.get('/testreporter/report/'+ $routeParams.id +'/').success(function(data) { - $scope.data = data; - }); + $scope.data = data; + $scope.data_progress = false; + }); - $scope.submit = function() { - Tag.update({id:$scope.tag.id}, $scope.tag) - } + $http.get('/testreporter/report/'+ $routeParams.id +'/bugs/').success(function(data) { + $scope.bugs = data.bugs; + $scope.bugs_progress = false; + }); + + $scope.submit = function() { + Tag.update( + {id:$scope.tag.id}, + $scope.tag, + function(success) { + }, + function(error) { + debugger + $scope.error = error.data + } + ) + } } function New($scope, $window, $routeParams, $location, Tag) { - $scope.tag = {}; - $scope.submit = function() { - Tag.save( - $scope.tag, - function() { - $location.path('/'); - }, - function(error) { - $scope.error = error.data - } - ) - } + $scope.tag = {}; + $scope.submit = function() { + Tag.save( + $scope.tag, + function() { + $location.path('/'); + }, + function(error) { + $scope.error = error.data + } + ) + } } diff --git a/static/testreporter/public.js b/static/testreporter/public.js index 42369e8..dc07022 100644 --- a/static/testreporter/public.js +++ b/static/testreporter/public.js @@ -7,11 +7,20 @@ APP.config(['$routeProvider', function($routeProvider) { }]); function Report($scope, $window, $routeParams, $http, $sce, $location, Tag) { + $scope.tag_progress = true; + $scope.data_progress = true; + $scope.bugs_progress = false; $scope.tag = Tag.get({id:$routeParams.id}, function() { + $scope.tag_progress = false; $scope.description_markup = $sce.trustAsHtml($scope.tag.description_markup); }) $http.get('/testreporter/report/'+ $routeParams.id +'/').success(function(data) { $scope.data = data; + $scope.data_progress = false; + }); + $http.get('/testreporter/report/'+ $routeParams.id +'/bugs/').success(function(data) { + $scope.bugs = data.bugs; + $scope.bugs_progress = false; }); $scope.testRunUrl = function(testrun_id) { $window.location.pathname = "/testmanualrunner/#/testrun/" + testrun_id + "/"; diff --git a/static/testreporter/templates/index.html b/static/testreporter/templates/index.html index 69ee04d..cf7dbab 100644 --- a/static/testreporter/templates/index.html +++ b/static/testreporter/templates/index.html @@ -12,12 +12,14 @@ </div> - <table class="table table-striped"> + <h1 ng-hide="!tags_progress" class="center-block"><span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> Loading...</h1> + <table ng-hide="tags_progress" class="table table-striped"> <thead> <tr> <th>#</th> <th>Name</th> <th></th> + <th></th> </tr> </thead> <tbody> @@ -25,8 +27,13 @@ <td><a ng-href="#//tag.id//">//tag.id//</a></td> <td class="text-left"> <span title="builds attached" class="badge">//tag.builds.length//</span> - <a ng-href="#//tag.id//">//tag.name//</a> + <a ng-href="public/#//tag.id//">//tag.name//</a> </td> + <td> + <a ng-href="#//tag.id//"> + <span class="glyphicon glyphicon-edit"></span> + </a> + </td> <td> <a href="" ng-click="tag.to_remove = true" ng-hide="tag.to_remove"> <span class="pull-right glyphicon glyphicon-trash"></span> diff --git a/static/testreporter/templates/report.html b/static/testreporter/templates/report.html index d39a35c..38c7e6f 100644 --- a/static/testreporter/templates/report.html +++ b/static/testreporter/templates/report.html @@ -1,6 +1,5 @@ <div class="row"> <div class="col-lg-12"> - <h1> Bulshit! </h1> <h2>Builds</h2> <table class="table"> @@ -50,7 +49,6 @@ <hr/> <h2>Manual Testruns</h2> -some bulshit <table class="table"> <thead> <tr> @@ -62,11 +60,29 @@ some bulshit </thead> <tbody> <tr ng-repeat="testrun in data.testruns"> - <td><span ng-click="testRunUrl(testrun.id); " class="text-primary">//testrun.test_plan.name// (//testrun.id//)</span></td> + <td><span ng-click="testRunUrl(testrun.id); " class="text-primary" style="pointer: hand">//testrun.test_plan.name// (//testrun.id//)</span></td> <td ng-repeat="name in testrun.result">// name[1] //</td> </tr> </tbody> </table> + <h2>Known Issues:</h2> + <table class="table"> + <thead> + <tr> + <th>Bug Tracker</th> + <th>Title</th> + <th>Status</th> + </tr> + </thead> + <tbody> + <tr ng-repeat="bug in bugs"> + <td>// bug.tracker // (<a href="//bug.web_link//">// bug.alias //</a>)</td> + <td><a href="//bug.web_link//">// bug.summary //</td> + <td>// bug.status // | // bug.severity //</td> + </tr> + </tbody> + </table> + </div> </div> diff --git a/static/testreporter/templates/report_private.html b/static/testreporter/templates/report_private.html index 1c833d9..6ec1b5d 100644 --- a/static/testreporter/templates/report_private.html +++ b/static/testreporter/templates/report_private.html @@ -1,13 +1,18 @@ -<div class="row"> +<div ng-hide="!tag_progress" class="row ng-hide"> + <div class="col-lg-12"> + <h1 class="center-block"><span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> Loading...</h1> + </div> +</div> +<div ng-hide="tag_progress" class="row ng-hide"> <div class="col-lg-12"> + <form role="form" ng-submit="submit()" > <div class="page-header"> - <h1>Report: <small>"//data.tag.name//"</small></h1> + <label>Tag name:</label> + <span class="help-inline" ng-bind="error.0"></span> + <input class="form-control" ng-model="tag.name" /> </div> - - <form role="form" ng-submit="submit()" > - <div class="form-group" ng-class="{'has-error':error.description}"> <label>Description:</label> <span class="help-inline" ng-bind="error.description"></span> @@ -17,10 +22,15 @@ <button type="submit" class="btn btn-default btn-sm pull-right input-sm"> Save </button> - + </form> </div> </div> -<div ng-include="'/static/testreporter/templates/report.html'"></div> +<div ng-hide="!data_progress" class="row ng-hide"> + <div class="col-lg-12"> + <h1 class="center-block"><span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> Loading...</h1> + </div> +</div> +<div ng-hide="data_progress" ng-include="'/static/testreporter/templates/report.html'"></div> diff --git a/static/testreporter/templates/report_public.html b/static/testreporter/templates/report_public.html index 58052a6..f7cdb48 100644 --- a/static/testreporter/templates/report_public.html +++ b/static/testreporter/templates/report_public.html @@ -1,10 +1,15 @@ -<div class="row"> +<div ng-hide="!tag_progress" class="row ng-hide"> + <div class="col-lg-12"> + <h1 class="center-block"><span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> Loading...</h1> + </div> +</div> +<div ng-hide="tag_progress" class="row"> <div class="col-lg-12"> <div class="page-header"> <h1>Report: <small>"//data.tag.name//"</small></h1> </div> - + <p class="lead" data-ng-bind-html="description_markup"> //data.tag.description// </p> @@ -12,4 +17,9 @@ </div> </div> -<div ng-include="'/static/testreporter/templates/report.html'"></div> +<div ng-hide="!data_progress" class="row ng-hide"> + <div class="col-lg-12"> + <h1 class="center-block"><span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> Loading...</h1> + </div> +</div> +<div ng-hide="data_progress" ng-include="'/static/testreporter/templates/report.html'"></div> diff --git a/testmanager/testreporter/urls.py b/testmanager/testreporter/urls.py index 8a724d0..aceed6d 100644 --- a/testmanager/testreporter/urls.py +++ b/testmanager/testreporter/urls.py @@ -8,4 +8,5 @@ urlpatterns = [ url(r'^public/$', views.Public.as_view()), url(r'^report/(?P<tag_id>[0-9]+)/$', views.Report_View.as_view()), + url(r'^report/(?P<tag_id>[0-9]+)/bugs/$', views.Report_Bugs_View.as_view()), ] diff --git a/testmanager/testreporter/views.py b/testmanager/testreporter/views.py index 91f2639..f51e64e 100644 --- a/testmanager/testreporter/views.py +++ b/testmanager/testreporter/views.py @@ -22,9 +22,22 @@ from rest_framework.views import APIView from rest_framework.response import Response from testmanager.views import LoginRequiredMixin -from testmanager.testrunner.models import JenkinsBuild, LavaJob, Tag -from testmanager.testrunner.serializers import BuildSerializer, TagSerializer, LavaJobSerializer -from testmanager.testmanualrunner.models import TestRun +from testmanager.testrunner.models import ( + JenkinsBuild, + LavaJob, + Tag, + Bug +) +from testmanager.testrunner.serializers import ( + BuildSerializer, + TagSerializer, + LavaJobSerializer, + BugSerializer +) +from testmanager.testmanualrunner.models import ( + TestRun, + TestRunResult +) from testmanager.testmanualrunner.serializers import TestRunSerializer @@ -51,3 +64,19 @@ class Report_View(APIView): "testruns": TestRunSerializer(testruns).data, }) + +class Report_Bugs_View(APIView): + + def get(self, request, tag_id, format=None): + + tag = Tag.objects.get(id=tag_id) + builds = JenkinsBuild.objects.filter(tags=tag) + lava_jobs = LavaJob.objects.filter(jenkins_build__in=builds) + testruns = TestRun.objects.filter(build__in=builds) + testrun_results = TestRunResult.objects.filter(test_run__in=testruns) + lava_job_bugs = Bug.objects.filter(lavajob__in=lava_jobs) + testruns_bugs = Bug.objects.filter(testrunresult__in=testrun_results) + + return Response({ + "bugs": BugSerializer(lava_job_bugs | testruns_bugs).data, + }) |