1/** 2 * Controller for bmc-reboot 3 * 4 * @module app/serverControl 5 * @exports bmcRebootController 6 * @name bmcRebootController 7 */ 8 9window.angular && (function(angular) { 10 'use strict'; 11 12 angular.module('app.serverControl').controller('bmcRebootController', [ 13 '$scope', '$window', 'APIUtils', 'dataService', 14 function($scope, $window, APIUtils, dataService) { 15 $scope.dataService = dataService; 16 $scope.confirm = false; 17 $scope.rebootConfirm = function() { 18 if ($scope.confirm) { 19 return; 20 } 21 $scope.confirm = true; 22 }; 23 $scope.reboot = function() { 24 dataService.setUnreachableState(); 25 APIUtils.bmcReboot(function(response) { 26 //@NOTE: using common event to reload server status, may be a better 27 // event listener name? 28 $scope.$emit('user-logged-in', {}); 29 }); 30 }; 31 } 32 ]); 33 34})(angular); 35