Server health icon status on header fixed
Change-Id: I06100d8ffe9e26129585ca9476fa7097ef34a6b4
Signed-off-by: Iftekharul Islam <iffy.ryan@ibm.com>
diff --git a/app/common/directives/app-header.html b/app/common/directives/app-header.html
index c9378ae..3258968 100644
--- a/app/common/directives/app-header.html
+++ b/app/common/directives/app-header.html
@@ -12,7 +12,7 @@
</div>
<div class="header__functions" ng-class="{'active' : toggle}">
<a class="header__info" ng-click="toggle = !toggle"><span>Server Info</span><i class="icon icon-angle" aria-hidden="true"></i></a>
- <a href="#/server-health/event-log" class="header__server-health">Server health <i class="icon icon-angle" aria-hidden="true"></i><span class="status-light__error">{{dataService.server_health}}</span></a>
+ <a href="#/server-health/event-log" class="header__server-health">Server health <i class="icon icon-angle" aria-hidden="true"></i><span ng-class="{'status-light__error': dataService.server_health == 'Critical', 'status-light__warn': dataService.server_health == 'Warning', 'status-light__good': dataService.server_health == 'Good'}">{{dataService.server_health}}</span></a>
<a href="#/server-control/power-operations" class="header__server-power" role="button">Server power <i class="icon icon-angle" aria-hidden="true"></i><span ng-class="{'status-light__off': dataService.server_state == 'Off', 'status-light__disabled': dataService.server_state == 'Unreachable', 'status-light__good': dataService.server_state == 'Running', 'status-light__warn': dataService.server_state == 'Quiesced'}">{{dataService.server_state}}</span></a>
<p class="header__refresh">Data last refreshed<span>{{dataService.last_updated |date:'h:mm:ss MMM dd yyyy'}}</span></p>
<button class="header__page-refresh" ng-click="refresh()" aria-label="refresh page data"><span>Refresh</span><svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52.18 51.91"><path class="cls-1" d="M38,20.77H52v-14H48.3v6.07A26,26,0,1,0,48.7,38H44.32a22.14,22.14,0,1,1,1.8-20.92H38v3.67Z" transform="translate(0.16 0.14)"/></button>
diff --git a/app/common/directives/app-header.js b/app/common/directives/app-header.js
index 6a9493b..cb4704e 100644
--- a/app/common/directives/app-header.js
+++ b/app/common/directives/app-header.js
@@ -13,6 +13,12 @@
'controller': ['$rootScope', '$scope','dataService', 'userModel', '$location', function($rootScope, $scope, dataService, userModel, $location){
$scope.dataService = dataService;
+ $scope.loadServerHealth = function(){
+ APIUtils.getLogs().then(function(result){
+ dataService.updateServerHealth(result.data);
+ });
+ }
+
$scope.loadServerStatus = function(){
if(!userModel.isLoggedIn()){
return;
@@ -37,8 +43,13 @@
});
}
- $scope.loadServerStatus();
- $scope.loadNetworkInfo();
+ function loadData(){
+ $scope.loadServerStatus();
+ $scope.loadNetworkInfo();
+ $scope.loadServerHealth();
+ }
+
+ loadData();
$scope.logout = function(){
userModel.logout(function(status, error){
@@ -51,8 +62,7 @@
}
$scope.refresh = function(){
- $scope.loadServerStatus();
- $scope.loadNetworkInfo();
+ loadData();
//Add flash class to header timestamp on click of refresh
var myEl = angular.element( document.querySelector( '.header__refresh' ) );
@@ -64,8 +74,7 @@
}
var loginListener = $rootScope.$on('user-logged-in', function(event, arg){
- $scope.loadServerStatus();
- $scope.loadNetworkInfo();
+ loadData();
});
$scope.$on('$destroy', function(){
diff --git a/app/server-control/controllers/remote-console-window-controller.js b/app/server-control/controllers/remote-console-window-controller.js
new file mode 100644
index 0000000..cb2835d
--- /dev/null
+++ b/app/server-control/controllers/remote-console-window-controller.js
@@ -0,0 +1,64 @@
+/**
+ * Controller for server
+ *
+ * @module app/serverControl
+ * @exports remoteConsoleWindowController
+ * @name remoteConsoleController
+ * @version 0.1.0
+ */
+
+window.angular && (function (angular) {
+ 'use strict';
+
+ angular
+ .module('app.serverControl')
+ .controller('remoteConsoleWindowController', [
+ '$scope',
+ '$window',
+ 'APIUtils',
+ 'dataService',
+ function($scope, $window, APIUtils, dataService){
+ $scope.dataService = dataService;
+ dataService.showNavigation = false;
+
+ // See https://github.com/macton/hterm for available hterm options
+
+ //Storage
+ hterm.defaultStorage = new lib.Storage.Local();
+
+ var term = new hterm.Terminal("foo");
+ term.onTerminalReady = function() {
+ var io = term.io.push();
+ io.onVTKeystroke = function(str) {
+ console.log(str)
+ term.io.print(str);
+ };
+ io.sendString = function(str) {
+ console.log(str)
+ };
+ };
+ term.decorate(document.querySelector('#terminal'));
+
+ //Set cursor color
+ term.prefs_.set('cursor-color', 'rgba(83, 146, 255, .5)');
+
+ //Set background color
+ term.prefs_.set('background-color', '#19273c');
+
+ //Print to console window
+ term.io.println('OpenBMC ver.00');
+ term.io.println('This is not an actual live connection.');
+ term.io.print('root@IBM:');
+
+ //Allows keyboard input
+ term.installKeyboard();
+
+ $scope.close = function(){
+ dataService.setRemoteWindowInactive();
+ $window.close();
+ }
+ }
+ ]
+ );
+
+})(angular);
diff --git a/app/server-health/controllers/inventory-controller.html b/app/server-health/controllers/inventory-controller.html
index 7506954..1a2952d 100644
--- a/app/server-health/controllers/inventory-controller.html
+++ b/app/server-health/controllers/inventory-controller.html
@@ -564,4 +564,4 @@
</div>
</section>
<paginate ng-include="paginate"></paginate>
-</div> <!-- end event log -->
+</div> <!-- end event log -->
\ No newline at end of file
diff --git a/app/server-health/controllers/inventory-overview-controller.js b/app/server-health/controllers/inventory-overview-controller.js
index fae3a09..7a62d40 100644
--- a/app/server-health/controllers/inventory-overview-controller.js
+++ b/app/server-health/controllers/inventory-overview-controller.js
@@ -25,8 +25,8 @@
$scope.searchTerms = [];
$scope.loading = false;
+ $scope.loading = true;
APIUtils.getHardwares(function(data, originalData){
- $scope.loading = true;
$scope.hardwares = data;
$scope.originalData = JSON.stringify(originalData);
$scope.loading = false;
diff --git a/app/server-health/controllers/log-controller.js b/app/server-health/controllers/log-controller.js
index c6b4d8f..963c6c0 100644
--- a/app/server-health/controllers/log-controller.js
+++ b/app/server-health/controllers/log-controller.js
@@ -70,6 +70,7 @@
}
expandedSelectedIdOnce = true;
}
+ dataService.updateServerHealth(result.data);
$scope.logs = result.data;
$scope.originalData = result.original;
$scope.loading = false;
@@ -88,7 +89,6 @@
);
}
-
$scope.filterByStatus = function(log){
if ($scope.selectedStatus.all) return true;
return( (log.Resolved && $scope.selectedStatus.resolved)||
diff --git a/app/server-health/controllers/sensors-controller.html b/app/server-health/controllers/sensors-controller.html
index caad20e..8544ebb 100644
--- a/app/server-health/controllers/sensors-controller.html
+++ b/app/server-health/controllers/sensors-controller.html
@@ -83,4 +83,4 @@
</div>
</section>
-</div> <!-- end event log -->
+</div> <!-- end event log -->
\ No newline at end of file
diff --git a/app/server-health/controllers/sensors-overview-controller.html b/app/server-health/controllers/sensors-overview-controller.html
index efd60a5..e0accde 100644
--- a/app/server-health/controllers/sensors-overview-controller.html
+++ b/app/server-health/controllers/sensors-overview-controller.html
@@ -57,4 +57,4 @@
<p class="inline sensor__reading"><span class="sensor__label">High critical</span>{{sensor.CriticalHigh}}<span class="content-label">{{sensor.unit}}<span ng-if="sensor.unit == 'C'">°</span></p>
</div>
</section>
-</div>
+</div>
\ No newline at end of file
diff --git a/app/server-health/controllers/sensors-overview-controller.js b/app/server-health/controllers/sensors-overview-controller.js
index 6d33604..ed74d04 100644
--- a/app/server-health/controllers/sensors-overview-controller.js
+++ b/app/server-health/controllers/sensors-overview-controller.js
@@ -70,10 +70,7 @@
}
$scope.toggleSeverityAll = function(){
-
- if($scope.selectedSeverity.all !== true){
- $scope.selectedSeverity.all = !$scope.selectedSeverity.all;
- }
+ $scope.selectedSeverity.all = !$scope.selectedSeverity.all;
if($scope.selectedSeverity.all){
$scope.selectedSeverity.warning = false;
diff --git a/app/server-health/controllers/unit-id-controller.html b/app/server-health/controllers/unit-id-controller.html
index 23f5b1b..bc9c345 100644
--- a/app/server-health/controllers/unit-id-controller.html
+++ b/app/server-health/controllers/unit-id-controller.html
@@ -25,4 +25,4 @@
</div>
</div>
</div>
-</div>
+</div>
\ No newline at end of file
diff --git a/app/server-health/styles/index.scss b/app/server-health/styles/index.scss
index 858d836..8df3468 100644
--- a/app/server-health/styles/index.scss
+++ b/app/server-health/styles/index.scss
@@ -1,6 +1,6 @@
+@import "./inventory.scss";
@import "./log.scss";
@import "./sensors.scss";
-@import "./inventory.scss";
@import "./unit-id.scss";
@import "./power-consumption.scss";
-@import "./diagnostics.scss";
+@import "./diagnostics.scss";
\ No newline at end of file