'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/api-utils.js b/app/common/services/api-utils.js
index 7f2fe7f..c783082 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -689,18 +689,11 @@
                           medium: false,
                           high: false
                         };
-                        var healthFlags = {
-                          critical: false,
-                          warning: false,
-                          good: false
-                        };
                         severityCode =
                             content.data[key].Severity.split('.').pop();
                         priority =
                             Constants.SEVERITY_TO_PRIORITY_MAP[severityCode];
                         severityFlags[priority.toLowerCase()] = true;
-                        health = Constants.SEVERITY_TO_HEALTH_MAP[severityCode];
-                        healthFlags[health.toLowerCase()] = true;
                         relatedItems = [];
                         content.data[key].associations.forEach(function(item) {
                           relatedItems.push(item[2]);
@@ -721,7 +714,6 @@
                               priority: priority,
                               severity_code: severityCode,
                               severity_flags: severityFlags,
-                              health_flags: healthFlags,
                               additional_data:
                                   content.data[key].AdditionalData.join('\n'),
                               type: content.data[key].Message,
diff --git a/app/common/services/constants.js b/app/common/services/constants.js
index ed69ae8..9931f01 100644
--- a/app/common/services/constants.js
+++ b/app/common/services/constants.js
@@ -38,16 +38,6 @@
       HOST_STATE: {on: 1, off: -1, error: 0, unreachable: -2},
       LED_STATE: {on: true, off: false},
       LED_STATE_TEXT: {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: {
         Emergency: 'High',
         Alert: 'High',
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) {