summaryrefslogtreecommitdiffstats
path: root/app/server-control/controllers/bmc-reboot-controller.js
blob: 2282627d16698f1122703ce50a704b63abb92e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
 * Controller for bmc-reboot
 *
 * @module app/serverControl
 * @exports bmcRebootController
 * @name bmcRebootController
 */

window.angular && (function(angular) {
  'use strict';

  angular.module('app.serverControl').controller('bmcRebootController', [
    '$scope', '$window', 'APIUtils', 'dataService', 'toastService',
    function($scope, $window, APIUtils, dataService, toastService) {
      $scope.dataService = dataService;
      $scope.confirm = false;
      APIUtils.getLastRebootTime().then(
          function(data) {
            $scope.reboot_time = data.data;
          },
          function(error) {
            console.log(JSON.stringify(error));
          });
      $scope.rebootConfirm = function() {
        if ($scope.confirm) {
          return;
        }
        $scope.confirm = true;
      };
      $scope.reboot = function() {
        APIUtils.bmcReboot().then(
            function(response) {
              toastService.success('BMC is rebooting.')
            },
            function(error) {
              console.log(JSON.stringify(error));
              toastService.error('Unable to reboot BMC.');
            });
      };
    }
  ]);
})(angular);
OpenPOWER on IntegriCloud