diff options
author | Iftekharul Islam <iffy.ryan@ibm.com> | 2017-09-06 10:45:27 -0500 |
---|---|---|
committer | Adriana Kobylak <anoo@us.ibm.com> | 2017-10-09 14:46:59 -0500 |
commit | 3471409a4e15974089b8b452682b4ef0d954b257 (patch) | |
tree | da1c271f353c4e3648a65f0ffd29fe4e40ed8345 | |
parent | c4172b5a132e19516f8e98731cc38808eda6e033 (diff) | |
download | phosphor-webui-3471409a4e15974089b8b452682b4ef0d954b257.tar.gz phosphor-webui-3471409a4e15974089b8b452682b4ef0d954b257.zip |
Updating server health icon in header based on event log status
Change-Id: Iae10d39428b6ce6a228e775aa68fb7805dd61ecb
Signed-off-by: Iftekharul Islam <iffy.ryan@ibm.com>
-rw-r--r-- | app/assets/images/icon-warning.svg | 1 | ||||
-rw-r--r-- | app/common/directives/app-navigation.html | 4 | ||||
-rw-r--r-- | app/common/directives/app-navigation.js | 10 | ||||
-rw-r--r-- | app/common/directives/errors.html | 17 | ||||
-rw-r--r-- | app/common/directives/log-filter.js | 4 | ||||
-rw-r--r-- | app/common/services/constants.js | 29 | ||||
-rw-r--r-- | app/common/services/dataService.js | 33 | ||||
-rw-r--r-- | app/login/controllers/login-controller.js | 9 | ||||
-rw-r--r-- | app/overview/controllers/system-overview-controller.html | 2 |
9 files changed, 94 insertions, 15 deletions
diff --git a/app/assets/images/icon-warning.svg b/app/assets/images/icon-warning.svg index b25ae52..dd9b3dd 100644 --- a/app/assets/images/icon-warning.svg +++ b/app/assets/images/icon-warning.svg @@ -1,4 +1,3 @@ -<?xml version="1.0" encoding="utf-8"?> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve"> <style type="text/css"> diff --git a/app/common/directives/app-navigation.html b/app/common/directives/app-navigation.html index 6784990..c2c6f67 100644 --- a/app/common/directives/app-navigation.html +++ b/app/common/directives/app-navigation.html @@ -64,8 +64,8 @@ <span>Users</span> </span> </li> - <li> - <a class="btn-multi-server" ng-class="{opened: firstLevel == 'multi-server'}" href="#/multi-server/overview" ng-click="change('multi-server')"> + <li class="btn-multi-server"> + <a ng-class="{opened: firstLevel == 'multi-server'}" href="#/multi-server/overview" ng-click="change('multi-server')"> <span> <svg class="nav-icon" version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 24 24" xml:space="preserve"> <path d="M12.8,7.3h4c0.2,1.5,1.5,2.8,3.1,2.8c1.7,0,3.1-1.4,3.1-3.1s-1.4-3.1-3.1-3.1c-1.5,0-2.7,1-3,2.4h-4C12.4,3.3,9.9,1,6.9,1 diff --git a/app/common/directives/app-navigation.js b/app/common/directives/app-navigation.js index 00c3ec7..daccb2f 100644 --- a/app/common/directives/app-navigation.js +++ b/app/common/directives/app-navigation.js @@ -12,6 +12,7 @@ window.angular && (function (angular) { 'showNavigation': '=' }, 'controller': ['$scope', '$location', 'dataService', function($scope, $location, dataService){ + $scope.dataService = dataService; $scope.showSubMenu = false; $scope.change = function(firstLevel){ if(firstLevel != $scope.firstLevel) { @@ -24,6 +25,15 @@ window.angular && (function (angular) { $scope.closeSubnav = function(){ $scope.showSubMenu = false; }; + $scope.$watch('path', function(){ + var urlRoot = $location.path().split("/")[1]; + if(urlRoot != ""){ + $scope.firstLevel = urlRoot; + }else{ + $scope.firstLevel = 'overview'; + } + $scope.showSubMenu = false; + }); $scope.$watch('showNavigation', function(){ var paddingTop = 0; var urlRoot = $location.path().split("/")[1]; diff --git a/app/common/directives/errors.html b/app/common/directives/errors.html new file mode 100644 index 0000000..0fd2234 --- /dev/null +++ b/app/common/directives/errors.html @@ -0,0 +1,17 @@ +<!-- Unexpected error --> +<section class="modal" aria-hidden="true" aria-labelledby="modalTitle" aria-describedby="modalDescription" role="dialog" ng-class="{'active': display_error}"> + <div class="modal__upload-fail" role="document"> + <div class="screen-reader-offscreen modal-description">Unexpected error</div><!-- accessibility only; used for screen readers --> + <div class="page-header "> + <span class="icon icon__warning inline"><span class="accessible-text" role="alert">Unexpected error</span></span> + <h1 class="modal-title h4 inline">Unexpected error</h1> + </div> + <div class="modal__content"> + <p>Oops! An unexpected error occurred. Record specific details of the issue, then contact your company support services.</p> + </div> + <div class="modal__button-wrapper"> + <button class="inline btn-primary" ng-click="display_error = false;">Close</button> + </div> + </div> +</section> +<div class="modal-overlay" tabindex="-1" ng-class="{'active': (multi_server_recent)}"></div>
\ No newline at end of file diff --git a/app/common/directives/log-filter.js b/app/common/directives/log-filter.js index 81abc7d..527d347 100644 --- a/app/common/directives/log-filter.js +++ b/app/common/directives/log-filter.js @@ -10,9 +10,7 @@ window.angular && (function (angular) { 'controller': ['$rootScope', '$scope','dataService', '$location', function($rootScope, $scope, dataService, $location){ $scope.dataService = dataService; $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.low = false; 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 @@ window.angular && (function (angular) { 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 @@ window.angular && (function (angular) { 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 @@ window.angular && (function (angular) { '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 @@ window.angular && (function (angular) { .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 @@ window.angular && (function (angular) { this.hostname = ""; this.mac_address = ""; + this.remote_window_active = false; this.setNetworkInfo = function(data){ this.hostname = data.hostname; @@ -58,6 +59,36 @@ window.angular && (function (angular) { 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 diff --git a/app/login/controllers/login-controller.js b/app/login/controllers/login-controller.js index af8a6c3..d8e8951 100644 --- a/app/login/controllers/login-controller.js +++ b/app/login/controllers/login-controller.js @@ -35,6 +35,7 @@ window.angular && (function (angular) { }; $scope.login = function(username, password){ $scope.error = false; + $scope.server_unreachable = false; if(!username || username == "" || !password || password == ""){ @@ -45,9 +46,11 @@ window.angular && (function (angular) { $scope.$emit('user-logged-in',{}); $window.location.hash = '#/overview/server'; }else{ - if(!unreachable){ - $scope.error = true; - } + if(unreachable){ + $scope.server_unreachable = true; + }else{ + $scope.error = true; + } }; }); } diff --git a/app/overview/controllers/system-overview-controller.html b/app/overview/controllers/system-overview-controller.html index d294017..7eace49 100644 --- a/app/overview/controllers/system-overview-controller.html +++ b/app/overview/controllers/system-overview-controller.html @@ -114,7 +114,7 @@ <div class="column large-12 overview__event-log event-log__events" ng-show="logs.length"> <div class="page-header"> <h3 class="bold h4 inline">High priority events ({{logs.length}})</h3> - <a href="#/server-health/event-log/high" class="inline float-right">View all event logs</a> + <a href="#/server-health/event-log/" class="inline float-right">View all event logs</a> </div> <!-- single event --> |