blob: e01d66cd5aa920e1460ac00af901a208539380f9 [file] [log] [blame]
Iftekharul Islam99d199f2017-03-24 15:28:25 -05001/**
2 * Controller for bmc-reboot
3 *
4 * @module app/overview
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.overview')
15 .controller('bmcRebootController', [
16 '$scope',
17 '$window',
18 'APIUtils',
19 'dataService',
Iftekharul Islam55368122017-03-27 09:46:50 -050020 function($scope, $window, APIUtils, dataService){
Iftekharul Islam99d199f2017-03-24 15:28:25 -050021 $scope.dataService = dataService;
Iftekharul Islam55368122017-03-27 09:46:50 -050022 $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){
Iftekharul Islamf3f7a5f2017-03-27 13:53:24 -050032 //@NOTE: using common event to reload server status, may be a better event listener name?
33 $scope.$emit('user-logged-in',{});
Iftekharul Islam55368122017-03-27 09:46:50 -050034 });
35 };
Iftekharul Islam99d199f2017-03-24 15:28:25 -050036 }
37 ]
38 );
39
40})(angular);