blob: 06097b86ffe5c6453562c685c3ad3e396b5508e1 [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
Andrew Geisslerba5e3f32018-05-24 10:58:00 -07009window.angular && (function(angular) {
10 'use strict';
Iftekharul Islam99d199f2017-03-24 15:28:25 -050011
Andrew Geisslerd27bb132018-05-24 11:07:27 -070012 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 ]);
Iftekharul Islam99d199f2017-03-24 15:28:25 -050033
34})(angular);