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