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 12*d27bb135SAndrew Geissler angular.module('app.serverControl').controller('bmcRebootController', [ 13*d27bb135SAndrew Geissler '$scope', '$window', 'APIUtils', 'dataService', 14cd789508SIftekharul Islam function($scope, $window, APIUtils, dataService) { 15cd789508SIftekharul Islam $scope.dataService = dataService; 16cd789508SIftekharul Islam $scope.confirm = false; 17cd789508SIftekharul Islam $scope.rebootConfirm = function() { 18cd789508SIftekharul Islam if ($scope.confirm) { 19cd789508SIftekharul Islam return; 20cd789508SIftekharul Islam } 21cd789508SIftekharul Islam $scope.confirm = true; 22cd789508SIftekharul Islam }; 23cd789508SIftekharul Islam $scope.reboot = function() { 24d80c280bSCamVan Nguyen dataService.setUnreachableState(); 25cd789508SIftekharul Islam APIUtils.bmcReboot(function(response) { 26*d27bb135SAndrew Geissler //@NOTE: using common event to reload server status, may be a better 27*d27bb135SAndrew Geissler // event listener name? 28cd789508SIftekharul Islam $scope.$emit('user-logged-in', {}); 29cd789508SIftekharul Islam }); 30cd789508SIftekharul Islam }; 31cd789508SIftekharul Islam } 32ba5e3f34SAndrew Geissler ]); 33cd789508SIftekharul Islam 34cd789508SIftekharul Islam})(angular); 35