Adding user friendly warning message in sensor page

fixes openbmc/openbmc#2748

Change-Id: I4370be0b921e7ba7ecb16afecf59a7246a0a4224
Signed-off-by: Iftekharul Islam <iffy.ryan@ibm.com>
diff --git a/app/common/services/constants.js b/app/common/services/constants.js
index 373fab1..66e5920 100644
--- a/app/common/services/constants.js
+++ b/app/common/services/constants.js
@@ -118,6 +118,13 @@
                     Active: 'Active',
                     Ready: 'Ready'
                   }
+                },
+                MESSAGES: {
+                  SENSOR: {
+                    NO_SENSOR_DATA: 'There are no sensors found.',
+                    CRITICAL_NO_SENSOR_DATA: 'There are no sensors in Critical state.',
+                    WARNING_NO_SENSOR_DATA: 'There are no sensors in Warning state.'
+                  }
                 }
             };
         });
diff --git a/app/server-health/controllers/sensors-overview-controller.html b/app/server-health/controllers/sensors-overview-controller.html
index f00deff..d0abfe9 100644
--- a/app/server-health/controllers/sensors-overview-controller.html
+++ b/app/server-health/controllers/sensors-overview-controller.html
@@ -36,7 +36,15 @@
 
 	</section> <!-- end search -->
 
-	<section id="sensor-categories" class="row column">
+	<section class="row column" ng-show="filteredSensorData.length == 0">
+		<!-- message -->
+		<span ng-if="selectedSeverity.all">{{messages.NO_SENSOR_DATA}}</span>
+		<span ng-if="selectedSeverity.critical">{{messages.CRITICAL_NO_SENSOR_DATA}}</span>
+		<span ng-if="selectedSeverity.warning">{{messages.WARNING_NO_SENSOR_DATA}}</span>
+		<!-- end message -->
+	</section>
+
+	<section id="sensor-categories" class="row column" ng-show="filteredSensorData.length">
 		<div class="row column header-row">
 			<div class="column large-12 header__actions-bar">
 				<p class="inline sensor__title">Sensors</p>
@@ -48,7 +56,7 @@
 			</div>
 		</div>
 		<!-- sensor -->
-		<div class="sensor__readings-row" ng-repeat="sensor in (filteredSensorData = data|filter:filterBySeverity|filter:filterBySearchTerms|orderBy:'+custom_order')">
+		<div class="sensor__readings-row" ng-repeat="sensor in data|filter:filterBySeverity|filter:filterBySearchTerms|orderBy:'+custom_order' as filteredSensorData">
 			<p class="inline sensor__title"><span class="icon" ng-class="{'icon__critical': sensor.status == 'critical', 'icon__warning': sensor.status == 'warning', 'icon__normal': sensor.status == 'normal'}" aria-label="sensor.status" ></span>{{sensor.title}}</p>
 			<p class="inline sensor__reading"><span class="sensor__label">Low critical</span>{{sensor.CriticalLow}}<span class="content-label">{{sensor.unit}}<span ng-if="sensor.unit == 'C'">&deg;</span></p>
 			<p class="inline sensor__reading"><span class="sensor__label">Low warning</span>{{sensor.WarningLow}}<span class="content-label">{{sensor.unit}}<span ng-if="sensor.unit == 'C'">&deg;</span></p>
diff --git a/app/server-health/controllers/sensors-overview-controller.js b/app/server-health/controllers/sensors-overview-controller.js
index ed74d04..b90ca0e 100644
--- a/app/server-health/controllers/sensors-overview-controller.js
+++ b/app/server-health/controllers/sensors-overview-controller.js
@@ -17,7 +17,8 @@
             '$window', 
             'APIUtils', 
             'dataService',
-            function($scope, $log, $window, APIUtils, dataService, userModel){
+            'Constants',
+            function($scope, $log, $window, APIUtils, dataService, Constants){
                 $scope.dataService = dataService;
 
                 $scope.dropdown_selected = false;
@@ -25,6 +26,7 @@
                 $scope.$log = $log;
                 $scope.customSearch = "";
                 $scope.searchTerms = [];
+                $scope.messages = Constants.MESSAGES.SENSOR;
                 $scope.selectedSeverity = {
                     all: true,
                     normal: false,