Updating server health icon in header based on event log status
Change-Id: Iae10d39428b6ce6a228e775aa68fb7805dd61ecb
Signed-off-by: Iftekharul Islam <iffy.ryan@ibm.com>
diff --git a/app/common/services/constants.js b/app/common/services/constants.js
index 1c92e38..7ffbd82 100644
--- a/app/common/services/constants.js
+++ b/app/common/services/constants.js
@@ -20,7 +20,7 @@
password: "testpass",
},
API_CREDENTIALS: {
- host: 'https://9.3.185.164',
+ host: 'https://9.3.181.64',
mock_host: 'http://localhost:3000'
},
API_RESPONSE: {
@@ -53,10 +53,25 @@
on: 'on',
off: 'off'
},
+ SEVERITY_TO_HEALTH_MAP:{
+ Emergency: 'Critical',
+ Alert: 'Critical',
+ Critical: 'Critical',
+ Error: 'Warning',
+ Warning: 'Warning',
+ Notice: 'Good',
+ Debug: 'Good',
+ Informational: 'Good'
+ },
SEVERITY_TO_PRIORITY_MAP:{
- Informational: 'Low',
+ Emergency: 'High',
+ Alert: 'High',
+ Critical: 'High',
Error: 'High',
- Warning: 'Medium'
+ Warning: 'Medium',
+ Notice: 'Low',
+ Debug: 'Low',
+ Informational: 'Low'
},
PAGINATION: {
LOG_ITEMS_PER_PAGE: 25
@@ -78,8 +93,14 @@
'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'watts',
'xyz.openbmc_project.Sensor.Value.Unit.Amperes': 'amperes',
'xyz.openbmc_project.Sensor.Value.Unit.Joules': 'joules'
+ },
+ SERVER_HEALTH: {
+ critical: 'Critical',
+ warning: 'Warning',
+ good: 'Good',
+ unknown: 'Unknown'
}
};
});
-})(window.angular);
+})(window.angular);
\ No newline at end of file
diff --git a/app/common/services/dataService.js b/app/common/services/dataService.js
index 6640ddb..00ea1ba 100644
--- a/app/common/services/dataService.js
+++ b/app/common/services/dataService.js
@@ -15,7 +15,7 @@
.module('app.common.services')
.service('dataService', ['Constants', function (Constants) {
this.app_version = "V.0.0.1";
- this.server_health = 'Error';
+ this.server_health = Constants.SERVER_HEALTH.unknown;
this.server_state = 'Unreachable';
this.server_status = -2;
this.chassis_state = 'On';
@@ -33,6 +33,7 @@
this.hostname = "";
this.mac_address = "";
+ this.remote_window_active = false;
this.setNetworkInfo = function(data){
this.hostname = data.hostname;
@@ -58,6 +59,36 @@
this.server_state = Constants.HOST_STATE_TEXT.unreachable;
this.server_status = Constants.HOST_STATE.unreachable;
}
+
+ this.setRemoteWindowActive = function(){
+ this.remote_window_active = true;
+ }
+
+ this.setRemoteWindowInactive = function(){
+ this.remote_window_active = false;
+ }
+
+ this.updateServerHealth = function(logs){
+ var criticals = logs.filter(function(item){
+ return item.health_flags.critical == true;
+ });
+
+ if(criticals.length){
+ this.server_health = Constants.SERVER_HEALTH.critical;
+ return;
+ }
+
+ var warnings = logs.filter(function(item){
+ return item.health_flags.warning == true;
+ });
+
+ if(warnings.length){
+ this.server_health = Constants.SERVER_HEALTH.warning;
+ return;
+ }
+
+ this.server_health = Constants.SERVER_HEALTH.good;
+ }
}]);
})(window.angular);
\ No newline at end of file