From: Michael Wood Date: Tue, 21 Apr 2015 10:38:03 +0000 (+0100) Subject: bitbake: toaster: projectapp Implement machine select command X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4cfca604b2c5ab35baf69c2070afa0087842b68;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git bitbake: toaster: projectapp Implement machine select command Use the project page to select the machine rather than setting it and then redirecting to the project page. This will also avoid having to have a special handler in the machines page it's self. (Bitbake rev: 9847e04d86063e4464afb402cb1352243b51f504) Signed-off-by: Michael Wood Signed-off-by: Richard Purdie --- diff --git a/bitbake/lib/toaster/toastergui/static/js/projectapp.js b/bitbake/lib/toaster/toastergui/static/js/projectapp.js index d52ba73f3d1..1fd4a54f57f 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectapp.js +++ b/bitbake/lib/toaster/toastergui/static/js/projectapp.js @@ -424,6 +424,24 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc $scope.layerAddId = item.id; }; + $scope.machineSelect = function (machineName) { + $scope._makeXHRCall({ + method: "POST", url: $scope.urls.xhr_edit, + data: { + machineName: machineName, + } + }).then(function () { + $scope.machine.name = machineName; + + $scope.displayAlert($scope.zone2alerts, "You have changed the machine to: " + $scope.machine.name + "", "alert-info"); + var machineDistro = angular.element("#machine-distro"); + + angular.element("html, body").animate({ scrollTop: machineDistro.position().top }, 700).promise().done(function() { + $animate.addClass(machineDistro, "machines-highlight"); + }); + }); + }; + $scope.layerAddById = function (id) { $scope.layerAddId = id; @@ -752,7 +770,9 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc _cmdExecuteWithParam("/machineselect=", function (machine) { $scope.machineName = machine; - $scope.toggle('#select-machine'); + $scope.machine.name = machine; + $scope.machineSelect(machine); + });