From 04b66da25740e569f9d66e21077a1e998b9f9d0f Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 28 Feb 2016 17:29:34 +0100 Subject: Edit machine details --- client/js/controllers/home/machineDetails.js | 24 +++++++++++++++++++++--- client/js/controllers/home/main.js | 2 +- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'client/js') diff --git a/client/js/controllers/home/machineDetails.js b/client/js/controllers/home/machineDetails.js index 43cfe07..3ee4625 100644 --- a/client/js/controllers/home/machineDetails.js +++ b/client/js/controllers/home/machineDetails.js @@ -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 + } diff --git a/client/js/controllers/home/main.js b/client/js/controllers/home/main.js index 3d57f8d..6545c1a 100644 --- a/client/js/controllers/home/main.js +++ b/client/js/controllers/home/main.js @@ -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); } -- cgit v1.2.3