X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fwebapp%2Fapp%2FpolicyApp%2Fcontroller%2FdictionaryGridController%2FecompNameDictGridController.js;h=a7964158cac34809641833850bd6d2a069c5c001;hp=1c356ec1972745021f41537b36f374e5dfce04d3;hb=7e547eaa55920dfbc9691eab33bb728395b50cf2;hpb=dda032f8bb161d54eb1f59de2b4a3efb774fc4d1 diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js index 1c356ec19..a7964158c 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js @@ -133,26 +133,57 @@ app.controller('ecompNameDictGridController', function ($scope, PolicyAppService }; $scope.deleteEcompName = function(data) { - modalService.popupConfirmWin("Confirm","You are about to delete the Ecomp Name "+data.ecompName+". Do you want to continue?", - function(){ - var uuu = "deleteDictionary/ecomp_dictionary/remove_ecomp"; - var postData={data: data}; - $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){$scope.ecompNameDictionaryDatas=data.ecompNameDictionaryDatas;}); - }, - error : function(data){ - console.log(data); - modalService.showFailure("Fail","Error while deleting: "+ data.responseText); - } - }); + var uuu = "searchDictionary"; + var postData={data: data, type: "ecompName"}; + var searchString = "\n"; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(resultList){ + $scope.$apply(function(){ + $scope.list =resultList.result;}); + $scope.searchData = JSON.stringify(resultList.result); + $scope.searchDatas = JSON.parse($scope.searchData); + $scope.success = true; + var i; + if($scope.searchDatas.length > 0){ + for(i = 0 ; i < $scope.searchDatas.length; i++){ + searchString += $scope.searchDatas[i] + "\n"; + } + }else{ + searchString += "No Policies is Using this Value" + } - }) + console.log($scope.list); + if($scope.success){ + modalService.popupConfirmWin("Confirm","You are about to delete the Ecomp Name "+data.ecompName+".\n "+searchString+" \n Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ecomp_dictionary/remove_ecomp"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.ecompNameDictionaryDatas=data.ecompNameDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + })} + }, + error : function(data){ + alert("Error while Searching."); + } + }); }; }); \ No newline at end of file