1cd789508SIftekharul Islam/** 2cd789508SIftekharul Islam * Controller for bmc-reboot 3cd789508SIftekharul Islam * 4cd789508SIftekharul Islam * @module app/serverControl 5cd789508SIftekharul Islam * @exports bmcRebootController 6cd789508SIftekharul Islam * @name bmcRebootController 7cd789508SIftekharul Islam */ 8cd789508SIftekharul Islam 9cd789508SIftekharul Islamwindow.angular && (function(angular) { 10cd789508SIftekharul Islam 'use strict'; 11cd789508SIftekharul Islam 12d27bb135SAndrew Geissler angular.module('app.serverControl').controller('bmcRebootController', [ 13*c57ec32fSDixsie Wolmers '$scope', '$window', 'APIUtils', 'dataService', 'toastService', 14*c57ec32fSDixsie Wolmers function($scope, $window, APIUtils, dataService, toastService) { 15cd789508SIftekharul Islam $scope.dataService = dataService; 16cd789508SIftekharul Islam $scope.confirm = false; 17bfc99907Sbeccabroek APIUtils.getLastRebootTime().then( 18bfc99907Sbeccabroek function(data) { 19bfc99907Sbeccabroek $scope.reboot_time = data.data; 20bfc99907Sbeccabroek }, 21bfc99907Sbeccabroek function(error) { 22bfc99907Sbeccabroek console.log(JSON.stringify(error)); 23bfc99907Sbeccabroek }); 24cd789508SIftekharul Islam $scope.rebootConfirm = function() { 25cd789508SIftekharul Islam if ($scope.confirm) { 26cd789508SIftekharul Islam return; 27cd789508SIftekharul Islam } 28cd789508SIftekharul Islam $scope.confirm = true; 29cd789508SIftekharul Islam }; 30cd789508SIftekharul Islam $scope.reboot = function() { 31*c57ec32fSDixsie Wolmers APIUtils.bmcReboot().then( 32*c57ec32fSDixsie Wolmers function(response) { 33*c57ec32fSDixsie Wolmers toastService.success('BMC is rebooting.') 34*c57ec32fSDixsie Wolmers }, 35*c57ec32fSDixsie Wolmers function(error) { 36*c57ec32fSDixsie Wolmers console.log(JSON.stringify(error)); 37*c57ec32fSDixsie Wolmers toastService.error('Unable to reboot BMC.'); 38cd789508SIftekharul Islam }); 39cd789508SIftekharul Islam }; 40cd789508SIftekharul Islam } 41ba5e3f34SAndrew Geissler ]); 42cd789508SIftekharul Islam})(angular); 43