code added to toggle server LED label text
Change-Id: I714810ed1924f91a6e8c426e66b47eaf93311dd1
Signed-off-by: Michael Davis <michael.s.davis@ibm.com>
diff --git a/app/server-health/controllers/unit-id-controller.js b/app/server-health/controllers/unit-id-controller.js
index fa47781..5494c61 100644
--- a/app/server-health/controllers/unit-id-controller.js
+++ b/app/server-health/controllers/unit-id-controller.js
@@ -19,6 +19,26 @@
'dataService',
function($scope, $window, APIUtils, dataService, userModel){
$scope.dataService = dataService;
+
+ $scope.getLEDState = function(){
+ APIUtils.getLEDState(function(state){
+ if(state == APIUtils.LED_STATE.on){
+ dataService.LED_state = APIUtils.LED_STATE_TEXT.on;
+ }else{
+ dataService.LED_state = APIUtils.LED_STATE_TEXT.off;
+ }
+ });
+ }
+ $scope.toggleLED = function(){
+ var toggleState = (dataService.LED_state == APIUtils.LED_STATE_TEXT.on) ?
+ APIUtils.LED_STATE.off : APIUtils.LED_STATE.on;
+ dataService.LED_state = (dataService.LED_state == APIUtils.LED_STATE_TEXT.on) ?
+ APIUtils.LED_STATE_TEXT.off : APIUtils.LED_STATE_TEXT.on;
+ APIUtils.setLEDState(toggleState, function(status){
+ });
+ }
+
+ $scope.getLEDState();
}
]
);