summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorAlexandru Damian <alexandru.damian@intel.com>2015-02-17 15:02:26 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-20 12:58:19 +0000
commit9c358bd1d7a301e7aee3676871310d50c336ba07 (patch)
tree65374bdda59c43fa3277ed23045204c0f5b3c121 /bitbake/lib
parent6dbd214fdf8fa20f0e16e802b458e05c5a50a374 (diff)
downloadast2050-yocto-poky-9c358bd1d7a301e7aee3676871310d50c336ba07.zip
ast2050-yocto-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>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/orm/models.py2
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/projectapp.js24
-rw-r--r--bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html3
-rw-r--r--bitbake/lib/toaster/toastergui/templates/project.html2
4 files changed, 24 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index f70c006..0f85c8f 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -194,7 +194,7 @@ class Build(models.Model):
eta = timezone.now()
completeper = self.completeper()
if self.completeper() > 0:
- eta = timezone.now() + ((timezone.now() - self.started_on)*(100-completeper)/completeper)
+ eta += ((eta - self.started_on)*100)/completeper
return eta
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectapp.js b/bitbake/lib/toaster/toastergui/static/js/projectapp.js
index bee3c56..4d00f40 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() {
}
});
+// add "time to future" eta that computes time from now to a point in the future
+projectApp.filter('toeta', function() {
+ return function(input) {
+ var crtmiliseconds = new Date().getTime();
+ diff = (parseInt(input) - crtmiliseconds ) / 1000;
+ console.log("Debug: future time ", input, "crt time", crtmiliseconds, ":", diff);
+ return diff < 0 ? 300 : diff;
+ }
+});
+
/**
* main controller for the project page
*/
@@ -259,7 +269,14 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
var i = 0;
for (i = 0 ; i < $scope.builds.length; i ++) {
if ($scope.builds[i].id > elem.id) continue;
- if ($scope.builds[i].id == elem.id) { found=true; break;}
+ if ($scope.builds[i].id == elem.id) {
+ found=true;
+ // do deep data copy
+ for (var attr in elem) {
+ $scope.builds[i][attr] = elem[attr];
+ }
+ break;
+ }
if ($scope.builds[i].id < elem.id) break;
}
if (!found) {
@@ -272,8 +289,8 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
var found = false;
var i = 0;
for (i = 0; i < $scope.builds.length; i ++) {
- if ($scope.builds[i].id > elem.id) continue;
- if ($scope.builds[i].id == elem.id) { found=true; break;}
+ if ($scope.builds[i].id > elem.id) continue;
+ if ($scope.builds[i].id == elem.id) { found=true; break; }
if ($scope.builds[i].id < elem.id) break;
}
if (!found) {
@@ -281,6 +298,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
}
});
+
$scope.fetchLayersForTargets();
}
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 6f31ee0..b8d087a 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 @@
{% load projecttags %}
{% load humanize %}
-
-{%if len.mru > 0%}
+{%if mru|length > 0%}
<div class="page-header top-air">
<h1>
Latest builds
diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html
index 7da2361..a1cce33 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
<div style="width: {[b.build[0].completeper]}%;" class="bar"></div>
</div>
</div>
- <div class="text-right lead">ETA: {[b.build[0].eta|date:"HH:mm:ss"]}</div>
+ <div class="text-right lead">ETA in {[b.build[0].eta|toeta|timediff]}</div>
</case>
</case>
OpenPOWER on IntegriCloud