Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 1 | /** |
| 2 | * Controller for bmc-reboot |
| 3 | * |
Iftekharul Islam | cd78950 | 2017-04-19 14:37:55 -0500 | [diff] [blame] | 4 | * @module app/serverControl |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 5 | * @exports bmcRebootController |
| 6 | * @name bmcRebootController |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | window.angular && (function (angular) { |
| 10 | 'use strict'; |
| 11 | |
| 12 | angular |
Iftekharul Islam | cd78950 | 2017-04-19 14:37:55 -0500 | [diff] [blame] | 13 | .module('app.serverControl') |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 14 | .controller('bmcRebootController', [ |
Gunnar Mills | eedefd3 | 2018-02-28 17:02:34 -0600 | [diff] [blame] | 15 | '$scope', |
| 16 | '$window', |
| 17 | 'APIUtils', |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 18 | 'dataService', |
Iftekharul Islam | 5536812 | 2017-03-27 09:46:50 -0500 | [diff] [blame] | 19 | function($scope, $window, APIUtils, dataService){ |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 20 | $scope.dataService = dataService; |
Iftekharul Islam | 5536812 | 2017-03-27 09:46:50 -0500 | [diff] [blame] | 21 | $scope.confirm = false; |
| 22 | $scope.rebootConfirm = function(){ |
| 23 | if($scope.confirm) { |
| 24 | return; |
| 25 | } |
| 26 | $scope.confirm = true; |
| 27 | }; |
| 28 | $scope.reboot = function(){ |
CamVan Nguyen | d80c280 | 2018-04-17 19:25:16 -0500 | [diff] [blame] | 29 | dataService.setUnreachableState(); |
Iftekharul Islam | 5536812 | 2017-03-27 09:46:50 -0500 | [diff] [blame] | 30 | APIUtils.bmcReboot(function(response){ |
Iftekharul Islam | f3f7a5f | 2017-03-27 13:53:24 -0500 | [diff] [blame] | 31 | //@NOTE: using common event to reload server status, may be a better event listener name? |
| 32 | $scope.$emit('user-logged-in',{}); |
Iftekharul Islam | 5536812 | 2017-03-27 09:46:50 -0500 | [diff] [blame] | 33 | }); |
| 34 | }; |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 35 | } |
| 36 | ] |
| 37 | ); |
| 38 | |
| 39 | })(angular); |