blob: 2282627d16698f1122703ce50a704b63abb92e53 [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', [
Dixsie Wolmersc57ec322019-04-26 12:58:51 -050013 '$scope', '$window', 'APIUtils', 'dataService', 'toastService',
14 function($scope, $window, APIUtils, dataService, toastService) {
Andrew Geisslerd27bb132018-05-24 11:07:27 -070015 $scope.dataService = dataService;
16 $scope.confirm = false;
beccabroekbfc99902018-07-24 15:36:33 -050017 APIUtils.getLastRebootTime().then(
18 function(data) {
19 $scope.reboot_time = data.data;
20 },
21 function(error) {
22 console.log(JSON.stringify(error));
23 });
Andrew Geisslerd27bb132018-05-24 11:07:27 -070024 $scope.rebootConfirm = function() {
25 if ($scope.confirm) {
26 return;
27 }
28 $scope.confirm = true;
29 };
30 $scope.reboot = function() {
Dixsie Wolmersc57ec322019-04-26 12:58:51 -050031 APIUtils.bmcReboot().then(
32 function(response) {
33 toastService.success('BMC is rebooting.')
34 },
35 function(error) {
36 console.log(JSON.stringify(error));
37 toastService.error('Unable to reboot BMC.');
38 });
Andrew Geisslerd27bb132018-05-24 11:07:27 -070039 };
40 }
41 ]);
Iftekharul Islam99d199f2017-03-24 15:28:25 -050042})(angular);