From 91d04c64771832a0b8815ffbe1f0f9920320d94d Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Tue, 14 Feb 2017 19:41:00 -0500 Subject: Initial OpenECOMP policy/engine commit Change-Id: I7dbff37733b661643dd4d1caefa3d7dccc361b6e Signed-off-by: Pamela Dragosh --- .../BRMSParamDictController.js | 88 ++++++ .../CLPepOptionsDictController.js | 120 ++++++++ .../CLServiceDictController.js | 75 +++++ .../dictionaryController/CLSiteDictController.js | 75 +++++ .../CLVarbindDictController.js | 75 +++++ .../CLVnfTypeDictController.js | 75 +++++ .../CLVsclActionDictController.js | 75 +++++ .../DecisionSettingsDictController.js | 75 +++++ .../DescriptiveSearchDictController.js | 121 ++++++++ .../dictionaryController/EnforcerDictController.js | 70 +++++ .../FWActionListDictController.js | 75 +++++ .../FWAddressGroupDictController.js | 120 ++++++++ .../FWParentListDictController.js | 156 ++++++++++ .../FWPortListDictController.js | 75 +++++ .../FWPrefixListDictController.js | 103 +++++++ .../FWProtocolListDictController.js | 75 +++++ .../FWSecurityZoneDictController.js | 75 +++++ .../FWServiceGroupDictController.js | 121 ++++++++ .../FWServiceListDictController.js | 147 +++++++++ .../FWTermListDictController.js | 331 +++++++++++++++++++++ .../dictionaryController/FWZoneDictController.js | 75 +++++ .../MSConfigNameDictController.js | 76 +++++ .../MSDcaeUUIDDictController.js | 76 +++++ .../MSLocationDictController.js | 76 +++++ .../dictionaryController/MSModelsDictController.js | 87 ++++++ .../PSClosedLoopDictController.js | 75 +++++ .../PSGroupPolicyScopeDictController.js | 137 +++++++++ .../PSResourceDictController.js | 75 +++++ .../PSServiceDictController.js | 75 +++++ .../dictionaryController/PSTypeDictController.js | 76 +++++ .../dictionaryController/RiskTypeDictController.js | 75 +++++ .../SafePolicyWarningDictController.js | 107 +++++++ .../actionPolicyDictController.js | 119 ++++++++ .../attributeDictController.js | 109 +++++++ .../ecompNameEditorController.js | 74 +++++ 35 files changed, 3439 insertions(+) create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLPepOptionsDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLServiceDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLSiteDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVarbindDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVnfTypeDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVsclActionDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionSettingsDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DescriptiveSearchDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/EnforcerDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWActionListDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWAddressGroupDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWParentListDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPortListDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWProtocolListDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWSecurityZoneDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceGroupDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceListDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWZoneDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSDcaeUUIDDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSLocationDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSClosedLoopDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSResourceDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSServiceDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSTypeDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/RiskTypeDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/SafePolicyWarningDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/actionPolicyDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js create mode 100644 ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/ecompNameEditorController.js (limited to 'ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController') diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js new file mode 100644 index 000000000..030f08f43 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editBRMSParamController = function ($scope, $modalInstance, message, $http, PapUrlService, UserInfoService, Notification){ + if(message.brmsParamDictionaryData==null) + $scope.label='Add BRMS Rule' + else{ + $scope.label='Edit BRMS Rule' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editBRMSParam = message.brmsParamDictionaryData; + + $scope.uploadFile = function(files) { + var fd = new FormData(); + fd.append("file", files[0]); + $http.post(papUrl + "/ecomp/brms_dictionary/set_BRMSParamData.htm", fd, { + withCredentials: false, + headers: {'Content-Type': undefined }, + transformRequest: angular.identity + }).success().error( ); + + }; + + $scope.MyFile = []; + $scope.saveBRMSParam = function(brmsParamDictionaryData) { + var file = $scope.MyFile; + var uuu = papUrl + "/ecomp/brms_dictionary/save_BRMSParam.htm"; + var postData={brmsParamDictionaryData: brmsParamDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.brmsParamDictionaryDatas=data.brmsParamDictionaryDatas;}); + if($scope.brmsParamDictionaryDatas == "Duplicate"){ + Notification.error("BRMSParan Dictionary exists with Same Name.") + }else{ + console.log($scope.brmsParamDictionaryDatas); + $modalInstance.close({brmsParamDictionaryDatas:$scope.brmsParamDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLPepOptionsDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLPepOptionsDictController.js new file mode 100644 index 000000000..5ec078f11 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLPepOptionsDictController.js @@ -0,0 +1,120 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPEPOptionsController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.pepOptionsDictionaryData==null) + $scope.label='Add PEP Options', + $scope.choices = []; + else{ + $scope.label='Edit PEP Options' + $scope.disableCd=true; + $scope.choices = []; + var headers = message.pepOptionsDictionaryData.actions; + var SplitChars = ':#@'; + if (headers.indexOf(SplitChars) >= 0) { + var splitHeader = headers.split(SplitChars); + var singleHeader = splitHeader; + var splitEqual = '=#@'; + for(i = 0; i < singleHeader.length; i++){ + if (singleHeader[i].indexOf(splitEqual) >= 0) { + var splitValue = singleHeader[i].split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo, 'option': key , 'number' : value }); + } + } + }else{ + var splitEqual = '=#@'; + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + $scope.choices.push({'id':'choice'+1, 'option': key , 'number' : value }); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPEPOptions = message.pepOptionsDictionaryData; + + $scope.saveCLPepOptions = function(pepOptionsDictionaryData) { + var finalData = extend(pepOptionsDictionaryData, $scope.actions[0]); + var uuu = papUrl + "/ecomp/cl_dictionary/save_pepOptions.htm"; + var postData={pepOptionsDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.pepOptionsDictionaryDatas=data.pepOptionsDictionaryDatas;}); + if($scope.pepOptionsDictionaryDatas == "Duplicate"){ + Notification.error("PEP Options Dictionary exists with Same PEP Name.") + }else{ + console.log($scope.pepOptionsDictionaryDatas); + $modalInstance.close({pepOptionsDictionaryDatas:$scope.pepOptionsDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.actions = [{"attributes" : $scope.choices}]; + $scope.addNewChoice = function() { + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo}); + }; + $scope.removeChoice = function() { + var lastItem = $scope.choices.length-1; + $scope.choices.splice(lastItem); + }; + +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLServiceDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLServiceDictController.js new file mode 100644 index 000000000..c3acc72b2 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLServiceDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editCLServiceController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.closedLoopServiceDictionaryData==null) + $scope.label='Add Service Name' + else{ + $scope.label='Edit Service Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editCLService = message.closedLoopServiceDictionaryData; + + $scope.saveCLServiceDict = function(closedLoopServiceDictionaryData) { + var uuu = papUrl + "/ecomp/cl_dictionary/save_service.htm"; + var postData={closedLoopServiceDictionaryData: closedLoopServiceDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.closedLoopServiceDictionaryDatas=data.closedLoopServiceDictionaryDatas;}); + if($scope.closedLoopServiceDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop Service Dictionary exists with Same Service Name.") + }else{ + console.log($scope.closedLoopServiceDictionaryDatas); + $modalInstance.close({closedLoopServiceDictionaryDatas:$scope.closedLoopServiceDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLSiteDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLSiteDictController.js new file mode 100644 index 000000000..7150ca891 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLSiteDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editCLSiteController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.closedLoopSiteDictionaryData==null) + $scope.label='Add Site Name' + else{ + $scope.label='Edit Site Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editCLSite = message.closedLoopSiteDictionaryData; + + $scope.saveCLSite = function(closedLoopSiteDictionaryData) { + var uuu = papUrl + "/ecomp/cl_dictionary/save_siteName.htm"; + var postData={closedLoopSiteDictionaryData: closedLoopSiteDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.closedLoopSiteDictionaryDatas=data.closedLoopSiteDictionaryDatas;}); + if($scope.closedLoopSiteDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop Site Dictionary exists with Same Site Name.") + }else{ + console.log($scope.closedLoopSiteDictionaryDatas); + $modalInstance.close({closedLoopSiteDictionaryDatas:$scope.closedLoopSiteDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVarbindDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVarbindDictController.js new file mode 100644 index 000000000..03c2eb345 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVarbindDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editCLVarbindController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.varbindDictionaryData==null) + $scope.label='Add Varbind ' + else{ + $scope.label='Edit Varbind' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editCLVarbind = message.varbindDictionaryData; + + $scope.saveCLVarbind = function(varbindDictionaryData) { + var uuu = papUrl + "/ecomp/cl_dictionary/save_varbind.htm"; + var postData={varbindDictionaryData: varbindDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.varbindDictionaryDatas=data.varbindDictionaryDatas;}); + if($scope.varbindDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop Varbind Dictionary exists with Same Varbind Name.") + }else{ + console.log($scope.varbindDictionaryDatas); + $modalInstance.close({varbindDictionaryDatas:$scope.varbindDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVnfTypeDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVnfTypeDictController.js new file mode 100644 index 000000000..5b46e67a2 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVnfTypeDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editVnfTypeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.vnfTypeDictionaryData==null) + $scope.label='Add VNF Type' + else{ + $scope.label='Edit VNF Type' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editVnfType = message.vnfTypeDictionaryData; + + $scope.saveCLVnfType = function(vnfTypeDictionaryData) { + var uuu = papUrl + "/ecomp/cl_dictionary/save_vnfType.htm"; + var postData={vnfTypeDictionaryData: vnfTypeDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.vnfTypeDictionaryDatas=data.vnfTypeDictionaryDatas;}); + if($scope.vnfTypeDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop VNFType Dictionary exists with Same VNFType Name.") + }else{ + console.log($scope.vnfTypeDictionaryDatas); + $modalInstance.close({vnfTypeDictionaryDatas:$scope.vnfTypeDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVsclActionDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVsclActionDictController.js new file mode 100644 index 000000000..d69a30e7a --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVsclActionDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editVsclActionController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.vsclActionDictionaryData==null) + $scope.label='Add VSCL Action' + else{ + $scope.label='Edit VSCL Action' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editvsclAction = message.vsclActionDictionaryData; + + $scope.saveCLVSCLAction = function(vsclActionDictionaryData) { + var uuu = papUrl + "/ecomp/cl_dictionary/save_vsclAction.htm"; + var postData={vsclActionDictionaryData: vsclActionDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.vsclActionDictionaryDatas=data.vsclActionDictionaryDatas;}); + if($scope.vsclActionDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop VSCLAction Dictionary exists with Same VSCLAction Name.") + }else{ + console.log($scope.vsclActionDictionaryDatas); + $modalInstance.close({vsclActionDictionaryDatas:$scope.vsclActionDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionSettingsDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionSettingsDictController.js new file mode 100644 index 000000000..cbe99c094 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionSettingsDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editSettingsDictController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.settingsDictionaryData==null) + $scope.label='Add Decision Settings' + else{ + $scope.label='Edit Decision Settings' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editSettingsDict = message.settingsDictionaryData; + + $scope.saveDecisionSettings = function(settingsDictionaryData) { + var uuu = papUrl + "/ecomp/decision_dictionary/save_Settings.htm"; + var postData={settingsDictionaryData: settingsDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.settingsDictionaryDatas=data.settingsDictionaryDatas;}); + if($scope.settingsDictionaryDatas == "Duplicate"){ + Notification.error("Decision Dictionary exists with Same Settings Name.") + }else{ + console.log($scope.settingsDictionaryDatas); + $modalInstance.close({settingsDictionaryDatas:$scope.settingsDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DescriptiveSearchDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DescriptiveSearchDictController.js new file mode 100644 index 000000000..f78cedc24 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DescriptiveSearchDictController.js @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editDescriptiveScopeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.descriptiveScopeDictionaryData==null) + $scope.label='Add Descriptive Scope', + $scope.choices = []; + else{ + $scope.label='Edit Descriptive Scope' + $scope.disableCd=true; + $scope.choices = []; + var headers = message.descriptiveScopeDictionaryData.search; + var SplitChars = 'AND'; + if (headers.indexOf(SplitChars) >= 0) { + var splitHeader = headers.split(SplitChars); + var singleHeader = splitHeader; + var splitEqual = ':'; + for(i = 0; i < singleHeader.length; i++){ + if (singleHeader[i].indexOf(splitEqual) >= 0) { + var splitValue = singleHeader[i].split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo, 'option': key , 'number' : value }); + } + } + }else{ + var splitEqual = ':'; + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + $scope.choices.push({'id':'choice'+1, 'option': key , 'number' : value }); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editDescriptiveScope = message.descriptiveScopeDictionaryData; + + $scope.saveDescriptiveScope = function(descriptiveScopeDictionaryData) { + var finalData = extend(descriptiveScopeDictionaryData, $scope.actions[0]); + var uuu = papUrl + "/ecomp/descriptive_dictionary/save_descriptive.htm"; + var postData={descriptiveScopeDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.descriptiveScopeDictionaryDatas=data.descriptiveScopeDictionaryDatas;}); + if($scope.descriptiveScopeDictionaryDatas == "Duplicate"){ + Notification.error("Descriptive Scope Dictionary exists with Same Scope Name.") + }else{ + console.log($scope.descriptiveScopeDictionaryDatas); + $modalInstance.close({descriptiveScopeDictionaryDatas:$scope.descriptiveScopeDictionaryDatas}); + } + + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.actions = [{"attributes" : $scope.choices}]; + $scope.addNewChoice = function() { + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo}); + }; + $scope.removeChoice = function() { + var lastItem = $scope.choices.length-1; + $scope.choices.splice(lastItem); + }; + +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/EnforcerDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/EnforcerDictController.js new file mode 100644 index 000000000..caf17204f --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/EnforcerDictController.js @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editEnforcerTypeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService){ + if(message.enforcerDictionaryData==null) + $scope.label='Add Enforcing Type' + else{ + $scope.label='Edit Enforcing Type' + $scope.disableCd=true; + } + $scope.editEnforcerType = message.enforcerDictionaryData; + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.saveEnforcerType = function(enforcerDictionaryData) { + var uuu = papUrl + "/ecomp/enforcer_dictionary/save_enforcerType.htm"; + var postData={enforcerDictionaryData: enforcerDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.enforcerDictionaryDatas=data.enforcerDictionaryDatas;}); + console.log($scope.enforcerDictionaryDatas); + $modalInstance.close({enforcerDictionaryDatas:$scope.enforcerDictionaryDatas}); + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWActionListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWActionListDictController.js new file mode 100644 index 000000000..14432e9b9 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWActionListDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWActionListController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.actionListDictionaryData==null) + $scope.label='Add Action Name' + else{ + $scope.label='Edit Action Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editActionList = message.actionListDictionaryData; + + $scope.saveFWActionList = function(actionListDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/save_ActionList.htm"; + var postData={actionListDictionaryData: actionListDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.actionListDictionaryDatas=data.actionListDictionaryDatas;}); + if($scope.actionListDictionaryDatas == "Duplicate"){ + Notification.error("FW ActionList Dictionary exists with Same ActionList Name.") + }else{ + console.log($scope.actionListDictionaryDatas); + $modalInstance.close({actionListDictionaryDatas:$scope.actionListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWAddressGroupDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWAddressGroupDictController.js new file mode 100644 index 000000000..57d9ae95d --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWAddressGroupDictController.js @@ -0,0 +1,120 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWAddressGroupController = function ($scope, $modalInstance, message, FWDictionaryService, PapUrlService, UserInfoService, Notification){ + if(message.addressGroupDictionaryData==null) + $scope.label='Add Address Group', + $scope.apchoices = []; + else{ + $scope.label='Edit Address Group' + $scope.disableCd=true; + $scope.apchoices = []; + var headers = message.addressGroupDictionaryData.prefixList; + var splitEqual = ','; + if(headers != null){ + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + for(i = 0; i < splitValue.length; i++){ + var key = splitValue[i]; + $scope.apchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = headers; + $scope.apchoices.push({'id':'choice'+1, 'option': key}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getPrefixListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.prefixListDictionaryDatas = JSON.parse($scope.data.prefixListDictionaryDatas); + console.log($scope.prefixListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editAddressGroup = message.addressGroupDictionaryData; + + $scope.saveFWAddressGroup = function(addressGroupDictionaryData) { + var finalData = extend(addressGroupDictionaryData, $scope.attributeDatas[0]); + var uuu = papUrl + "/ecomp/fw_dictionary/save_addressGroup.htm"; + var postData={addressGroupDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.addressGroupDictionaryDatas=data.addressGroupDictionaryDatas;}); + if($scope.addressGroupDictionaryDatas == "Duplicate"){ + Notification.error("FW AddressGroup Dictionary exists with Same Address group Name.") + }else{ + console.log($scope.addressGroupDictionaryDatas); + $modalInstance.close({addressGroupDictionaryDatas:$scope.addressGroupDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.attributeDatas = [{"attributes" : $scope.apchoices}]; + $scope.addAPNewChoice = function() { + var newItemNo = $scope.apchoices.length+1; + $scope.apchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeAPChoice = function() { + var lastItem = $scope.apchoices.length-1; + $scope.apchoices.splice(lastItem); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWParentListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWParentListDictController.js new file mode 100644 index 000000000..d73faf5f7 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWParentListDictController.js @@ -0,0 +1,156 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWParentListController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, FWDictionaryService, Notification){ + if(message.fwDictListDictionaryData==null){ + $scope.slchoices = []; + $scope.alchoices = []; + $scope.label='Add Parent List' + }else{ + $scope.label='Edit Parent List' + $scope.disableCd=true; + $scope.slchoices = []; + $scope.alchoices = []; + var slList = message.fwDictListDictionaryData.serviceList; + var alList = message.fwDictListDictionaryData.addressList; + var splitEqual = ','; + if(slList != null){ + if (slList.indexOf(splitEqual) >= 0) { + var splitValue = slList.split(splitEqual); + for(i = 0; i < splitValue.length; i++){ + var key = splitValue[i]; + $scope.slchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = slList; + $scope.slchoices.push({'id':'choice'+1, 'option': key}); + } + } + if(alList != null){ + if (alList.indexOf(splitEqual) >= 0) { + var splitALValue = alList.split(splitEqual); + for(i = 0; i < splitALValue.length; i++){ + var key = splitALValue[i]; + $scope.alchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = alList; + $scope.alchoices.push({'id':'choice'+1, 'option': key}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getServiceListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.serviceListDictionaryDatas = JSON.parse($scope.data.serviceListDictionaryDatas); + console.log($scope.serviceListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getAddressGroupDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.addressGroupDictionaryDatas = JSON.parse($scope.data.addressGroupDictionaryDatas); + console.log($scope.addressGroupDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editParentList = message.fwDictListDictionaryData; + + $scope.saveFWParentList = function(fwDictListDictionaryData) { + var addSLData = extend(fwDictListDictionaryData, $scope.attributeDatas[0]); + var finalData = extend(addSLData, $scope.attributeALDatas[0]); + var uuu = papUrl + "/ecomp/fw_dictionary/save_FWDictionaryList.htm"; + var postData={fwDictListDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.fwDictListDictionaryDatas=data.fwDictListDictionaryDatas;}); + if($scope.fwDictListDictionaryDatas == "Duplicate"){ + Notification.error("FW DictionaryList Dictionary exists with Same Name.") + }else{ + console.log($scope.fwDictListDictionaryDatas); + $modalInstance.close({fwDictListDictionaryDatas:$scope.fwDictListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + + $scope.attributeDatas = [{"attributes" : $scope.slchoices}]; + $scope.addServiceGroupNewChoice = function() { + var newItemNo = $scope.slchoices.length+1; + $scope.slchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeServiceGroupChoice = function() { + var lastItem = $scope.slchoices.length-1; + $scope.slchoices.splice(lastItem); + }; + + $scope.attributeALDatas = [{"alAttributes" : $scope.alchoices}]; + $scope.addAddressGroupNewChoice = function() { + var newItemNo = $scope.alchoices.length+1; + $scope.alchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeAddressGroupChoice = function() { + var lastItem = $scope.alchoices.length-1; + $scope.alchoices.splice(lastItem); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPortListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPortListDictController.js new file mode 100644 index 000000000..a2fbfe6d2 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPortListDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWPortListController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.portListDictionaryData==null) + $scope.label='Add Port Name' + else{ + $scope.label='Edit Port Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPortList = message.portListDictionaryData; + + $scope.saveFWPortList = function(portListDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/save_portName.htm"; + var postData={portListDictionaryData: portListDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.portListDictionaryDatas=data.portListDictionaryDatas;}); + if($scope.portListDictionaryDatas == "Duplicate"){ + Notification.error("FW PortList Dictionary exists with Same Port Name.") + }else{ + console.log($scope.portListDictionaryDatas); + $modalInstance.close({portListDictionaryDatas:$scope.portListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js new file mode 100644 index 000000000..f4e66e09c --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWPrefixListController = function ($scope, $modalInstance, message, Notification, PapUrlService, UserInfoService, Notification){ + $scope.validate = 'false'; + if(message.prefixListDictionaryData==null) + $scope.label='Add PrefixList' + else{ + $scope.label='Edit PrefixList' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPrefixList = message.prefixListDictionaryData; + + $scope.saveFWPrefixList = function(prefixListDictionaryData) { + if($scope.validate == 'true'){ + var uuu = papUrl + "/ecomp/fw_dictionary/save_prefixList.htm"; + var postData={prefixListDictionaryData: prefixListDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.prefixListDictionaryDatas=data.prefixListDictionaryDatas;}); + if($scope.prefixListDictionaryDatas == "Duplicate"){ + Notification.error("FW PrefixList Dictionary exists with Same PrefixList Name.") + }else{ + console.log($scope.prefixListDictionaryDatas); + $modalInstance.close({prefixListDictionaryDatas:$scope.prefixListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }else{ + Notification.error('Prefix List Validation is Not Successful'); + } + + }; + + $scope.validateFWPrefixList = function(prefixListDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/validate_prefixList.htm"; + var postData={prefixListDictionaryData: prefixListDictionaryData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.result=data.result;}); + console.log($scope.result); + if($scope.result == 'error'){ + Notification.error('IP not according to CIDR notation'); + }else{ + $scope.validate = 'true'; + } + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWProtocolListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWProtocolListDictController.js new file mode 100644 index 000000000..4de12b8fe --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWProtocolListDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWProtocolListController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.protocolListDictionaryData==null) + $scope.label='Add Protocol Name' + else{ + $scope.label='Edit Protocol Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editProtocolList = message.protocolListDictionaryData; + + $scope.saveProtocolList = function(protocolListDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/save_protocolList.htm"; + var postData={protocolListDictionaryData: protocolListDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.protocolListDictionaryDatas=data.protocolListDictionaryDatas;}); + if($scope.protocolListDictionaryDatas == "Duplicate"){ + Notification.error("FW ProtocolList Dictionary exists with Same Protocol Name.") + }else{ + console.log($scope.protocolListDictionaryDatas); + $modalInstance.close({protocolListDictionaryDatas:$scope.protocolListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWSecurityZoneDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWSecurityZoneDictController.js new file mode 100644 index 000000000..cd43a41b8 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWSecurityZoneDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editfwSecurityZoneController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.securityZoneDictionaryData==null) + $scope.label='Add Security Zone' + else{ + $scope.label='Edit Security Zone' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editSecurityZone = message.securityZoneDictionaryData; + + $scope.saveSecurityZone = function(securityZoneDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/save_securityZone.htm"; + var postData={securityZoneDictionaryData: securityZoneDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.securityZoneDictionaryDatas=data.securityZoneDictionaryDatas;}); + if($scope.securityZoneDictionaryDatas == "Duplicate"){ + Notification.error("FW SecurityZone Dictionary exists with Same Zone Name.") + }else{ + console.log($scope.securityZoneDictionaryDatas); + $modalInstance.close({securityZoneDictionaryDatas:$scope.securityZoneDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceGroupDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceGroupDictController.js new file mode 100644 index 000000000..3cf6d9be7 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceGroupDictController.js @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWServiceGroupController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, FWDictionaryService, Notification){ + if(message.serviceGroupDictionaryData==null){ + $scope.slchoices = []; + $scope.label='Add Service Group' + }else{ + $scope.label='Edit Service Group' + $scope.disableCd=true; + $scope.slchoices = []; + var headers = message.serviceGroupDictionaryData.serviceList; + var splitEqual = ','; + if(headers != null){ + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + for(i = 0; i < splitValue.length; i++){ + var key = splitValue[i]; + $scope.slchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = headers; + $scope.slchoices.push({'id':'choice'+1, 'option': key}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getServiceListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.serviceListDictionaryDatas = JSON.parse($scope.data.serviceListDictionaryDatas); + console.log($scope.serviceListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editServiceGroup = message.serviceGroupDictionaryData; + + $scope.saveFWServiceGroup = function(serviceGroupDictionaryData) { + var finalData = extend(serviceGroupDictionaryData, $scope.attributeDatas[0]); + var uuu = papUrl + "/ecomp/fw_dictionary/save_serviceGroup.htm"; + var postData={serviceGroupDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.serviceGroupDictionaryDatas=data.serviceGroupDictionaryDatas;}); + if($scope.serviceGroupDictionaryDatas == "Duplicate"){ + Notification.error("FW Service Group Dictionary exists with Same Group Name.") + }else{ + console.log($scope.serviceGroupDictionaryDatas); + $modalInstance.close({serviceGroupDictionaryDatas:$scope.serviceGroupDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + + + $scope.attributeDatas = [{"attributes" : $scope.slchoices}]; + $scope.addServiceGroupNewChoice = function() { + var newItemNo = $scope.slchoices.length+1; + $scope.slchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeServiceGroupChoice = function() { + var lastItem = $scope.slchoices.length-1; + $scope.slchoices.splice(lastItem); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceListDictController.js new file mode 100644 index 000000000..73da6c486 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceListDictController.js @@ -0,0 +1,147 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWServiceListController = function ($scope, $modalInstance, message, FWDictionaryService, PapUrlService, UserInfoService, Notification){ + $scope.protocolListDictionaryDatas =[]; + + $scope.tpchoices = []; + $scope.apchoices = []; + if(message.serviceListDictionaryData==null){ + $scope.label='Add Service List' + }else{ + $scope.label='Edit Service List' + $scope.disableCd=true; + var tcpheaders = message.serviceListDictionaryData.serviceTransProtocol; + var splitEqual = ','; + if(tcpheaders != null){ + if (tcpheaders.indexOf(splitEqual) >= 0) { + var splitValue = tcpheaders.split(splitEqual); + for(i = 0; i < splitValue.length; i++){ + var key = splitValue[i]; + $scope.tpchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = tcpheaders; + $scope.tpchoices.push({'id':'choice'+1, 'option': key}); + } + } + var appheaders = message.serviceListDictionaryData.serviceAppProtocol; + var splitEqual1 = ','; + if(appheaders != null){ + if (appheaders.indexOf(splitEqual1) >= 0) { + var splitValue1 = appheaders.split(splitEqual1); + for(i = 0; i < splitValue1.length; i++){ + var key1 = splitValue1[i]; + $scope.apchoices.push({'id':'choice'+i+1, 'option': key1}); + } + }else{ + var key1 = appheaders; + $scope.apchoices.push({'id':'choice'+1, 'option': key1}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getProtocolListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.protocolListDictionaryDatas = JSON.parse($scope.data.protocolListDictionaryDatas); + console.log($scope.protocolListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editServiceList = message.serviceListDictionaryData; + + $scope.saveFWServiceList = function(serviceListDictionaryData) { + var addtcpData = extend(serviceListDictionaryData, $scope.attributeTCPDatas[0]); + var finalData = extend(addtcpData, $scope.attributeAPPDatas[0]); + var uuu = papUrl + "/ecomp/fw_dictionary/save_serviceList.htm"; + var postData={serviceListDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.serviceListDictionaryDatas=data.serviceListDictionaryDatas;}); + if($scope.serviceListDictionaryDatas == "Duplicate"){ + Notification.error("FW ServiceList Dictionary exists with Same ServiceList Name.") + }else{ + console.log($scope.serviceListDictionaryDatas); + $modalInstance.close({serviceListDictionaryDatas:$scope.serviceListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.attributeTCPDatas = [{"transportProtocols" : $scope.tpchoices}]; + $scope.addTPNewChoice = function() { + var newItemNo = $scope.tpchoices.length+1; + $scope.tpchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeTPChoice = function() { + var lastItem = $scope.tpchoices.length-1; + $scope.tpchoices.splice(lastItem); + }; + + + $scope.attributeAPPDatas = [{"appProtocols" : $scope.apchoices}]; + $scope.addAPNewChoice = function() { + var newItemNo = $scope.apchoices.length+1; + $scope.apchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeAPChoice = function() { + var lastItem = $scope.apchoices.length-1; + $scope.apchoices.splice(lastItem); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js new file mode 100644 index 000000000..8615082a2 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js @@ -0,0 +1,331 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWTermListController = function ($scope, $modalInstance, message, FWDictionaryService, PapUrlService, UserInfoService, Notification){ + $scope.fromZonechoices = []; + $scope.toZonechoices = []; + $scope.sourceListchoices = []; + $scope.destinationListchoices = []; + $scope.sourceServicechoices = []; + $scope.destinationServicechoices = []; + $scope.actionListchoices = []; + if(message.termListDictionaryData==null){ + $scope.label='Add Term List Name' + }else{ + $scope.label='Edit Term List Name' + $scope.disableCd=true; + var fromZoneheaders = message.termListDictionaryData.fromZone; + var splitFromZone = ','; + if(fromZoneheaders != null){ + if (fromZoneheaders.indexOf(splitFromZone) >= 0) { + var splitFromZoneValue = fromZoneheaders.split(splitFromZone); + for(i = 0; i < splitFromZoneValue.length; i++){ + var key = splitFromZoneValue[i]; + $scope.fromZonechoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = fromZoneheaders; + $scope.fromZonechoices.push({'id':'choice'+1, 'option': key}); + } + } + + var toZoneheaders = message.termListDictionaryData.toZone; + var splitToZone = ','; + if(toZoneheaders != null){ + if (toZoneheaders.indexOf(splitToZone) >= 0) { + var splitToZoneValue = toZoneheaders.split(splitToZone); + for(i = 0; i < splitToZoneValue.length; i++){ + var key = splitToZoneValue[i]; + $scope.toZonechoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = toZoneheaders; + $scope.toZonechoices.push({'id':'choice'+1, 'option': key}); + } + } + + var srcIPheaders = message.termListDictionaryData.srcIPList; + var splitSrcIP = ','; + if(srcIPheaders != null){ + if (srcIPheaders.indexOf(splitSrcIP) >= 0) { + var splitSrcIPValue = srcIPheaders.split(splitSrcIP); + for(i = 0; i < splitSrcIPValue.length; i++){ + var key = splitSrcIPValue[i]; + $scope.sourceListchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = srcIPheaders; + $scope.sourceListchoices.push({'id':'choice'+1, 'option': key}); + } + } + + var desIPheaders = message.termListDictionaryData.destIPList; + var splitDesIP = ','; + if(desIPheaders != null){ + if (desIPheaders.indexOf(splitDesIP) >= 0) { + var splitDestIPValue = desIPheaders.split(splitDesIP); + for(i = 0; i < splitDestIPValue.length; i++){ + var key = splitDestIPValue[i]; + $scope.destinationListchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = desIPheaders; + $scope.destinationListchoices.push({'id':'choice'+1, 'option': key}); + } + } + + var srcServheaders = message.termListDictionaryData.srcPortList; + var splitSrcServ = ','; + if(srcServheaders != null){ + if (srcServheaders.indexOf(splitSrcServ) >= 0) { + var splitSrcServValue = srcServheaders.split(splitSrcServ); + for(i = 0; i < splitSrcServValue.length; i++){ + var key = splitSrcServValue[i]; + $scope.sourceServicechoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = srcServheaders; + $scope.sourceServicechoices.push({'id':'choice'+1, 'option': key}); + } + } + + var desServheaders = message.termListDictionaryData.destPortList; + var splitdesSer = ','; + if(desServheaders != null){ + if (desServheaders.indexOf(splitdesSer) >= 0) { + var splitDesSerValue = desServheaders.split(splitdesSer); + for(i = 0; i < splitDesSerValue.length; i++){ + var key = splitDesSerValue[i]; + $scope.destinationServicechoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = desServheaders; + $scope.destinationServicechoices.push({'id':'choice'+1, 'option': key}); + } + } + + var actionheaders = message.termListDictionaryData.action; + var splitAction = ','; + if(actionheaders != null){ + if (actionheaders.indexOf(splitAction) >= 0) { + var splitActionValue = actionheaders.split(splitAction); + for(i = 0; i < splitActionValue.length; i++){ + var key = splitActionValue[i]; + $scope.actionListchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = actionheaders; + $scope.actionListchoices.push({'id':'choice'+1, 'option': key}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getPrefixListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.prefixListDictionaryDatas = JSON.parse($scope.data.prefixListDictionaryDatas); + console.log($scope.prefixListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getZoneDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.zoneDictionaryDatas = JSON.parse($scope.data.zoneDictionaryDatas); + console.log($scope.zoneDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getAddressGroupDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.addressGroupDictionaryDatas = JSON.parse($scope.data.addressGroupDictionaryDatas); + console.log($scope.addressGroupDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getServiceListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.serviceListDictionaryDatas = JSON.parse($scope.data.serviceListDictionaryDatas); + console.log($scope.serviceListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getServiceGroupDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.serviceGroupDictionaryDatas = JSON.parse($scope.data.serviceGroupDictionaryDatas); + console.log($scope.serviceGroupDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getActionListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.actionListDictionaryDatas = JSON.parse($scope.data.actionListDictionaryDatas); + console.log($scope.actionListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editTermList = message.termListDictionaryData; + + $scope.saveTermName = function(termListDictionaryData) { + var mergeFromZoneData = extend(termListDictionaryData, $scope.fromZoneDatas[0]); + var mergeToData = extend(mergeFromZoneData, $scope.toZoneDatas[0]); + var mergeSourceListData = extend(mergeToData, $scope.sourceListDatas[0]); + var mergeDListData = extend(mergeSourceListData, $scope.destinationListDatas[0]); + var mergeSServicesData = extend(mergeDListData, $scope.sourceServicesDatas[0]); + var mergeDServicesData = extend(mergeSServicesData, $scope.destinationServicesDatas[0]); + var finalData = extend(mergeDServicesData, $scope.actionListDatas[0]); + var uuu = papUrl + "/ecomp/fw_dictionary/save_termList.htm"; + var postData={termListDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.termListDictionaryDatas=data.termListDictionaryDatas;}); + if($scope.termListDictionaryDatas == "Duplicate"){ + Notification.error("FW TermList Dictionary exists with Same Term Name.") + }else{ + console.log($scope.termListDictionaryDatas); + $modalInstance.close({termListDictionaryDatas:$scope.termListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.fromZoneDatas = [{"fromZoneDatas" : $scope.fromZonechoices}]; + $scope.addFromZoneNewChoice = function() { + var newItemNo = $scope.fromZonechoices.length+1; + $scope.fromZonechoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeFromZoneChoice = function() { + var lastItem = $scope.fromZonechoices.length-1; + $scope.fromZonechoices.splice(lastItem); + }; + + $scope.toZoneDatas = [{"toZoneDatas" : $scope.toZonechoices}]; + $scope.addToZoneNewChoice = function() { + var newItemNo = $scope.toZonechoices.length+1; + $scope.toZonechoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeToZoneChoice = function() { + var lastItem = $scope.toZonechoices.length-1; + $scope.toZonechoices.splice(lastItem); + }; + + $scope.sourceListDatas = [{"sourceListDatas" : $scope.sourceListchoices}]; + $scope.addSourceListNewChoice = function() { + var newItemNo = $scope.sourceListchoices.length+1; + $scope.sourceListchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeSourceListChoice = function() { + var lastItem = $scope.sourceListchoices.length-1; + $scope.sourceListchoices.splice(lastItem); + }; + + $scope.destinationListDatas = [{"destinationListDatas" : $scope.destinationListchoices}]; + $scope.addDListNewChoice = function() { + var newItemNo = $scope.destinationListchoices.length+1; + $scope.destinationListchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeDlistChoice = function() { + var lastItem = $scope.destinationListchoices.length-1; + $scope.destinationListchoices.splice(lastItem); + }; + + $scope.sourceServicesDatas = [{"sourceServiceDatas" : $scope.sourceServicechoices}]; + $scope.addSourceServiceNewChoice = function() { + var newItemNo = $scope.sourceServicechoices.length+1; + $scope.sourceServicechoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeSourceServiceChoice = function() { + var lastItem = $scope.sourceServicechoices.length-1; + $scope.sourceServicechoices.splice(lastItem); + }; + + $scope.destinationServicesDatas = [{"destinationServiceDatas" : $scope.destinationServicechoices}]; + $scope.addDServicesNewChoice = function() { + var newItemNo = $scope.destinationServicechoices.length+1; + $scope.destinationServicechoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeDServicesChoice = function() { + var lastItem = $scope.destinationServicechoices.length-1; + $scope.destinationServicechoices.splice(lastItem); + }; + + $scope.actionListDatas = [{"actionListDatas" : $scope.actionListchoices}]; + $scope.addActionListNewChoice = function() { + var newItemNo = $scope.actionListchoices.length+1; + $scope.actionListchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeActionListChoice = function() { + var lastItem = $scope.actionListchoices.length-1; + $scope.actionListchoices.splice(lastItem); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWZoneDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWZoneDictController.js new file mode 100644 index 000000000..8780ddd35 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWZoneDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWZoneController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.zoneDictionaryData==null) + $scope.label='Add Zone Name' + else{ + $scope.label='Edit Zone Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editZoneName = message.zoneDictionaryData; + + $scope.saveZoneName = function(zoneDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/save_zoneName.htm"; + var postData={zoneDictionaryData: zoneDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.zoneDictionaryDatas=data.zoneDictionaryDatas;}); + if($scope.zoneDictionaryDatas == "Duplicate"){ + Notification.error("FW Zone Dictionary exists with Same Zone Name.") + }else{ + console.log($scope.zoneDictionaryDatas); + $modalInstance.close({zoneDictionaryDatas:$scope.zoneDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js new file mode 100644 index 000000000..d96a62ad8 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editMSConfigController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.microServiceCongigNameDictionaryData==null) + $scope.label='Add Config Name' + else{ + $scope.label='Edit Config Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editMSConfig = message.microServiceCongigNameDictionaryData; + + $scope.saveMSConfig = function(microServiceCongigNameDictionaryData) { + var uuu = papUrl + "/ecomp/ms_dictionary/save_configName.htm"; + var postData={microServiceCongigNameDictionaryData: microServiceCongigNameDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.microServiceCongigNameDictionaryDatas=data.microServiceCongigNameDictionaryDatas;}); + if($scope.microServiceCongigNameDictionaryDatas == "Duplicate"){ + Notification.error("MS ConfigName Dictionary exists with Same Config Name.") + }else{ + console.log($scope.microServiceCongigNameDictionaryDatas); + $modalInstance.close({microServiceCongigNameDictionaryDatas:$scope.microServiceCongigNameDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSDcaeUUIDDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSDcaeUUIDDictController.js new file mode 100644 index 000000000..c08dbbe22 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSDcaeUUIDDictController.js @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editDCAEuuidController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.dcaeUUIDDictionaryData==null) + $scope.label='Add Micro Service UUID' + else{ + $scope.label='Edit Micro Service UUID' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editDCAEuuid = message.dcaeUUIDDictionaryData; + + $scope.saveDCAEUUID = function(dcaeUUIDDictionaryData) { + var uuu = papUrl + "/ecomp/ms_dictionary/save_dcaeUUID.htm"; + var postData={dcaeUUIDDictionaryData: dcaeUUIDDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.dcaeUUIDDictionaryDatas=data.dcaeUUIDDictionaryDatas;}); + if($scope.dcaeUUIDDictionaryDatas == "Duplicate"){ + Notification.error("MS DCAEUUID Dictionary exists with Same DCAEUUID Name.") + }else{ + console.log($scope.dcaeUUIDDictionaryDatas); + $modalInstance.close({dcaeUUIDDictionaryDatas:$scope.dcaeUUIDDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSLocationDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSLocationDictController.js new file mode 100644 index 000000000..001f635a9 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSLocationDictController.js @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editMSLocationController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.microServiceLocationDictionaryData==null) + $scope.label='Add Micro Service Location' + else{ + $scope.label='Edit Micro Service Location' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editMSLocation = message.microServiceLocationDictionaryData; + + $scope.saveMSLocation = function(microServiceLocationDictionaryData) { + var uuu = papUrl + "/ecomp/ms_dictionary/save_location.htm"; + var postData={microServiceLocationDictionaryData: microServiceLocationDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.microServiceLocationDictionaryDatas=data.microServiceLocationDictionaryDatas;}); + if($scope.microServiceLocationDictionaryDatas == "Duplicate"){ + Notification.error("MS Location Dictionary exists with Same Location Name.") + }else{ + console.log($scope.microServiceLocationDictionaryDatas); + $modalInstance.close({microServiceLocationDictionaryDatas:$scope.microServiceLocationDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js new file mode 100644 index 000000000..101f2c1c9 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js @@ -0,0 +1,87 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editMSModelController = function ($scope, $modalInstance, message, $http, PapUrlService, UserInfoService, Notification){ + if(message.microServiceModelsDictionaryData==null) + $scope.label='Add Micro Service Model' + else{ + $scope.label='Edit Micro Service Model' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editMSmodelName = message.microServiceModelsDictionaryData; + + $scope.uploadFile = function(files) { + var fd = new FormData(); + fd.append("file", files[0]); + $http.post(papUrl + "/ecomp/ms_dictionary/set_MSModelData.htm", fd, { + withCredentials: false, + headers: {'Content-Type': undefined }, + transformRequest: angular.identity + }).success().error( ); + + }; + + $scope.saveMSModel = function(microServiceModelsDictionaryData) { + var uuu = papUrl + "/ecomp/ms_dictionary/save_model.htm"; + var postData={microServiceModelsDictionaryData: microServiceModelsDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.microServiceModelsDictionaryDatas=data.microServiceModelsDictionaryDatas;}); + if($scope.microServiceModelsDictionaryDatas == "Duplicate"){ + Notification.error("MS Models Dictionary exists with Same Model Name.") + }else{ + console.log($scope.microServiceModelsDictionaryDatas); + $modalInstance.close({microServiceModelsDictionaryDatas:$scope.microServiceModelsDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSClosedLoopDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSClosedLoopDictController.js new file mode 100644 index 000000000..6986209cd --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSClosedLoopDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPSClosedLoopController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.psClosedLoopDictionaryData==null) + $scope.label='Add New Policy Scope ClosedLoop' + else{ + $scope.label='Edit Policy Scope ClosedLoop' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPSClosedLoop = message.psClosedLoopDictionaryData; + + $scope.savePSClosedLoop = function(psClosedLoopDictionaryData) { + var uuu = papUrl + "/ecomp/ps_dictionary/save_psClosedLoop.htm"; + var postData={psClosedLoopDictionaryData: psClosedLoopDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.psClosedLoopDictionaryDatas=data.psClosedLoopDictionaryDatas;}); + if($scope.psClosedLoopDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop Dictionary exists with Same ClosedLoop Name.") + }else{ + console.log($scope.psClosedLoopDictionaryDatas); + $modalInstance.close({psClosedLoopDictionaryDatas:$scope.psClosedLoopDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js new file mode 100644 index 000000000..ec1c575df --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPSGroupPolicyScopeController = function ($scope, $modalInstance, message, PolicyScopeService, PapUrlService, UserInfoService, Notification){ + $scope.edit = false; + if(message.groupPolicyScopeListData==null) + $scope.label='Add New Group Policy Scope' + else{ + $scope.label='Edit Group Policy Scope' + $scope.disableCd=true; + $scope.edit = true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + PolicyScopeService.getPSServiceDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psServiceDictionaryDatas = JSON.parse($scope.data.psServiceDictionaryDatas); + console.log($scope.psServiceDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyScopeService.getPSTypeDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psTypeDictionaryDatas = JSON.parse($scope.data.psTypeDictionaryDatas); + console.log($scope.psTypeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyScopeService.getPSResourceDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psResourceDictionaryDatas = JSON.parse($scope.data.psResourceDictionaryDatas); + console.log($scope.psResourceDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyScopeService.getPSClosedLoopDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psClosedLoopDictionaryDatas = JSON.parse($scope.data.psClosedLoopDictionaryDatas); + console.log($scope.psClosedLoopDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPSGroupPolicyScope = message.groupPolicyScopeListData; + $scope.editPSGroupPolicyScope1 = {resource: [], type:[], service: [], closedloop: []}; + if($scope.edit){ + if(message.groupPolicyScopeListData.groupList != null){ + var splitValue = message.groupPolicyScopeListData.groupList.split(","); + console.log(splitValue); + $scope.splittedGroupListValues = []; + var splitResource = splitValue[0].split("="); + $scope.editPSGroupPolicyScope1.resource.push(splitResource[1]); + var splitType = splitValue[1].split("="); + $scope.editPSGroupPolicyScope1.type.push(splitType[1]); + var splitService = splitValue[2].split("="); + $scope.editPSGroupPolicyScope1.service.push(splitService[1]); + var splitCloop = splitValue[3].split("="); + $scope.editPSGroupPolicyScope1.closedloop.push(splitCloop[1]); + } + } + + $scope.savePSGroupPolicyScope = function(groupPolicyScopeListData, groupPolicyScopeListData1) { + console.log(groupPolicyScopeListData1); + var uuu = papUrl + "/ecomp/ps_dictionary/save_psGroupPolicyScope.htm"; + var postData={groupPolicyScopeListData: groupPolicyScopeListData, + groupPolicyScopeListData1: groupPolicyScopeListData1, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.groupPolicyScopeListDatas=data.groupPolicyScopeListDatas;}); + if($scope.groupPolicyScopeListDatas == "Duplicate"){ + Notification.error("GroupPolicyScope Dictionary exists with Same Group Name.") + }else if($scope.groupPolicyScopeListDatas == "DuplicateGroup"){ + Notification.error("GroupPolicyScope Dictionary exists with Same Group List.") + }else{ + console.log($scope.groupPolicyScopeListDatas); + $modalInstance.close({groupPolicyScopeListDatas:$scope.groupPolicyScopeListDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSResourceDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSResourceDictController.js new file mode 100644 index 000000000..7aaf21834 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSResourceDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPSResourceController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.psResourceDictionaryData==null) + $scope.label='Add New Resource' + else{ + $scope.label='Edit Resource' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPSResource = message.psResourceDictionaryData; + + $scope.savePSResource = function(psResourceDictionaryData) { + var uuu = papUrl + "/ecomp/ps_dictionary/save_psResource.htm"; + var postData={psResourceDictionaryData: psResourceDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.psResourceDictionaryDatas=data.psResourceDictionaryDatas;}); + if($scope.psResourceDictionaryDatas == "Duplicate"){ + Notification.error("Resource Dictionary exists with Same Resource Name.") + }else{ + console.log($scope.psResourceDictionaryDatas); + $modalInstance.close({psResourceDictionaryDatas:$scope.psResourceDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSServiceDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSServiceDictController.js new file mode 100644 index 000000000..5cccf30ad --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSServiceDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPSServiceController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.psServiceDictionaryData==null) + $scope.label='Add New Service' + else{ + $scope.label='Edit Service' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPSService = message.psServiceDictionaryData; + + $scope.savePSService = function(psServiceDictionaryData) { + var uuu = papUrl + "/ecomp/ps_dictionary/save_psService.htm"; + var postData={psServiceDictionaryData: psServiceDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.psServiceDictionaryDatas=data.psServiceDictionaryDatas;}); + if($scope.psServiceDictionaryDatas == "Duplicate"){ + Notification.error("Service Dictionary exists with Same Service Name.") + }else{ + console.log($scope.psServiceDictionaryDatas); + $modalInstance.close({psServiceDictionaryDatas:$scope.psServiceDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSTypeDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSTypeDictController.js new file mode 100644 index 000000000..b3d5b833b --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSTypeDictController.js @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPSTypeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.psTypeDictionaryData==null) + $scope.label='Add New Type' + else{ + $scope.label='Edit Type' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPSType = message.psTypeDictionaryData; + + $scope.savePSType = function(psTypeDictionaryData) { + var uuu = papUrl + "/ecomp/ps_dictionary/save_psType.htm"; + var postData={psTypeDictionaryData: psTypeDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.psTypeDictionaryDatas=data.psTypeDictionaryDatas;}); + console.log($scope.psTypeDictionaryDatas); + if($scope.psTypeDictionaryDatas == "Duplicate"){ + Notification.error("Type Dictionary exists with Same Type Name.") + }else{ + console.log($scope.psTypeDictionaryDatas); + $modalInstance.close({psTypeDictionaryDatas:$scope.psTypeDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/RiskTypeDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/RiskTypeDictController.js new file mode 100644 index 000000000..9df0d4771 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/RiskTypeDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editRiskTypeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.riskTypeDictionaryData==null) + $scope.label='Add New Type' + else{ + $scope.label='Edit Type' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editRiskType = message.riskTypeDictionaryData; + + $scope.saveRiskType = function(riskTypeDictionaryData) { + var uuu = papUrl + "/ecomp/sp_dictionary/save_riskType.htm"; + var postData={riskTypeDictionaryData: riskTypeDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.riskTypeDictionaryDatas=data.riskTypeDictionaryDatas;}); + if($scope.riskTypeDictionaryDatas == "Duplicate"){ + Notification.error("Risk type Dictionary exists with Same RiskType Name.") + }else{ + console.log($scope.riskTypeDictionaryDatas); + $modalInstance.close({riskTypeDictionaryDatas:$scope.riskTypeDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/SafePolicyWarningDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/SafePolicyWarningDictController.js new file mode 100644 index 000000000..4fe700768 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/SafePolicyWarningDictController.js @@ -0,0 +1,107 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editSafePolicyWarningController = function ($scope, $modalInstance, message, SafePolicyService, PapUrlService, UserInfoService, Notification){ + $scope.edit = false; + if(message.safePolicyWarningData==null) + $scope.label='Add New Safe Policy Warning' + else{ + $scope.label='Edit Safe Policy Warning' + $scope.disableCd=true; + $scope.edit = true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + SafePolicyService.getSafePolicyWarningDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.safePolicyWarningDatas = JSON.parse($scope.data.safePolicyWarningDatas); + console.log($scope.safePolicyWarningDatas); + }, function (error) { + console.log("failed"); + }); + SafePolicyService.getRiskTypeDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas); + console.log($scope.riskTypeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editSafePolicyWarning = message.safePolicyWarningData; + $scope.editSafePolicyWarning1 = {resource: [], type:[], service: [], closedloop: []}; + if($scope.edit){ + if(message.safePolicyWarningData.groupList != null){ + var splitValue = message.safePolicyWarningData.groupList.split(","); + console.log(splitValue); + $scope.splittedGroupListValues = []; + var splitResource = splitValue[0].split("="); + $scope.editSafePolicyWarningScope1.riskType.push(splitResource[1]); + } + } + + $scope.saveSafePolicyWarning = function(safePolicyWarningData) { + console.log(safePolicyWarningData); + var uuu = papUrl + "/ecomp/sp_dictionary/save_safePolicyWarning.htm"; + var postData={safePolicyWarningData: safePolicyWarningData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.safePolicyWarningDatas=data.safePolicyWarningDatas;}); + if($scope.safePolicyWarningDatas == "Duplicate"){ + Notification.error("Safe Policy Dictionary exists with Same Name.") + }else{ + console.log($scope.safePolicyWarningDatas); + $modalInstance.close({safePolicyWarningDatas:$scope.safePolicyWarningDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/actionPolicyDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/actionPolicyDictController.js new file mode 100644 index 000000000..b889a98cb --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/actionPolicyDictController.js @@ -0,0 +1,119 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editActionPolicyDictController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.actionPolicyDictionaryData==null) + $scope.label='Add Action Dictionary', + $scope.choices = []; + else{ + $scope.choices = []; + $scope.label='Edit Action Dictionary' + $scope.disableCd=true; + var headers = message.actionPolicyDictionaryData.header; + var SplitChars = ':'; + if (headers.indexOf(SplitChars) >= 0) { + var splitHeader = headers.split(SplitChars); + var singleHeader = splitHeader; + var splitEqual = '='; + for(i = 0; i < singleHeader.length; i++){ + if (singleHeader[i].indexOf(splitEqual) >= 0) { + var splitValue = singleHeader[i].split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo, 'option': key , 'number' : value }); + } + } + }else{ + var splitEqual = '='; + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + $scope.choices.push({'id':'choice'+1, 'option': key , 'number' : value }); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editActionDict = message.actionPolicyDictionaryData; + $scope.saveActionDict = function(actionPolicyDictionaryData) { + var finalData = extend(actionPolicyDictionaryData, $scope.headerDatas[0]); + var uuu = papUrl + "/ecomp/action_dictionary/save_ActionDict.htm"; + var postData={actionPolicyDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.actionPolicyDictionaryDatas=data.actionPolicyDictionaryDatas;}); + if($scope.actionPolicyDictionaryDatas == "Duplicate"){ + Notification.error("ActionPolicy Dictionary exists with Same Attribute Name.") + }else{ + console.log($scope.actionPolicyDictionaryDatas); + $modalInstance.close({actionPolicyDictionaryDatas:$scope.actionPolicyDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.headerDatas = [{"headers" : $scope.choices}]; + $scope.addNewChoice = function() { + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo}); + }; + $scope.removeChoice = function() { + var lastItem = $scope.choices.length-1; + $scope.choices.splice(lastItem); + }; + +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js new file mode 100644 index 000000000..9e32f0304 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editAttributeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.attributeDictionaryData==null) + $scope.label='Add New Attribute', + $scope.attributes = []; + else{ + $scope.attributes = []; + $scope.label='Edit Attribute' + $scope.disableCd=true; + var headers = message.attributeDictionaryData.attributeValue; + var splitEqual = ','; + if(headers != null){ + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + for(i = 0; i < splitValue.length; i++){ + var key = splitValue[i]; + $scope.attributes.push({'id':'choice'+i+1, 'attributeValues': key}); + } + }else{ + var key = headers; + $scope.attributes.push({'id':'choice'+1, 'attributeValues': key}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl) + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editAttributeName = message.attributeDictionaryData; + + $scope.saveAttributeName = function(attributeDictionaryData) { + var finalData = extend(attributeDictionaryData, $scope.attributeDatas[0]); + var uuu = papUrl + "/ecomp/attribute_dictionary/save_attribute.htm"; + var postData={attributeDictionaryData: attributeDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.attributeDictionaryDatas=data.attributeDictionaryDatas;}); + if($scope.attributeDictionaryDatas == "Duplicate"){ + Notification.error("Attribute Dictionary exists with Same Attribute Name.") + }else{ + console.log($scope.attributeDictionaryDatas); + $modalInstance.close({attributeDictionaryDatas:$scope.attributeDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.attributeDatas = [{"userDataTypeValues" : $scope.attributes}]; + $scope.addNewChoice = function() { + var newItemNo = $scope.attributes.length+1; + $scope.attributes.push({'id':'choice'+newItemNo}); + }; + $scope.removeChoice = function() { + var lastItem = $scope.attributes.length-1; + $scope.attributes.splice(lastItem); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/ecompNameEditorController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/ecompNameEditorController.js new file mode 100644 index 000000000..5dd19a7fc --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/ecompNameEditorController.js @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editEcompNameController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.ecompNameDictionaryData==null) + $scope.label='Add New Ecomp Name' + else{ + $scope.label='Edit Ecomp Name' + $scope.disableCd=true; + } + $scope.editEcompName = message.ecompNameDictionaryData; + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.saveEcompName = function(ecompNameDictionaryData) { + var uuu = papUrl + "/ecomp/ecomp_dictionary/save_ecompName.htm"; + var postData={ecompNameDictionaryData: ecompNameDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.ecompNameDictionaryDatas=data.ecompNameDictionaryDatas;}); + if($scope.ecompNameDictionaryDatas == "Duplicate"){ + Notification.error("EcompName Dictionary exists with Same Ecomp Name.") + }else{ + console.log($scope.ecompNameDictionaryDatas); + $modalInstance.close({ecompNameDictionaryDatas:$scope.ecompNameDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} \ No newline at end of file -- cgit 1.2.3-korg