YangUI - API - Fixed list filtering alerts 71/40471/1
authorĽubomír Balogh <lubomir.balogh@pantheon.sk>
Fri, 17 Jun 2016 06:13:41 +0000 (08:13 +0200)
committerĽubomír Balogh <lubomir.balogh@pantheon.sk>
Fri, 17 Jun 2016 06:16:59 +0000 (08:16 +0200)
- Bug 5774 - fixed alerts in topology list filtering in YangUI

Change-Id: I9be92b08f0834f7b77556ccba5a3f309454d41e7
Signed-off-by: Ľubomír Balogh <lubomir.balogh@pantheon.sk>
modules/yangui-resources/src/main/resources/yangui/controllers/api/list.controller.js

index a9e025a24975d16423843e2738b82de9c4496bca..4780fff22a8e816e4b90de23b36cee09ff7b222e 100644 (file)
@@ -20,6 +20,7 @@ define([], function () {
         $scope.applyFilter = applyFilter;
         $scope.clearFilterData = clearFilterData;
         $scope.createNewFilter = createNewFilter;
+        $scope.existsActiveFilter = existsActiveFilter;
         $scope.getFilterData = getFilterData;
         $scope.getListName = getListName;
         $scope.removeListElem = removeListElem;
@@ -127,6 +128,12 @@ define([], function () {
             ListFilteringService.createNewFilter($scope.node);
         }
 
+        function existsActiveFilter() {
+            return $scope.node.filters.some(function(filter) {
+                return filter.active == 1;
+            });
+        }
+
         function applyFilter() {
             ListFilteringService.applyFilter($scope.node);
             $scope.showListFilter = !$scope.showListFilter;
@@ -140,7 +147,10 @@ define([], function () {
                     $scope.node.listData,
                     $scope.node.refKey
                 );
-                $scope.setStatusMessage('danger', 'YANGUI_FILTER_MATCH_ERROR', e.message);
+
+                if($scope.existsActiveFilter()) {
+                    $scope.setStatusMessage('danger', 'YANGUI_FILTER_MATCH_ERROR', e.message);
+                }
             }
         }