diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui')
-rw-r--r-- | bitbake/lib/toaster/toastergui/tables.py | 33 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/mrb_section.html | 7 | ||||
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 2 |
3 files changed, 18 insertions, 24 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index ba2726d070..7fb3f8605e 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py | |||
@@ -28,7 +28,6 @@ from django.conf.urls import url | |||
28 | from django.core.urlresolvers import reverse, resolve | 28 | from django.core.urlresolvers import reverse, resolve |
29 | from django.http import HttpResponse | 29 | from django.http import HttpResponse |
30 | from django.views.generic import TemplateView | 30 | from django.views.generic import TemplateView |
31 | import itertools | ||
32 | 31 | ||
33 | from toastergui.tablefilter import TableFilter | 32 | from toastergui.tablefilter import TableFilter |
34 | from toastergui.tablefilter import TableFilterActionToggle | 33 | from toastergui.tablefilter import TableFilterActionToggle |
@@ -1060,17 +1059,9 @@ class BuildsTable(ToasterTable): | |||
1060 | def get_context_data(self, **kwargs): | 1059 | def get_context_data(self, **kwargs): |
1061 | context = super(BuildsTable, self).get_context_data(**kwargs) | 1060 | context = super(BuildsTable, self).get_context_data(**kwargs) |
1062 | 1061 | ||
1063 | # for the latest builds section | 1062 | # should be set in subclasses |
1064 | builds = self.get_builds() | 1063 | context['mru'] = [] |
1065 | 1064 | ||
1066 | finished_criteria = Q(outcome=Build.SUCCEEDED) | Q(outcome=Build.FAILED) | ||
1067 | |||
1068 | latest_builds = itertools.chain( | ||
1069 | builds.filter(outcome=Build.IN_PROGRESS).order_by("-started_on"), | ||
1070 | builds.filter(finished_criteria).order_by("-completed_on")[:3] | ||
1071 | ) | ||
1072 | |||
1073 | context['mru'] = list(latest_builds) | ||
1074 | context['mrb_type'] = self.mrb_type | 1065 | context['mrb_type'] = self.mrb_type |
1075 | 1066 | ||
1076 | return context | 1067 | return context |
@@ -1481,6 +1472,12 @@ class AllBuildsTable(BuildsTable): | |||
1481 | static_data_name='project', | 1472 | static_data_name='project', |
1482 | static_data_template=project_template) | 1473 | static_data_template=project_template) |
1483 | 1474 | ||
1475 | def get_context_data(self, **kwargs): | ||
1476 | """ Get all builds for the recent builds area """ | ||
1477 | context = super(AllBuildsTable, self).get_context_data(**kwargs) | ||
1478 | context['mru'] = Build.get_recent() | ||
1479 | return context | ||
1480 | |||
1484 | class ProjectBuildsTable(BuildsTable): | 1481 | class ProjectBuildsTable(BuildsTable): |
1485 | """ | 1482 | """ |
1486 | Builds page for a single project; a BuildsTable, with the queryset | 1483 | Builds page for a single project; a BuildsTable, with the queryset |
@@ -1521,18 +1518,16 @@ class ProjectBuildsTable(BuildsTable): | |||
1521 | 1518 | ||
1522 | def get_context_data(self, **kwargs): | 1519 | def get_context_data(self, **kwargs): |
1523 | """ | 1520 | """ |
1521 | Get recent builds for this project, and the project itself | ||
1522 | |||
1524 | NOTE: self.project_id must be set before calling super(), | 1523 | NOTE: self.project_id must be set before calling super(), |
1525 | as it's used in get_context_data() | 1524 | as it's used in get_context_data() |
1526 | """ | 1525 | """ |
1527 | self.project_id = kwargs['pid'] | 1526 | self.project_id = kwargs['pid'] |
1528 | |||
1529 | context = super(ProjectBuildsTable, self).get_context_data(**kwargs) | 1527 | context = super(ProjectBuildsTable, self).get_context_data(**kwargs) |
1530 | context['project'] = Project.objects.get(pk=self.project_id) | ||
1531 | |||
1532 | return context | ||
1533 | |||
1534 | def get_builds(self): | ||
1535 | """ override: only return builds for the relevant project """ | ||
1536 | 1528 | ||
1537 | project = Project.objects.get(pk=self.project_id) | 1529 | project = Project.objects.get(pk=self.project_id) |
1538 | return Build.objects.filter(project=project) | 1530 | context['mru'] = Build.get_recent(project) |
1531 | context['project'] = project | ||
1532 | |||
1533 | return context | ||
diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html b/bitbake/lib/toaster/toastergui/templates/mrb_section.html index 2e5eb5050b..da1253e1d5 100644 --- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html +++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html | |||
@@ -165,7 +165,6 @@ $(document).ready(function(){ | |||
165 | progressTimer = window.setInterval(function() { | 165 | progressTimer = window.setInterval(function() { |
166 | libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl, | 166 | libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl, |
167 | function(prjInfo){ | 167 | function(prjInfo){ |
168 | |||
169 | /* These two are needed because a build can be 100% and still | 168 | /* These two are needed because a build can be 100% and still |
170 | * in progress due to the fact that the % done is updated at the | 169 | * in progress due to the fact that the % done is updated at the |
171 | * start of a task so it can be doing the last task at 100% | 170 | * start of a task so it can be doing the last task at 100% |
@@ -176,18 +175,18 @@ $(document).ready(function(){ | |||
176 | for (var i in prjInfo.builds){ | 175 | for (var i in prjInfo.builds){ |
177 | var build = prjInfo.builds[i]; | 176 | var build = prjInfo.builds[i]; |
178 | 177 | ||
179 | if (build.status === "In Progress" || | 178 | if (build.outcome === "In Progress" || |
180 | $(".progress .bar").length > 0){ | 179 | $(".progress .bar").length > 0){ |
181 | /* Update the build progress */ | 180 | /* Update the build progress */ |
182 | var percentDone; | 181 | var percentDone; |
183 | 182 | ||
184 | if (build.status !== "In Progress"){ | 183 | if (build.outcome !== "In Progress"){ |
185 | /* We have to ignore the value when it's Succeeded because it | 184 | /* We have to ignore the value when it's Succeeded because it |
186 | * goes back to 0 | 185 | * goes back to 0 |
187 | */ | 186 | */ |
188 | percentDone = 100; | 187 | percentDone = 100; |
189 | } else { | 188 | } else { |
190 | percentDone = build.build[0].completeper; | 189 | percentDone = build.percentDone; |
191 | inProgress++; | 190 | inProgress++; |
192 | } | 191 | } |
193 | 192 | ||
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 9ad2746881..da73d43c4f 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -2008,7 +2008,7 @@ if True: | |||
2008 | "completedbuilds": Build.objects.exclude(outcome = Build.IN_PROGRESS).filter(project_id = pid), | 2008 | "completedbuilds": Build.objects.exclude(outcome = Build.IN_PROGRESS).filter(project_id = pid), |
2009 | "prj" : {"name": prj.name, }, | 2009 | "prj" : {"name": prj.name, }, |
2010 | "buildrequests" : prj.build_set.filter(outcome=Build.IN_PROGRESS), | 2010 | "buildrequests" : prj.build_set.filter(outcome=Build.IN_PROGRESS), |
2011 | #"builds" : _project_recent_build_list(prj), | 2011 | "builds" : Build.get_recent(prj), |
2012 | "layers" : map(lambda x: { | 2012 | "layers" : map(lambda x: { |
2013 | "id": x.layercommit.pk, | 2013 | "id": x.layercommit.pk, |
2014 | "orderid": x.pk, | 2014 | "orderid": x.pk, |