diff options
-rw-r--r-- | app/common/services/api-utils.js | 8 | ||||
-rw-r--r-- | app/common/services/constants.js | 10 | ||||
-rw-r--r-- | app/common/services/dataService.js | 29 |
3 files changed, 11 insertions, 36 deletions
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 @@ window.angular && (function(angular) { 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 @@ window.angular && (function(angular) { 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 @@ window.angular && (function(angular) { 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 @@ window.angular && (function(angular) { }; 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) { |