diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-09-04 10:37:43 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-18 09:04:25 +0100 |
commit | 09079f15c0511a6d17ce1cc29be6de5387e45f09 (patch) | |
tree | 91b79d3d830723f98fa45130cd28c163475360e5 /lib/toaster | |
parent | 24a8e9a5b0ba145ae589178d74365c986ebca325 (diff) | |
download | bitbake-09079f15c0511a6d17ce1cc29be6de5387e45f09.zip |
toaster: hide irrelevant builds in the project builds view
This patch fixes the project builds view so it doesn't show
"in progress" builds or builds for other projects.
Note that this also modifies the "all builds" view to use
the same queryset filtering as the project builds. This is
to avoid excluding "in progress" builds more than once, which
is what was happening before.
The patch also has a minor change to ensure that when
displaying the project builds page, only builds for that
project are in the results.
The queryset filtering is now split over several lines so
you can see what's going on.
[YOCTO #8236]
[YOCTO #8187]
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster')
-rwxr-xr-x | lib/toaster/toastergui/views.py | 54 |
1 files changed, 42 insertions, 12 deletions
diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py index e918b052..45a56117 100755 --- a/lib/toaster/toastergui/views.py +++ b/lib/toaster/toastergui/views.py @@ -1903,7 +1903,7 @@ if True: # be able to display something. 'count' and 'page' are mandatory for all views # that use paginators. - queryset = Build.objects.exclude(outcome = Build.IN_PROGRESS) + queryset = Build.objects.all() try: context, pagesize, orderby = _build_list_helper(request, queryset) @@ -1920,7 +1920,6 @@ if True: # helper function, to be used on "all builds" and "project builds" pages def _build_list_helper(request, queryset_all): - default_orderby = 'completed_on:-' (pagesize, orderby) = _get_parameters_values(request, 10, default_orderby) mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby } @@ -1931,11 +1930,42 @@ if True: # boilerplate code that takes a request for an object type and returns a queryset # for that object type. copypasta for all needed table searches (filter_string, search_term, ordering_string) = _search_tuple(request, Build) + # post-process any date range filters - filter_string,daterange_selected = _modify_date_range_filter(filter_string) - queryset_all = queryset_all.select_related("project").annotate(errors_no = Count('logmessage', only=Q(logmessage__level=LogMessage.ERROR)|Q(logmessage__level=LogMessage.EXCEPTION))).annotate(warnings_no = Count('logmessage', only=Q(logmessage__level=LogMessage.WARNING))).extra(select={'timespent':'completed_on - started_on'}) - queryset_with_search = _get_queryset(Build, queryset_all, None, search_term, ordering_string, '-completed_on') - queryset = _get_queryset(Build, queryset_all, filter_string, search_term, ordering_string, '-completed_on') + filter_string, daterange_selected = _modify_date_range_filter(filter_string) + + # don't show "in progress" builds in "all builds" or "project builds" + queryset_all = queryset_all.exclude(outcome = Build.IN_PROGRESS) + + # append project info + queryset_all = queryset_all.select_related("project") + + # annotate with number of ERROR and EXCEPTION log messages + queryset_all = queryset_all.annotate( + errors_no = Count( + 'logmessage', + only=Q(logmessage__level=LogMessage.ERROR) | + Q(logmessage__level=LogMessage.EXCEPTION) + ) + ) + + # annotate with number of warnings + q_warnings = Q(logmessage__level=LogMessage.WARNING) + queryset_all = queryset_all.annotate( + warnings_no = Count('logmessage', only=q_warnings) + ) + + # add timespent field + timespent = 'completed_on - started_on' + queryset_all = queryset_all.extra(select={'timespent': timespent}) + + queryset_with_search = _get_queryset(Build, queryset_all, + None, search_term, + ordering_string, '-completed_on') + + queryset = _get_queryset(Build, queryset_all, + filter_string, search_term, + ordering_string, '-completed_on') # retrieve the objects that will be displayed in the table; builds a paginator and gets a page range to display build_info = _build_page_range(Paginator(queryset, pagesize), request.GET.get('page', 1)) @@ -2658,7 +2688,7 @@ if True: if 'buildDelete' in request.POST: for i in request.POST['buildDelete'].strip().split(" "): try: - br = BuildRequest.objects.select_for_update().get(project = prj, pk = i, state__lte = BuildRequest.REQ_DELETED).delete() + BuildRequest.objects.select_for_update().get(project = prj, pk = i, state__lte = BuildRequest.REQ_DELETED).delete() except BuildRequest.DoesNotExist: pass @@ -2671,12 +2701,12 @@ if True: else: target = t task = "" - ProjectTarget.objects.create(project = prj, target = target, task = task) - - br = prj.schedule_build() - + ProjectTarget.objects.create(project = prj, + target = target, + task = task) + prj.schedule_build() - queryset = Build.objects.filter(outcome__lte = Build.IN_PROGRESS) + queryset = Build.objects.filter(project_id = pid) try: context, pagesize, orderby = _build_list_helper(request, queryset) |