'Critical' Server Health on 'High' Priority logs
Set the Server health, located in the header, to Critical when
a 'High' Priority log is present. Before to determine what the
Server health was the SEVERITY_TO_HEALTH_MAP was used. This
followed the SEVERITY_TO_PRIORITY_MAP most of the time.
Removed code and made this simpler.
Checked with the design team and this way was the original intent.
Resolves openbmc/phosphor-webui#16
Change-Id: I2b3dab87cf1c31e9ef156c8e4f3a1592ed49403e
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/common/services/dataService.js b/app/common/services/dataService.js
index 81a2c35..7a3c713 100644
--- a/app/common/services/dataService.js
+++ b/app/common/services/dataService.js
@@ -98,25 +98,18 @@
};
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;
- }
-
+ // If any severity high logs are present, set server health to critical
+ // Else if any severity medium logs are present set server health to
+ // warning
this.server_health = Constants.SERVER_HEALTH.good;
+ for (var log of logs) {
+ if (log.priority == 'High') {
+ this.server_health = Constants.SERVER_HEALTH.critical;
+ return;
+ } else if (log.priority == 'Medium') {
+ this.server_health = Constants.SERVER_HEALTH.warning;
+ }
+ }
};
this.activateErrorModal = function(data) {