Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 1 | /** |
| 2 | * Controller for bmc-reboot |
| 3 | * |
| 4 | * @module app/overview |
| 5 | * @exports bmcRebootController |
| 6 | * @name bmcRebootController |
| 7 | * @version 0.1.0 |
| 8 | */ |
| 9 | |
| 10 | window.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 Islam | 5536812 | 2017-03-27 09:46:50 -0500 | [diff] [blame] | 20 | function($scope, $window, APIUtils, dataService){ |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 21 | $scope.dataService = dataService; |
Iftekharul Islam | 5536812 | 2017-03-27 09:46:50 -0500 | [diff] [blame] | 22 | $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 Islam | f3f7a5f | 2017-03-27 13:53:24 -0500 | [diff] [blame^] | 32 | //@NOTE: using common event to reload server status, may be a better event listener name? |
| 33 | $scope.$emit('user-logged-in',{}); |
Iftekharul Islam | 5536812 | 2017-03-27 09:46:50 -0500 | [diff] [blame] | 34 | }); |
| 35 | }; |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 36 | } |
| 37 | ] |
| 38 | ); |
| 39 | |
| 40 | })(angular); |