From dda2f07193e740860f4497c3761d340d8c5c2b41 Mon Sep 17 00:00:00 2001 From: Dave Lerner Date: Sat, 14 Mar 2015 09:00:15 -0500 Subject: toaster: most-build-targets bug fixes Fixes for the following for the "Most built targets" section of the project page: 1) limit the number of most built targets to 5, 2) order the list of most built targets by build count, 3) select only those builds that had build status of 'fail', 'success', or a BuildRequest of 'failed', 4) if there are no layers in the project then (on refresh) all of the checkboxes in the 'Most built targets' list are disabled. Note that per agreement with UI designer, the only sort on the most target list is build count as described in (3) above; secondary sorting is random. [YOCTO #7177] Signed-off-by: Dave Lerner --- lib/toaster/toastergui/static/js/projectapp.js | 19 +++++++++++++++++++ lib/toaster/toastergui/templates/project.html | 7 ++++--- lib/toaster/toastergui/views.py | 6 +++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/lib/toaster/toastergui/static/js/projectapp.js b/lib/toaster/toastergui/static/js/projectapp.js index 26e054dc2..0b6e0126d 100644 --- a/lib/toaster/toastergui/static/js/projectapp.js +++ b/lib/toaster/toastergui/static/js/projectapp.js @@ -484,11 +484,13 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc layerAdd: selectedArray.join(","), } }).then(function () { + $scope.adjustMostBuiltItems(selectedArray.length); $scope.layerAddName = undefined; }); }); } else { + $scope.adjustMostBuiltItems(1); $scope._makeXHRCall({ method: "POST", url: $scope.urls.xhr_edit, data: { @@ -503,6 +505,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc }; $scope.layerDel = function(id) { + $scope.adjustMostBuiltItems(-1); $scope._makeXHRCall({ method: "POST", url: $scope.urls.xhr_edit, data: { @@ -511,6 +514,14 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc }); }; + $scope.adjustMostBuiltItems = function(listDelta) { + $scope.layerCount += listDelta; + $scope.mutedtargets = ($scope.layerCount == 0 ? "muted" : ""); + }; + +/* +*/ + /** * Verifies if a project settings change would trigger layer updates. If user confirmation is needed, @@ -799,6 +810,14 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc return keys.length === 0; }; + $scope.disableBuildCheckbox = function(t) { + if ( $scope.layerCount == 0 ) { + $scope.mostBuiltTargets[t] = 0; + return true; + }; + return false; + } + $scope.buildSelectedTargets = function () { var keys = Object.keys($scope.mostBuiltTargets); keys = keys.filter(function (e) { if ($scope.mostBuiltTargets[e]) return e; }); diff --git a/lib/toaster/toastergui/templates/project.html b/lib/toaster/toastergui/templates/project.html index 40048c2f2..9d51a5720 100644 --- a/lib/toaster/toastergui/templates/project.html +++ b/lib/toaster/toastergui/templates/project.html @@ -328,10 +328,10 @@ vim: expandtab tabstop=2

Most built targets

-