Edit machine details

This commit is contained in:
manzerbredes 2016-02-28 17:29:34 +01:00
parent 1f397cf0c6
commit 04b66da257
3 changed files with 59 additions and 5 deletions

View file

@ -3,11 +3,11 @@
*
* @param {$scope} $scope The $scope service from angular
*/
mainApp.controller('machineDetailsCtrl', [ '$scope', 'Compute', '$rootScope', function ($scope, Compute, $rootScope)
mainApp.controller('machineDetailsCtrl', [ '$scope', 'Compute', '$rootScope', '$timeout', function ($scope, Compute, $rootScope, $timeout)
{
$scope.machine={};
$("#waitingForToggleMachine").hide();
$scope.$on('showMachineDetailsEvent', function(eventName ,machine){
$scope.machine=machine;
@ -15,6 +15,24 @@ mainApp.controller('machineDetailsCtrl', [ '$scope', 'Compute', '$rootScope', fu
});
$scope.toggleMachineState=function(){
$("#waitingForToggleMachine").show();
// Fake timeout
$timeout(function(){
$("#waitingForToggleMachine").hide();
}, 1000);
$timeout(function(){
$scope.machine.online=!$scope.machine.online;
}, 1000);
};
$scope.applyModifications=function(){
//Todo
}

View file

@ -14,7 +14,7 @@ mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', function ($s
Compute.pullData(updatePage);
$scope.raiseShowMachineDetailsEvent=function(){
var machine={name: "Machine 1"};
var machine={name: "Machine 1", online:true};
$rootScope.$broadcast("showMachineDetailsEvent", machine);
}