blob: 7ec73e338d80b0d85a2483b1a98b6a5030894b50 [file] [log] [blame]
Iftekharul Islam99d199f2017-03-24 15:28:25 -05001/**
Michael Davisdfad5d52017-07-20 14:53:46 -05002<<<<<<< HEAD
Iftekharul Islamcd789502017-04-19 14:37:55 -05003 * Controller for systemOverview
Michael Davisdfad5d52017-07-20 14:53:46 -05004=======
5 * Controller for system overview
6>>>>>>> 4c1a3dd... Major update to code structure
Iftekharul Islam99d199f2017-03-24 15:28:25 -05007 *
8 * @module app/overview
9 * @exports systemOverviewController
10 * @name systemOverviewController
11 * @version 0.1.0
12 */
13
14window.angular && (function (angular) {
15 'use strict';
16
17 angular
18 .module('app.overview')
19 .controller('systemOverviewController', [
20 '$scope',
21 '$window',
22 'APIUtils',
23 'dataService',
Michael Davisdfad5d52017-07-20 14:53:46 -050024<<<<<<< HEAD
Iftekharul Islam54c22e42017-06-28 11:06:16 -050025 function($scope, $window, APIUtils, dataService){
Iftekharul Islam99d199f2017-03-24 15:28:25 -050026 $scope.dataService = dataService;
Iftekharul Islamcd789502017-04-19 14:37:55 -050027 $scope.dropdown_selected = false;
Iftekharul Islam54c22e42017-06-28 11:06:16 -050028 $scope.tmz = 'EDT';
29 $scope.logs = [];
30 $scope.mac_address = "";
31 $scope.bmc_info = {};
32 $scope.bmc_firmware = "";
33 $scope.server_firmware = "";
34
35 loadOverviewData();
36 function loadOverviewData(){
37 APIUtils.getLogs(function(data){
38 $scope.displayLogs(data);
39 });
40 APIUtils.getFirmwares(function(data, bmcActiveVersion, hostActiveVersion){
41 $scope.displayServerInfo(data, bmcActiveVersion, hostActiveVersion);
42 });
43 APIUtils.getLEDState(function(state){
44 $scope.displayLEDState(state);
45 });
46 APIUtils.getBMCEthernetInfo(function(data){
47 $scope.displayBMCEthernetInfo(data);
48 });
49 APIUtils.getBMCInfo(function(data){
50 $scope.displayBMCInfo(data);
51 });
52 }
53 $scope.displayBMCEthernetInfo = function(data){
54 $scope.mac_address = data.MACAddress;
55 }
56
57 $scope.displayBMCInfo = function(data){
58 $scope.bmc_info = data;
59 }
60
61 $scope.displayLogs = function(data){
62 $scope.logs = data.filter(function(log){
63 return log.severity_flags.high == true;
64 });
65 }
66
67 $scope.displayServerInfo = function(data, bmcActiveVersion, hostActiveVersion){
68 $scope.bmc_firmware = bmcActiveVersion;
69 $scope.server_firmware = hostActiveVersion;
70 }
71
72 $scope.displayLEDState = function(state){
73 if(state == APIUtils.LED_STATE.on){
74 dataService.LED_state = APIUtils.LED_STATE_TEXT.on;
75 }else{
76 dataService.LED_state = APIUtils.LED_STATE_TEXT.off;
77 }
78 }
79
80 $scope.toggleLED = function(){
81 var toggleState = (dataService.LED_state == APIUtils.LED_STATE_TEXT.on) ?
82 APIUtils.LED_STATE.off : APIUtils.LED_STATE.on;
83 dataService.LED_state = (dataService.LED_state == APIUtils.LED_STATE_TEXT.on) ?
84 APIUtils.LED_STATE_TEXT.off : APIUtils.LED_STATE_TEXT.on;
85 APIUtils.setLEDState(toggleState, function(status){
86 });
87 }
Michael Davisdfad5d52017-07-20 14:53:46 -050088=======
89 function($scope, $window, APIUtils, dataService, userModel){
90 $scope.dataService = dataService;
91>>>>>>> 4c1a3dd... Major update to code structure
Iftekharul Islam99d199f2017-03-24 15:28:25 -050092 }
93 ]
94 );
95
Michael Davisdfad5d52017-07-20 14:53:46 -050096<<<<<<< HEAD
97})(angular);
98=======
99})(angular);
100>>>>>>> 4c1a3dd... Major update to code structure