diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-01-15 13:00:52 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-15 16:28:50 +0000 |
commit | d6df4545bd134a23c9bd3cd1ba3b61ddb26545e4 (patch) | |
tree | 3c6825cc0956bd903947cd8fb66d6590ce7b3808 /lib/toaster/toastergui/tables.py | |
parent | 7347ad0d4baace593751b44a86ab8e11a04a02b6 (diff) | |
download | bitbake-d6df4545bd134a23c9bd3cd1ba3b61ddb26545e4.tar.gz |
toastergui: show recent builds on all builds page
The recent builds section was disabled while converting the
all builds page to ToasterTable.
Re-enable the recent builds area and add the data it requires
to the ToasterTable context.
[YOCTO #8738]
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster/toastergui/tables.py')
-rw-r--r-- | lib/toaster/toastergui/tables.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/toaster/toastergui/tables.py b/lib/toaster/toastergui/tables.py index a0991ec3e..094163770 100644 --- a/lib/toaster/toastergui/tables.py +++ b/lib/toaster/toastergui/tables.py @@ -27,6 +27,7 @@ from django.db.models import Q, Max, Count from django.conf.urls import url from django.core.urlresolvers import reverse from django.views.generic import TemplateView +import itertools from toastergui.tablefilter import TableFilter, TableFilterActionToggle @@ -887,7 +888,22 @@ class BuildsTable(ToasterTable): self.static_context_extra['Task'] = Task def get_context_data(self, **kwargs): - return super(BuildsTable, self).get_context_data(**kwargs) + context = super(BuildsTable, self).get_context_data(**kwargs) + + # for the latest builds section + queryset = Build.objects.all() + + finished_criteria = Q(outcome=Build.SUCCEEDED) | Q(outcome=Build.FAILED) + + latest_builds = itertools.chain( + queryset.filter(outcome=Build.IN_PROGRESS).order_by("-started_on"), + queryset.filter(finished_criteria).order_by("-completed_on")[:3] + ) + + context['mru'] = list(latest_builds) + context['mrb_type'] = 'all' + + return context def setup_queryset(self, *args, **kwargs): queryset = Build.objects.all() |