summaryrefslogtreecommitdiffstats
path: root/app/server-control/controllers/bmc-reboot-controller.js
blob: 3106823eabbcdddd8d1cc697ba3f99d52d502466 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
 * Controller for bmc-reboot
 *
 * @module app/serverControl
 * @exports bmcRebootController
 * @name bmcRebootController
 * @version 0.1.0
 */

window.angular && (function (angular) {
    'use strict';

    angular
        .module('app.serverControl')
        .controller('bmcRebootController', [
            '$scope',
            '$window',
            'APIUtils',
            'dataService',
            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.setUnreachableState();
                    APIUtils.bmcReboot(function(response){
                        //@NOTE: using common event to reload server status, may be a better event listener name?
                        $scope.$emit('user-logged-in',{});
                    });
                };
            }
        ]
    );

})(angular);
OpenPOWER on IntegriCloud