diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-02-28 17:29:34 +0100 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-02-28 17:29:34 +0100 |
| commit | 04b66da25740e569f9d66e21077a1e998b9f9d0f (patch) | |
| tree | 8524bd14eebb990d342c5032027a442f432c5f5a | |
| parent | 1f397cf0c6a4f177c9f66e4a0f4d2274f26ae5be (diff) | |
Edit machine details
| -rw-r--r-- | client/js/controllers/home/machineDetails.js | 24 | ||||
| -rw-r--r-- | client/js/controllers/home/main.js | 2 | ||||
| -rw-r--r-- | client/partials/home/machineDetails.html | 38 |
3 files changed, 59 insertions, 5 deletions
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); } diff --git a/client/partials/home/machineDetails.html b/client/partials/home/machineDetails.html index 9da131e..5e33a53 100644 --- a/client/partials/home/machineDetails.html +++ b/client/partials/home/machineDetails.html @@ -22,9 +22,45 @@ <label class="control-label col-sm-2" for="pwd">State</label> <div class="col-sm-10"> Offline - <button class="btn btn-success">Turn On</button> + + <button class="btn btn-danger" ng-if="machine.online" ng-click="toggleMachineState()">Turn Off</button> + <button class="btn btn-success" ng-if="!machine.online" ng-click="toggleMachineState()">Turn On</button> + <span class="glyphicon glyphicon-refresh" aria-hidden="true" id="waitingForToggleMachine"></span> + + </div> </div> + <fieldset class="form-group"> + <label class="control-label col-sm-2">RAM</label> + <select class="col-sm-20" id="ramSelected"> + <option>128 MB</option> + <option>512 MB</option> + <option>1024 MB</option> + <option>2048 MB</option> + <option>4096 MB</option> + </select> + </fieldset> + + <fieldset class="form-group"> + <label class="control-label col-sm-2">Disk</label> + <select class="col-sm-20" id="ramSelected"> + <option>1 Go</option> + <option>2 Go</option> + <option>5 Go</option> + <option>10 Go</option> + <option>25 Go</option> + <option>50 Go</option> + <option>100 Go</option> + <option>150 Go</option> + <option>200 Go</option> + </select> + </fieldset> + + + + + + </form> |
