1/**
2 * Controller for bmc-reboot
3 *
4 * @module app/serverControl
5 * @exports bmcRebootController
6 * @name bmcRebootController
7 */
8
9window.angular && (function (angular) {
10    'use strict';
11
12    angular
13        .module('app.serverControl')
14        .controller('bmcRebootController', [
15            '$scope',
16            '$window',
17            'APIUtils',
18            'dataService',
19            function($scope, $window, APIUtils, dataService){
20                $scope.dataService = dataService;
21                $scope.confirm = false;
22                $scope.rebootConfirm = function(){
23                    if($scope.confirm) {
24                        return;
25                    }
26                    $scope.confirm = true;
27                };
28                $scope.reboot = function(){
29                    dataService.setUnreachableState();
30                    APIUtils.bmcReboot(function(response){
31                        //@NOTE: using common event to reload server status, may be a better event listener name?
32                        $scope.$emit('user-logged-in',{});
33                    });
34                };
35            }
36        ]
37    );
38
39})(angular);
40