diff options
author | Alexandru Damian <alexandru.damian@intel.com> | 2015-02-17 15:02:26 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-02-20 12:58:19 +0000 |
commit | 9c358bd1d7a301e7aee3676871310d50c336ba07 (patch) | |
tree | 65374bdda59c43fa3277ed23045204c0f5b3c121 | |
parent | 6dbd214fdf8fa20f0e16e802b458e05c5a50a374 (diff) | |
download | poky-9c358bd1d7a301e7aee3676871310d50c336ba07.tar.gz |
bitbake: toasterui: fix time estimation in project page
This patch fixes the time estimation to build completion
in project page. Additionally it fixes the Most Recent Builds
section used in various pages in managed mode, and proper
time to build estimation in all pages.
[YOCTO #7004]
(Bitbake rev: 5fecfda0e47c2ecba9b7c903c6d258eefa431aa0)
Signed-off-by: Alexandru Damian <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
4 files changed, 24 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index f70c0066ad..0f85c8fd0a 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -194,7 +194,7 @@ class Build(models.Model): | |||
194 | eta = timezone.now() | 194 | eta = timezone.now() |
195 | completeper = self.completeper() | 195 | completeper = self.completeper() |
196 | if self.completeper() > 0: | 196 | if self.completeper() > 0: |
197 | eta = timezone.now() + ((timezone.now() - self.started_on)*(100-completeper)/completeper) | 197 | eta += ((eta - self.started_on)*100)/completeper |
198 | return eta | 198 | return eta |
199 | 199 | ||
200 | 200 | ||
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectapp.js b/bitbake/lib/toaster/toastergui/static/js/projectapp.js index bee3c56be2..4d00f40ff1 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectapp.js +++ b/bitbake/lib/toaster/toastergui/static/js/projectapp.js | |||
@@ -136,6 +136,16 @@ projectApp.filter('timediff', function() { | |||
136 | } | 136 | } |
137 | }); | 137 | }); |
138 | 138 | ||
139 | // add "time to future" eta that computes time from now to a point in the future | ||
140 | projectApp.filter('toeta', function() { | ||
141 | return function(input) { | ||
142 | var crtmiliseconds = new Date().getTime(); | ||
143 | diff = (parseInt(input) - crtmiliseconds ) / 1000; | ||
144 | console.log("Debug: future time ", input, "crt time", crtmiliseconds, ":", diff); | ||
145 | return diff < 0 ? 300 : diff; | ||
146 | } | ||
147 | }); | ||
148 | |||
139 | /** | 149 | /** |
140 | * main controller for the project page | 150 | * main controller for the project page |
141 | */ | 151 | */ |
@@ -259,7 +269,14 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
259 | var i = 0; | 269 | var i = 0; |
260 | for (i = 0 ; i < $scope.builds.length; i ++) { | 270 | for (i = 0 ; i < $scope.builds.length; i ++) { |
261 | if ($scope.builds[i].id > elem.id) continue; | 271 | if ($scope.builds[i].id > elem.id) continue; |
262 | if ($scope.builds[i].id == elem.id) { found=true; break;} | 272 | if ($scope.builds[i].id == elem.id) { |
273 | found=true; | ||
274 | // do deep data copy | ||
275 | for (var attr in elem) { | ||
276 | $scope.builds[i][attr] = elem[attr]; | ||
277 | } | ||
278 | break; | ||
279 | } | ||
263 | if ($scope.builds[i].id < elem.id) break; | 280 | if ($scope.builds[i].id < elem.id) break; |
264 | } | 281 | } |
265 | if (!found) { | 282 | if (!found) { |
@@ -272,8 +289,8 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
272 | var found = false; | 289 | var found = false; |
273 | var i = 0; | 290 | var i = 0; |
274 | for (i = 0; i < $scope.builds.length; i ++) { | 291 | for (i = 0; i < $scope.builds.length; i ++) { |
275 | if ($scope.builds[i].id > elem.id) continue; | 292 | if ($scope.builds[i].id > elem.id) continue; |
276 | if ($scope.builds[i].id == elem.id) { found=true; break;} | 293 | if ($scope.builds[i].id == elem.id) { found=true; break; } |
277 | if ($scope.builds[i].id < elem.id) break; | 294 | if ($scope.builds[i].id < elem.id) break; |
278 | } | 295 | } |
279 | if (!found) { | 296 | if (!found) { |
@@ -281,6 +298,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc | |||
281 | } | 298 | } |
282 | }); | 299 | }); |
283 | 300 | ||
301 | |||
284 | $scope.fetchLayersForTargets(); | 302 | $scope.fetchLayersForTargets(); |
285 | } | 303 | } |
286 | if (_data.targets !== undefined) { | 304 | if (_data.targets !== undefined) { |
diff --git a/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html b/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html index 6f31ee0239..b8d087ab6c 100644 --- a/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html +++ b/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html | |||
@@ -2,8 +2,7 @@ | |||
2 | {% load projecttags %} | 2 | {% load projecttags %} |
3 | {% load humanize %} | 3 | {% load humanize %} |
4 | 4 | ||
5 | 5 | {%if mru|length > 0%} | |
6 | {%if len.mru > 0%} | ||
7 | <div class="page-header top-air"> | 6 | <div class="page-header top-air"> |
8 | <h1> | 7 | <h1> |
9 | Latest builds | 8 | Latest builds |
diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html index 7da2361460..a1cce33222 100644 --- a/bitbake/lib/toaster/toastergui/templates/project.html +++ b/bitbake/lib/toaster/toastergui/templates/project.html | |||
@@ -196,7 +196,7 @@ vim: expandtab tabstop=2 | |||
196 | <div style="width: {[b.build[0].completeper]}%;" class="bar"></div> | 196 | <div style="width: {[b.build[0].completeper]}%;" class="bar"></div> |
197 | </div> | 197 | </div> |
198 | </div> | 198 | </div> |
199 | <div class="text-right lead">ETA: {[b.build[0].eta|date:"HH:mm:ss"]}</div> | 199 | <div class="text-right lead">ETA in {[b.build[0].eta|toeta|timediff]}</div> |
200 | </case> | 200 | </case> |
201 | </case> | 201 | </case> |
202 | 202 | ||