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%2Fservices%2Fpolicynavigator.js;h=1435afe8adfb23b66cf91df22454ee0a7e6536f2;hb=dda032f8bb161d54eb1f59de2b4a3efb774fc4d1;hp=bb76dd9d54599df3053fb2082c2a441bf9b9345f;hpb=a330af579866dacbe595e2e4ad1dd29cd3c96945;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/services/policynavigator.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/services/policynavigator.js index bb76dd9d5..1435afe8a 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/services/policynavigator.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/services/policynavigator.js @@ -30,8 +30,13 @@ this.currentPath = []; this.history = []; this.error = ''; + this.searchModalActive = false; }; + PolicyNavigator.prototype.setSearchModalActiveStatus = function(){ + this.searchModalActive = true; + }; + PolicyNavigator.prototype.deferredHandler = function(data, deferred, defaultMsg) { if (!data || typeof data !== 'object') { this.error = 'Bridge response error, please check the docs'; @@ -99,29 +104,49 @@ PolicyNavigator.prototype.refresh = function() { var self = this; var path = self.currentPath.join('/'); - return self.list().then(function(data) { - self.fileList = (data.result || []).map(function(file) { - return new Item(file, self.currentPath); - }); - self.buildTree(path); - }); + if(self.searchModalActive){ + return self.searchlist(null).then(function(data) { + self.fileList = (data.result || []).map(function(file) { + return new Item(file, self.currentPath); + }); + self.buildTree(path); + }); + }else{ + return self.list().then(function(data) { + self.fileList = (data.result || []).map(function(file) { + return new Item(file, self.currentPath); + }); + self.buildTree(path); + }); + } }; - PolicyNavigator.prototype.policylist = function(finalpath) { + PolicyNavigator.prototype.searchlist = function(policyList) { var self = this; var deferred = $q.defer(); - var path = finalpath; - var data = {params: { - mode: 'LIST', - onlyFolders: false, - path: '/' + path - }}; + var path = self.currentPath.join('/'); + var data; + if(policyList == null){ + data = {params: { + mode: 'SEARCHLIST', + onlyFolders: false, + path: '/' + path + }}; + }else{ + data = {params: { + mode: 'SEARCHLIST', + onlyFolders: false, + path: '/' + path, + policyList : policyList + }}; + } + self.requesting = true; self.fileList = []; self.error = ''; - $http.post(policyManagerConfig.listUrl, data).success(function(data) { + $http.post(policyManagerConfig.searchListUrl, data).success(function(data) { self.deferredHandler(data, deferred); }).error(function(data) { self.deferredHandler(data, deferred, 'Unknown error listing, check the response'); @@ -131,16 +156,15 @@ return deferred.promise; }; - PolicyNavigator.prototype.policyrefresh = function(finalpath) { - var self = this; - var path = finalpath; - self.currentPath = path; - return self.policylist(finalpath).then(function(data) { - self.fileList = (data.result || []).map(function(file) { - return new Item(file, self.currentPath); - }); - self.buildTree(path); - }); + PolicyNavigator.prototype.searchrefresh = function(policyList) { + var self = this; + var path = self.currentPath.join('/'); + return self.searchlist(policyList).then(function(data) { + self.fileList = (data.result || []).map(function(file) { + return new Item(file, self.currentPath); + }); + self.buildTree(path); + }); };