blob: f5e0923d7cd8cf869f2411ea41dc4631a6558c1e [file] [log] [blame]
Iftekharul Islam99d199f2017-03-24 15:28:25 -05001/**
2 * Controller for bmc-reboot
3 *
Iftekharul Islamcd789502017-04-19 14:37:55 -05004 * @module app/serverControl
Iftekharul Islam99d199f2017-03-24 15:28:25 -05005 * @exports bmcRebootController
6 * @name bmcRebootController
7 * @version 0.1.0
8 */
9
10window.angular && (function (angular) {
11 'use strict';
12
13 angular
Iftekharul Islamcd789502017-04-19 14:37:55 -050014 .module('app.serverControl')
Iftekharul Islam99d199f2017-03-24 15:28:25 -050015 .controller('bmcRebootController', [
Gunnar Millseedefd32018-02-28 17:02:34 -060016 '$scope',
17 '$window',
18 'APIUtils',
Iftekharul Islam99d199f2017-03-24 15:28:25 -050019 '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);