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;h=42e6796cddf6f1e1a6b4008a3bc041e3614fa736;hb=1148834bc4b10d00c1b1830b087357e63af8293f;hp=83c3820a6101b9f81b3e4fbd6116f19b8980490a;hpb=dda032f8bb161d54eb1f59de2b4a3efb774fc4d1;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 83c3820a6..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 @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ECOMP Policy Engine + * ONAP Policy Engine * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -58,11 +58,11 @@ app.controller('PolicySearchController', [ console.log("failed"); }); - PolicyAppService.getData('getDictionary/get_EcompNameDataByName').then(function(data){ + PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function(data){ var j = data; $scope.data = JSON.parse(j.data); console.log($scope.data); - $scope.ecompNameDictionaryDatas = JSON.parse($scope.data.ecompNameDictionaryDatas); + $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas); }, function (error) { console.log("failed"); }); @@ -157,31 +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){ - $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);