Added BMC reboot functionality

Change-Id: I1fe5a9f2f1079760396044eff2bf8f3eaef25bff
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
diff --git a/app/overview/controllers/bmc-reboot-controller.html b/app/overview/controllers/bmc-reboot-controller.html
index 22df0c2..b847624 100644
--- a/app/overview/controllers/bmc-reboot-controller.html
+++ b/app/overview/controllers/bmc-reboot-controller.html
@@ -8,7 +8,7 @@
     </div>
 
     <div class="row column btm-border-grey bmc-reboot-option"
-         ng-class="{transitionAll: confirm && immediately_confirm}">
+         ng-class="{disabled: confirm || dataService.loading, transitionAll: confirm}">
         <ul>
             <li>Rebooting the BMC causes your browser to lose contact with the BMC for several minutes.</li>
             <li>When the BMC software has started, you can then log in again.</li>
@@ -16,10 +16,12 @@
                 BMC’s address and log in again.
             </li>
         </ul>
-        <button id="bmc__reboot" class="btn-secondary" ng-click="bmcRebootConfirm()"><i>&#x21BB</i> Reboot BMC
+        <button id="bmc__reboot" class="btn-secondary" ng-click="rebootConfirm()"><i>&#x21BB</i> Reboot BMC
         </button>
         <confirm title="Reboot the BMC"
                  message="Rebooting the BMC causes your browser to lose contact with the BMC for several minutes."
-                 confirm="bmcReboot_confirm" cancel="bmcRebootCancel"></confirm>
+                 confirm="confirm"
+                 ng-show="confirm"
+                 callback="reboot"></confirm>
     </div>
 </div>
diff --git a/app/overview/controllers/bmc-reboot-controller.js b/app/overview/controllers/bmc-reboot-controller.js
index 040b444..5ed1b58 100644
--- a/app/overview/controllers/bmc-reboot-controller.js
+++ b/app/overview/controllers/bmc-reboot-controller.js
@@ -17,8 +17,25 @@
             '$window', 
             'APIUtils', 
             'dataService',
-            function($scope, $window, APIUtils, dataService, userModel){
+            function($scope, $window, APIUtils, dataService){
                 $scope.dataService = dataService;
+                $scope.confirm = false;
+                $scope.rebootConfirm = function(){
+                    if($scope.confirm) {
+                        return;
+                    }
+                    $scope.confirm = true;
+                };
+                $scope.reboot = function(){
+                    dataService.setBootingState();
+                    APIUtils.bmcReboot(function(response){
+                        if(response){
+                            dataService.setPowerOnState();
+                        }else{
+                            dataService.setUnreachableState();
+                        }
+                    });
+                };
             }
         ]
     );