From 9c358bd1d7a301e7aee3676871310d50c336ba07 Mon Sep 17 00:00:00 2001 From: Alexandru Damian Date: Tue, 17 Feb 2015 15:02:26 +0000 Subject: 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 Signed-off-by: Richard Purdie --- .../lib/toaster/toastergui/static/js/projectapp.js | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'bitbake/lib/toaster/toastergui/static/js/projectapp.js') 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() { } }); +// 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) { -- cgit v1.2.3-54-g00ecf