X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fwebapp%2Fapp%2FpolicyApp%2Fpolicy-models%2FEditor%2Fjs%2Fcontrollers%2FpolicySearchManager.js;fp=POLICY-SDK-APP%2Fsrc%2Fmain%2Fwebapp%2Fapp%2FpolicyApp%2Fpolicy-models%2FEditor%2Fjs%2Fcontrollers%2FpolicySearchManager.js;h=42e6796cddf6f1e1a6b4008a3bc041e3614fa736;hb=1148834bc4b10d00c1b1830b087357e63af8293f;hp=f973a236aabfd32e0deb8e73fd88a7b2fbff7771;hpb=066fc4529f36d210a4a4700e8dbfd2cb42f4dc66;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js index f973a236a..42e6796cd 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js @@ -157,35 +157,38 @@ app.controller('PolicySearchController', [ return currentPath.indexOf(path) !== -1; }; - $scope.searchPolicy = function(searchContent){ - var deferred = $q.defer(); - var uuu = "searchPolicy"; - var postData = {searchdata : searchContent}; - $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){ - var searchdata = data.result; - if(searchdata.length > 0){ - if(searchdata[0] == "Elastic Search Server is down"){ - alert("Elastic Search Server is down."); - }else{ - $scope.policyNavigator.searchrefresh(searchdata); - } - }else{ - Notification.info("No Matches Found with your Search"); - } - }); - }, - error : function(data){ - alert("Error while Searching."); - } - }); - }; + $scope.searchPolicy = function(searchContent){ + if(searchContent != undefined){ + var uuu = "searchPolicy"; + var postData = {searchdata : searchContent}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + var searchdata = data.result; + if(searchdata.length > 0){ + if(searchdata[0] == "Exception"){ + Notification.error(searchdata[1]); + }else{ + $scope.policyNavigator.searchrefresh(searchdata); + } + }else{ + Notification.info("No Matches Found with your Search"); + } + }); + }, + error : function(data){ + Notification.error("Error while Searching."); + } + }); + }else{ + Notification.error("No data has been entered or selected to search"); + } + }; $scope.refresh = function(searchData){ $scope.policyNavigator.searchrefresh(null);