blob: 9899eed57bf73cfbdaf82b8931abb06cf1379748 [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
Iftekharul Islam99d199f2017-03-24 15:28:25 -05007 */
8
9window.angular && (function (angular) {
10 'use strict';
11
12 angular
Iftekharul Islamcd789502017-04-19 14:37:55 -050013 .module('app.serverControl')
Iftekharul Islam99d199f2017-03-24 15:28:25 -050014 .controller('bmcRebootController', [
Gunnar Millseedefd32018-02-28 17:02:34 -060015 '$scope',
16 '$window',
17 'APIUtils',
Iftekharul Islam99d199f2017-03-24 15:28:25 -050018 'dataService',
Iftekharul Islam55368122017-03-27 09:46:50 -050019 function($scope, $window, APIUtils, dataService){
Iftekharul Islam99d199f2017-03-24 15:28:25 -050020 $scope.dataService = dataService;
Iftekharul Islam55368122017-03-27 09:46:50 -050021 $scope.confirm = false;
22 $scope.rebootConfirm = function(){
23 if($scope.confirm) {
24 return;
25 }
26 $scope.confirm = true;
27 };
28 $scope.reboot = function(){
CamVan Nguyend80c2802018-04-17 19:25:16 -050029 dataService.setUnreachableState();
Iftekharul Islam55368122017-03-27 09:46:50 -050030 APIUtils.bmcReboot(function(response){
Iftekharul Islamf3f7a5f2017-03-27 13:53:24 -050031 //@NOTE: using common event to reload server status, may be a better event listener name?
32 $scope.$emit('user-logged-in',{});
Iftekharul Islam55368122017-03-27 09:46:50 -050033 });
34 };
Iftekharul Islam99d199f2017-03-24 15:28:25 -050035 }
36 ]
37 );
38
39})(angular);