From 3c5e2917604315775eebe7e62a560a853e5b1c58 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Fri, 13 Mar 2015 14:34:41 +0000 Subject: bitbake: toaster: Add cancel build to latest build section Add this functionality to the common managed_mrb_section Make sure we are using the correct version of this template in the projects template and remove now redundant code. [YOCTO #7351] (Bitbake rev: 23f1439a5d3e8f4053826794c6502eca20189054) Signed-off-by: Michael Wood Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/views.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'bitbake/lib/toaster/toastergui/views.py') diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 661023e523..26c876080d 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -1871,8 +1871,7 @@ if toastermain.settings.MANAGED: # build view-specific information; this is rendered specifically in the builds page, at the top of the page (i.e. Recent builds) # most recent build is like projects' most recent builds, but across all projects - build_mru = BuildRequest.objects.all() - build_mru = list(build_mru.filter(Q(state__lt=BuildRequest.REQ_COMPLETED) or Q(state=BuildRequest.REQ_DELETED)).order_by("-pk")) + list(build_mru.filter(state__in=[BuildRequest.REQ_COMPLETED, BuildRequest.REQ_FAILED]).order_by("-pk")[:3]) + build_mru = _managed_get_latest_builds() fstypes_map = {}; for build_request in build_info: @@ -3130,6 +3129,12 @@ if toastermain.settings.MANAGED: } return render(request, "unavailable_artifact.html", context) + # This returns the mru object that is needed for the + # managed_mrb_section.html template + def _managed_get_latest_builds(): + build_mru = BuildRequest.objects.all() + build_mru = list(build_mru.filter(Q(state__lt=BuildRequest.REQ_COMPLETED) or Q(state=BuildRequest.REQ_DELETED)).order_by("-pk")) + list(build_mru.filter(state__in=[BuildRequest.REQ_COMPLETED, BuildRequest.REQ_FAILED]).order_by("-pk")[:3]) + return build_mru def projects(request): @@ -3153,7 +3158,7 @@ if toastermain.settings.MANAGED: project_info = _build_page_range(Paginator(queryset, pagesize), request.GET.get('page', 1)) # build view-specific information; this is rendered specifically in the builds page, at the top of the page (i.e. Recent builds) - build_mru = Build.objects.order_by("-started_on")[:3] + build_mru = _managed_get_latest_builds() # translate the project's build target strings fstypes_map = {}; -- cgit v1.2.3-54-g00ecf