diff options
author | Jorge Hernandez <jh1730@att.com> | 2017-05-03 21:31:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-05-03 21:31:58 +0000 |
commit | a330af579866dacbe595e2e4ad1dd29cd3c96945 (patch) | |
tree | b9455591600034dfd4f33a9c1f733336280f2208 /POLICY-SDK-APP/src/main/webapp/app/policyApp/controller | |
parent | 5444e748b8651d8346dcb78c5ab8b0637dea197b (diff) | |
parent | e0addf5b588a1244f9679becd90999dfcb4c3a94 (diff) |
Merge "Policy 1707 commit to LF"
Diffstat (limited to 'POLICY-SDK-APP/src/main/webapp/app/policyApp/controller')
94 files changed, 11289 insertions, 0 deletions
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/AutoPushController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/AutoPushController.js new file mode 100644 index 000000000..9eb90333b --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/AutoPushController.js @@ -0,0 +1,173 @@ +/*- + * ============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========================================================= + */ +app.controller('policyPushController', function ($scope, PolicyAppService, modalService, $modal, Notification,$filter){ + $( "#dialog" ).hide(); + + $scope.isDisabled = true; + $scope.loading = true; + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.isDisabled = true; + }else{ + $scope.isDisabled = false; + } + console.log($scope.data); + },function(error){ + console.log("failed"); + }); + + $scope.pdpdata; + PolicyAppService.getData('get_PDPGroupContainerData').then(function (data) { + var j = data; + $scope.pdpdata = JSON.parse(j.data); + console.log($scope.pdpdata); + $scope.pushTabPDPGrid.data = $scope.pdpdata; + }, function (error) { + console.log("failed"); + }); + + $scope.getPDPData = function(){ + $scope.pushTabPDPGrid.data = $scope.pdpdata; + }; + $scope.filterPdpGroup; + $scope.filterPDPGroupData = function() { + $scope.pushTabPDPGrid.data = $filter('filter')($scope.pdpdata, $scope.filterPdpGroup, undefined); + }; + + $scope.pushTabPDPGrid = { + onRegisterApi: function(gridApi) { + $scope.gridApi = gridApi; + }, + enableFiltering: true, + columnDefs: [ + { field: 'default',displayName : '', enableFiltering : false, enableSorting : false, + cellTemplate: '<button type="button" ng-click="grid.appScope.editPDPGroupWindow(row.entity)"><a class="fa fa-pencil-square-o"></a></i></button> ', + width: '5%' + }, + { field: 'id', displayName : 'ID'}, + { field: 'name', displayName : 'Name' }, + { field: 'description' } + ] + }; + + + $scope.editPDPGroupWindow = function (selectedPdpGroupData) { + $scope.removePDPGroupPolicies = selectedPdpGroupData; + if($scope.isDisabled){ + Notification.error("Policy Application has been LockDown."); + }else{ + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'remove_PDPGroupPolicies_popup.html', + controller: 'removeGroupPoliciesController', + resolve: { + message: function () { + var message = { + selectedPdpGroupData: $scope.removePDPGroupPolicies + }; + return message; + } + } + }); + modalInstance.result.then(function (response) { + console.log('response', response); + $scope.pdpdata = JSON.parse(response.data); + $scope.pushTabPDPGrid.data = $scope.pdpdata; + }); + } + }; + + $scope.gridOptions = { + data : 'policydatas', + onRegisterApi: function(gridApi) { + $scope.gridPolicyApi = gridApi; + }, + enableSorting: true, + enableFiltering: true, + showTreeExpandNoChildren: true, + paginationPageSizes: [10, 20, 50, 100], + paginationPageSize: 20, + columnDefs: [{name: 'policyName', displayName : 'Policy Name', sort: { direction: 'asc', priority: 0 }}, + {name: 'activeVersion', displayName : 'Version'}, + {name: 'modifiedDate', displayName : 'Last Modified',type: 'date', cellFilter: 'date:\'yyyy-MM-dd HH:MM:ss a\'' }] + }; + + + PolicyAppService.getData('get_AutoPushPoliciesContainerData').then(function (data) { + $scope.loading = false; + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.policydatas =JSON.parse($scope.data.policydatas); + console.log($scope.policydatas); + }, function (error) { + console.log("failed"); + }); + + $scope.pushPoliciesButton = function(){ + var policySelection = $scope.gridPolicyApi.selection.getSelectedRows(); + console.log(policySelection); + var currentSelection = $scope.gridApi.selection.getSelectedRows(); + if(policySelection.length == 0 && currentSelection.length == 0){ + Notification.error("Please Select Policy and PDP Group to Push"); + } + if(policySelection.length == 0 && currentSelection.length != 0){ + Notification.error("Please Select Policy to Push"); + } + if(policySelection.length != 0 && currentSelection.length == 0){ + Notification.error("Please Select PDP Group to Push"); + } + if(policySelection.length != 0 && currentSelection.length != 0){ + var finalData = { + "pdpDatas": currentSelection, + "policyDatas": policySelection + }; + console.log(finalData); + var uuu = "auto_Push/PushPolicyToPDP.htm"; + var postData={pushTabData: finalData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.data=data.data; + $scope.pdpdata = JSON.parse(data.data); + $scope.pushTabPDPGrid.data = $scope.pdpdata; + Notification.success("Policy Pushed Successfully"); + }); + console.log($scope.data); + }, + error : function(data){ + Notification.error("Error Occured while Pushing Policy."); + } + }); + + } + }; + + +}); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/AutoPushTabController/RemovePDPGroupPoliciesController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/AutoPushTabController/RemovePDPGroupPoliciesController.js new file mode 100644 index 000000000..c7926acfb --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/AutoPushTabController/RemovePDPGroupPoliciesController.js @@ -0,0 +1,85 @@ +/*- + * ============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========================================================= + */ +app.controller('removeGroupPoliciesController' , function ($scope, $modalInstance, message, Notification){ + if(message.selectedPdpGroupData !=null){ + $scope.label='Remove PDP Group Policies' + $scope.disableCd=true; + } + $scope.policies = message.selectedPdpGroupData.policies; + $scope.pdpGroupData = message.selectedPdpGroupData; + + $scope.removePoliciesGrid = { + data : 'policies', + enableFiltering: true, + columnDefs: [ + { field: 'root', displayName : 'Root', width : '10%'}, + { field: 'name', displayName : 'Name' }, + { field: 'version' , width : '10%'}, + { field: 'id' } + ] + }; + + $scope.removePoliciesGrid.onRegisterApi = function(gridApi){ + //set gridApi on scope + $scope.gridApi = gridApi; + gridApi.selection.on.rowSelectionChanged($scope,function(row){ + var msg = 'row selected ' + row.isSelected; + }); + + gridApi.selection.on.rowSelectionChangedBatch($scope,function(rows){ + var msg = 'rows changed ' + rows.length; + }); + }; + + $scope.removePolicies = function() { + $scope.removeGroupData = []; + angular.forEach($scope.gridApi.selection.getSelectedRows(), function (data, index) { + $scope.removeGroupData.push(data); + }); + if($scope.removeGroupData.length > 0){ + var uuu = "auto_Push/remove_GroupPolicies.htm"; + var postData={data: $scope.removeGroupData, + activePdpGroup : $scope.pdpGroupData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.data=data.data;}); + console.log($scope.data); + $modalInstance.close({data:$scope.data}); + Notification.success("Policy Removed Successfully"); + }, + error : function(data){ + Notification.error("Error Occured while removing Policy"); + } + }); + }else{ + Notification.error("Please select atleast one Policy to remove"); + } + }; + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/DictionaryController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/DictionaryController.js new file mode 100644 index 000000000..243591f22 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/DictionaryController.js @@ -0,0 +1,81 @@ +/*- + * ============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 mainDictionarys = ["Action Policy", "BRMS Policy", "Common Dictionary", "ClosedLoop Policy","Decision Policy", "Descriptive Policy", + "Firewall Policy", "MicroService Policy", "Policy Scope", "Safe Policy Dictionary"]; +var subDictionarys = [["Action Dictionary"], + ["BRMS Controller" , "BRMS Dependency", "BRMS Param Template"], + ["Attribute Dictionary","EcompName Dictionary"], + ["PEP Options","Site Dictionary","Service Dictionary","Varbind Dictionary", "VNF Type","VSCL Action"], + ["Settings Dictionary"], + ["Descriptive Scope"], + ["Action List", "Address Group", "Parent Dictionary List", "Port List", "Prefix List", "Protocol List", "Security Zone", "Service Group", "Service List", "Tag List", "Tag Picker List", "Term List", "Zone"], + ["DCAE UUID","MicroService ConfigName","MicroService Location", "MicroService Models", "MicroService Dictionary"], + ["Closed Loop", "Group Policy Scope", "Resource", "Service", "Type"], + ["Risk Type", "Safe Policy Warning"]]; +app.controller('dictionaryTabController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + $scope.isDisabled = true; + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.isDisabled = true; + this.isDisabled = true; + }else{ + $scope.isDisabled = false; + this.isDisabled = false; + } + console.log($scope.data); + },function(error){ + console.log("failed"); + }); + + $scope.options1 = mainDictionarys; + $scope.options2 = []; + $scope.getOptions2 = function(){ + var key = $scope.options1.indexOf($scope.option1); + var myNewOptions = subDictionarys[key]; + $scope.options2 = myNewOptions; + }; + + $scope.import = function() { + $scope.data = {}; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'import_dictionary_popup.html', + controller: 'importDictionaryController', + resolve: { + message: function () { + var message = { + data: $scope.data + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + }); + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/ImportDictionaryController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/ImportDictionaryController.js new file mode 100644 index 000000000..9043472c6 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/ImportDictionaryController.js @@ -0,0 +1,59 @@ +/*- + * ============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========================================================= + */ +app.controller('importDictionaryController' , function ($scope, $modalInstance, message, $http, PolicyAppService, UserInfoServiceDS2, Notification){ + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.importButton = true; + var fd; + $scope.uploadFile = function(files) { + fd = new FormData(); + fd.append("file", files[0]); + var fileExtension = files[0].name.split(".")[1]; + if(fileExtension == "csv"){ + $scope.importButton = false; + $scope.$apply(); + }else{ + Notification.error("Upload the Dictionary file extends with .csv format"); + } + }; + + $scope.submitUpload = function(){ + $http.post("saveDictionary/dictionary/import_dictionary", fd, { + withCredentials: false, + headers: {'Content-Type': undefined}, + transformRequest: angular.identity + }).success(function(){ + Notification.success("Dictionary Uploaded Successfully"); + $scope.importButton = true; + }).error(function(){ + Notification.error("Dictionary Upload Failed"); + }); + }; + +$scope.close = function() { + $modalInstance.close(); +}; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PDPTabController/AddorEditPdpInGroup.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PDPTabController/AddorEditPdpInGroup.js new file mode 100644 index 000000000..6763251d4 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PDPTabController/AddorEditPdpInGroup.js @@ -0,0 +1,59 @@ +/*- + * ============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========================================================= + */ +app.controller('pdpInGroupController' , function ($scope, $modalInstance, message, Notification){ + $scope.edit = 'false'; + if(message.pdpInGroup==null) + $scope.label='Add PDP to Group' + else{ + $scope.label='Edit PDP In Group' + $scope.disableCd=true; + $scope.edit = 'true'; + } + $scope.editPDPInGroup = message.pdpInGroup; + $scope.editActivePDP = message.activePDP; + + $scope.savePDPInGroup = function(pdpInGroup) { + var uuu = "pdp_Group/save_pdpTogroup.htm"; + var postData={pdpInGroup: pdpInGroup, + activePDP: $scope.editActivePDP, + update : $scope.edit}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.data=data.data;}); + console.log($scope.data); + $modalInstance.close({data:$scope.data}); + }, + error : function(data){ + Notification.error("Error Occured while Creating/Updating a PDP Group"); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}); + diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PDPTabController/PDPGroupStatusController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PDPTabController/PDPGroupStatusController.js new file mode 100644 index 000000000..48c1e5ec8 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PDPTabController/PDPGroupStatusController.js @@ -0,0 +1,41 @@ +/*- + * ============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========================================================= + */ +app.controller('pdpGroupStatusController', function ($scope, $modalInstance, message){ + if(message.status==null) { + $scope.label = 'No Status to Display' + }else{ + $scope.label='Status' + $scope.disableCd=true; + $scope.policies = message.policies; + $scope.pdpStatusDatas = message.status; + } + + $scope.policiesGrid = { + data : 'policies', + enableFiltering: true, + columnDefs: [ + { field: 'name', displayName : 'Name' } + ] + }; + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PolicyAddScopeRoleController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PolicyAddScopeRoleController.js new file mode 100644 index 000000000..6791abaa1 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PolicyAddScopeRoleController.js @@ -0,0 +1,61 @@ +/*- + * ============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========================================================= + */ +app.controller('editRoleController' , function ($scope, PolicyAppService, $modalInstance, message){ + if(message.editRoleData!=null){ + $scope.label='Edit Role' + $scope.disableCd=true; + } + $scope.editRole = message.editRoleData; + + PolicyAppService.getData('get_PolicyRolesScopeData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.scopeDatas = JSON.parse($scope.data.scopeDatas); + console.log($scope.scopeDatas); + }, function (error) { + console.log("failed"); + }); + + $scope.saveRole = function(editRoleData) { + var uuu = "save_NonSuperRolesData.htm"; + var postData={editRoleData: editRoleData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.rolesDatas=data.rolesDatas;}); + console.log($scope.rolesDatas); + $modalInstance.close({rolesDatas:$scope.rolesDatas}); + }, + error : function(data){ + alert("Error while saving Role."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PolicyRolesController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PolicyRolesController.js new file mode 100644 index 000000000..900594dfe --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/PolicyRolesController.js @@ -0,0 +1,92 @@ +/*- + * ============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========================================================= + */ +app.controller('policyRolesController', function ($scope, PolicyAppService, modalService, $modal, Notification){ + $( "#dialog" ).hide(); + + $scope.isDisabled = true; + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.isDisabled = true; + }else{ + $scope.isDisabled = false; + } + console.log($scope.data); + },function(error){ + console.log("failed"); + }); + + $scope.scopeDatas = []; + PolicyAppService.getData('get_RolesData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.rolesDatas = JSON.parse($scope.data.rolesDatas); + console.log($scope.rolesDatas); + }, function (error) { + console.log("failed"); + }); + + $scope.rolesTableGrid = { + data : 'rolesDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editRolesWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button>' , width: '4%' + }, + { field: 'loginId.userName', displayName : 'Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'scope', displayName : 'Scope' }, + { field: 'role', displayName : 'Role' } + ] + }; + + + $scope.editRoleName = null; + + $scope.editRolesWindow = function(editRoleData) { + if($scope.lockdowndata[0].lockdown == true){ + Notification.error("Policy Application has been Locked") + }else{ + $scope.editRoleName = editRoleData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'edit_Role_popup.html', + controller: 'editRoleController', + resolve: { + message: function () { + var message = { + editRoleData: $scope.editRoleName + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + }); + } + + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardController.js new file mode 100644 index 000000000..a99a9a886 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardController.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========================================================= + */ +app.controller('policyDashboardHealthController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + $scope.pdpTableDatas = []; + $scope.papTableDatas = []; + $scope.policyActivityTableDatas = []; + + PolicyAppService.getData('get_DashboardSystemAlertData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.systemAlertsTableDatas =JSON.parse($scope.data.systemAlertsTableDatas); + },function(error){ + console.log("failed"); + }); + + PolicyAppService.getData('get_DashboardPAPStatusData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.papTableMapDatas =JSON.parse($scope.data.papTableDatas); + if($scope.papTableMapDatas != null){ + for(i = 0; i < $scope.papTableMapDatas.length; i++){ + $scope.papTableDatas.push($scope.papTableMapDatas[i].map); + } + } + },function(error){ + console.log("failed"); + }); + + PolicyAppService.getData('get_DashboardPDPStatusData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.pdpTableMapDatas =JSON.parse($scope.data.pdpTableDatas); + if($scope.pdpTableMapDatas != null) { + for (i = 0; i < $scope.pdpTableMapDatas.length; i++) { + $scope.pdpTableDatas.push($scope.pdpTableMapDatas[i].map); + } + } + },function(error){ + console.log("failed"); + }); + + PolicyAppService.getData('get_DashboardPolicyActivityData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.policyActivityTableMapDatas =JSON.parse($scope.data.policyActivityTableDatas); + if($scope.policyActivityTableMapDatas != null) { + for (i = 0; i < $scope.policyActivityTableMapDatas.length; i++) { + $scope.policyActivityTableDatas.push($scope.policyActivityTableMapDatas[i].map); + } + } + },function(error){ + console.log("failed"); + }); + + $scope.availableGridHealthDatas = { + data : 'systemAlertsTableDatas', + enableFiltering: true, + columnDefs: [{ field: 'id'}, + { field: 'type'}, + { field: 'system'}, + {field: 'logtype'}, + {field : 'date' ,type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field : 'description'} + ], + }; + + $scope.papStatusDatas = { + data : 'papTableDatas', + enableFiltering: true, + columnDefs: [{ field: 'system'}, + { field: 'status'}, + { field: 'noOfPolicy'}, + {field: 'noOfConnectedTrap'} + ], + }; + + $scope.pdpStatusDatas = { + data : 'pdpTableDatas', + enableFiltering: true, + columnDefs: [{ field: 'id'}, + { field: 'name'}, + { field: 'groupname'}, + {field: 'status'}, + {field : 'description' }, + {field : 'permitCount'}, + {field : 'denyCount'}, + {field : 'naCount'} + ], + }; + + $scope.policyActivityDatas = { + data : 'policyActivityTableDatas', + enableFiltering: true, + columnDefs: [{ field: 'policyId'}, + { field: 'fireCount'}, + { field: 'system'} + ], + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboard_Logging_Controller.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboard_Logging_Controller.js new file mode 100644 index 000000000..45ceb6e6f --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboard_Logging_Controller.js @@ -0,0 +1,81 @@ +/*- + * ============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========================================================= + */ +app.controller('policyDashboardController', function ($scope, PolicyAppService, modalService, $modal, uiGridConstants,Grid){ + $( "#dialog" ).hide(); + + $scope.loading = true; + PolicyAppService.getData('get_DashboardLoggingData').then(function(data){ + $scope.loading = false; + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.availableLoggingDatas =JSON.parse($scope.data.availableLoggingDatas); + console.log($scope.availableLoggingDatas); + },function(error){ + console.log("failed"); + //reloadPageOnce(); + }); + + $scope.availableGridLoggingDatas = { + data : 'availableLoggingDatas', + enableFiltering: true, + columnDefs: [{ field: 'id'}, + { field: 'type'}, + { field: 'system'}, + {field: 'logtype'}, + {field : 'date' ,type: 'date', cellFilter: 'date:\'yyyy-MM-dd HH:MM:ss a\'' }, + {field : 'description'} + ], + enableGridMenu: true, + enableSelectAll: true, + exporterCsvFilename: 'DashboardLogging.csv', + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'date') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + + }; + +}); + diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSControllerDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSControllerDictController.js new file mode 100644 index 000000000..6665255b3 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSControllerDictController.js @@ -0,0 +1,84 @@ +/*- + * ============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========================================================= + */ +app.controller('editBRMSControllerController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.brmsControllerDictionaryDatas==null) + $scope.label='Add New BRMS Controller' + else{ + if(message.disabled){ + $scope.label='View BRMS Controller' + }else{ + $scope.label='Edit BRMS Controller' + } + $scope.disableCd=true; + } + $scope.editBRMSController = message.brmsControllerDictionaryDatas; + $scope.disabled = message.disabled; + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.saveBRMSController = function(brmsControllerDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(brmsControllerDictionaryData.controllerName)) { + Notification.error("Enter Valid Controller Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/brms_dictionary/save_BRMSControllerData"; + if(brmsControllerDictionaryData && brmsControllerDictionaryData.controllerName){ + if(brmsControllerDictionaryData.controller){ + var postData={brmsControllerDictionaryData: brmsControllerDictionaryData, userid: userid}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.brmsControllerDictionaryDatas=data.brmsControllerDictionaryDatas;}); + if($scope.brmsControllerDictionaryDatas == "Duplicate"){ + Notification.error("BRMS Controller Dictionary exists with Same Controller Name.") + }else if($scope.brmsControllerDictionaryDatas == "Error"){ + Notification.error("BRMS Controller is not in proper required format"); + }else{ + console.log($scope.brmsControllerDictionaryDatas); + $modalInstance.close({brmsControllerDictionaryDatas:$scope.brmsControllerDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }else{ + Notification.error("Controller Field is Empty."); + } + }else{ + Notification.error("BRMS Controller Name should be given."); + } + } + }; + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSDependencyDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSDependencyDictController.js new file mode 100644 index 000000000..7ccc29ec9 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSDependencyDictController.js @@ -0,0 +1,84 @@ +/*- + * ============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========================================================= + */ +app.controller('editBRMSDependencyController', function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.brmsDependencyDictionaryDatas==null) + $scope.label='Add New BRMS Dependency' + else{ + if(message.disabled){ + $scope.label='View BRMS Dependency' + }else{ + $scope.label='Edit BRMS Dependency' + } + $scope.disableCd=true; + } + $scope.editBRMSDependency = message.brmsDependencyDictionaryDatas; + $scope.disabled = message.disabled; + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.saveBRMSDependency = function(brmsDependencyDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(brmsDependencyDictionaryData.dependencyName)) { + Notification.error("Enter Valid Dependency Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/brms_dictionary/save_BRMSDependencyData"; + var postData={brmsDependencyDictionaryData: brmsDependencyDictionaryData, userid: userid}; + if(brmsDependencyDictionaryData && brmsDependencyDictionaryData.dependencyName){ + if(brmsDependencyDictionaryData.dependency){ + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.brmsDependencyDictionaryDatas=data.brmsDependencyDictionaryDatas;}); + if($scope.brmsDependencyDictionaryDatas == "Duplicate"){ + Notification.error("BRMS Dependency Dictionary exists with Same Dependency Name.") + }else if($scope.brmsDependencyDictionaryDatas == "Error"){ + Notification.error("BRMS Dependency is not in proper format Maven dependency Format"); + }else{ + console.log($scope.brmsDependencyDictionaryDatas); + $modalInstance.close({brmsDependencyDictionaryDatas:$scope.brmsDependencyDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }else{ + Notification.error("Dependency Field is Empty."); + } + }else{ + Notification.error("BRMS Dependency Name should be given."); + } + } + }; + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js new file mode 100644 index 000000000..4b1482992 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js @@ -0,0 +1,95 @@ +/*- + * ============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========================================================= + */ +app.controller('editBRMSParamController' , function ($scope, $modalInstance, message, $http, UserInfoServiceDS2, Notification){ + if(message.brmsParamDictionaryData==null) + $scope.label='Add BRMS Rule' + else{ + $scope.label='Edit BRMS Rule' + $scope.disableCd=true; + } + + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + var valid = true; + $scope.editBRMSParam = message.brmsParamDictionaryData; + + $scope.uploadFile = function(files) { + var extn = files[0].name.substr(files[0].name.lastIndexOf('.')+1); + if(extn == 'drl'){ + valid = true; + var fd = new FormData(); + fd.append("file", files[0]); + $http.post("saveDictionary/brms_dictionary/set_BRMSParamData", fd, { + withCredentials: false, + headers: {'Content-Type': undefined }, + transformRequest: angular.identity + }).success().error( ); + }else{ + Notification.error("BRMS Dictionary Upload file should ends with .drl extension"); + valid = false; + } + }; + + $scope.MyFile = []; + $scope.saveBRMSParam = function(brmsParamDictionaryData) { + if(valid){ + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(brmsParamDictionaryData.ruleName)) { + Notification.error("Enter Valid Rule Name without spaces or special characters"); + }else{ + var file = $scope.MyFile; + var uuu = "saveDictionary/brms_dictionary/save_BRMSParam"; + var postData={brmsParamDictionaryData: brmsParamDictionaryData, userid: userid}; + $.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){ + Notification.error("Error while saving."); + } + }); + } + }else{ + Notification.error("Please check BRMS Rule Upload file format."); + } + }; + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLPepOptionsDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLPepOptionsDictController.js new file mode 100644 index 000000000..2d1d2d931 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLPepOptionsDictController.js @@ -0,0 +1,115 @@ +/*- + * ============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========================================================= + */ +app.controller('editPEPOptionsController', function ($scope, $modalInstance, message, UserInfoServiceDS2, 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 }); + } + } + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editPEPOptions = message.pepOptionsDictionaryData; + + $scope.saveCLPepOptions = function(pepOptionsDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(pepOptionsDictionaryData.pepName)) { + Notification.error("Enter Valid PEP Name without spaces or special characters"); + }else{ + var finalData = extend(pepOptionsDictionaryData, $scope.actions[0]); + var uuu = "saveDictionary/cl_dictionary/save_pepOptions"; + var postData={pepOptionsDictionaryData: finalData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLServiceDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLServiceDictController.js new file mode 100644 index 000000000..fda942be4 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLServiceDictController.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========================================================= + */ +app.controller('editCLServiceController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.closedLoopServiceDictionaryData==null) + $scope.label='Add Service Name' + else{ + $scope.label='Edit Service Name' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editCLService = message.closedLoopServiceDictionaryData; + + $scope.saveCLServiceDict = function(closedLoopServiceDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(closedLoopServiceDictionaryData.serviceName)) { + Notification.error("Enter Valid ClosedLoop Service Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/cl_dictionary/save_service"; + var postData={closedLoopServiceDictionaryData: closedLoopServiceDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLSiteDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLSiteDictController.js new file mode 100644 index 000000000..403f8652d --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLSiteDictController.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========================================================= + */ +app.controller('editCLSiteController', function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.closedLoopSiteDictionaryData==null) + $scope.label='Add Site Name' + else{ + $scope.label='Edit Site Name' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editCLSite = message.closedLoopSiteDictionaryData; + + $scope.saveCLSite = function(closedLoopSiteDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(closedLoopSiteDictionaryData.siteName)) { + Notification.error("Enter Valid ClosedLoop Site Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/cl_dictionary/save_siteName"; + var postData={closedLoopSiteDictionaryData: closedLoopSiteDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLVarbindDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLVarbindDictController.js new file mode 100644 index 000000000..f3d75ec52 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLVarbindDictController.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========================================================= + */ +app.controller('editCLVarbindController',function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.varbindDictionaryData==null) + $scope.label='Add Varbind ' + else{ + $scope.label='Edit Varbind' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editCLVarbind = message.varbindDictionaryData; + + $scope.saveCLVarbind = function(varbindDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(varbindDictionaryData.varbindName)) { + Notification.error("Enter Valid ClosedLoop Varbind Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/cl_dictionary/save_varbind"; + var postData={varbindDictionaryData: varbindDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLVnfTypeDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLVnfTypeDictController.js new file mode 100644 index 000000000..73236445d --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLVnfTypeDictController.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========================================================= + */ +app.controller('editVnfTypeController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.vnfTypeDictionaryData==null) + $scope.label='Add VNF Type' + else{ + $scope.label='Edit VNF Type' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editVnfType = message.vnfTypeDictionaryData; + + $scope.saveCLVnfType = function(vnfTypeDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(vnfTypeDictionaryData.vnftype)) { + Notification.error("Enter Valid VNF Type Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/cl_dictionary/save_vnfType"; + var postData={vnfTypeDictionaryData: vnfTypeDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLVsclActionDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLVsclActionDictController.js new file mode 100644 index 000000000..ac597c85e --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/CLVsclActionDictController.js @@ -0,0 +1,71 @@ +/*- + * ============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========================================================= + */ +app.controller('editVsclActionController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.vsclActionDictionaryData==null) + $scope.label='Add VSCL Action' + else{ + $scope.label='Edit VSCL Action' + $scope.disableCd=true; + } + + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editvsclAction = message.vsclActionDictionaryData; + + $scope.saveCLVSCLAction = function(vsclActionDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(vsclActionDictionaryData.vsclaction)) { + Notification.error("Enter Valid VSCL Action Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/cl_dictionary/save_vsclAction"; + var postData={vsclActionDictionaryData: vsclActionDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionSettingsDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionSettingsDictController.js new file mode 100644 index 000000000..2dfc2c4c7 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionSettingsDictController.js @@ -0,0 +1,71 @@ +/*- + * ============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========================================================= + */ +app.controller('editSettingsDictController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.settingsDictionaryData==null) + $scope.label='Add Decision Settings' + else{ + $scope.label='Edit Decision Settings' + $scope.disableCd=true; + } + + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editSettingsDict = message.settingsDictionaryData; + + $scope.saveDecisionSettings = function(settingsDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(settingsDictionaryData.xacmlId)) { + Notification.error("Enter Valid Settings Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/decision_dictionary/save_Settings"; + var postData={settingsDictionaryData: settingsDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/DescriptiveSearchDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/DescriptiveSearchDictController.js new file mode 100644 index 000000000..218ad24bc --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/DescriptiveSearchDictController.js @@ -0,0 +1,116 @@ +/*- + * ============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========================================================= + */ +app.controller('editDescriptiveScopeController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, 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 }); + } + } + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editDescriptiveScope = message.descriptiveScopeDictionaryData; + + $scope.saveDescriptiveScope = function(descriptiveScopeDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(descriptiveScopeDictionaryData.scopeName)) { + Notification.error("Enter Valid Descriptive Scope Name without spaces or special characters"); + }else{ + var finalData = extend(descriptiveScopeDictionaryData, $scope.actions[0]); + var uuu = "saveDictionary/descriptive_dictionary/save_descriptive"; + var postData={descriptiveScopeDictionaryData: finalData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/EnforcerDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/EnforcerDictController.js new file mode 100644 index 000000000..6481a93c8 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/EnforcerDictController.js @@ -0,0 +1,60 @@ +/*- + * ============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, UserInfoServiceDS2){ + if(message.enforcerDictionaryData==null) + $scope.label='Add Enforcing Type' + else{ + $scope.label='Edit Enforcing Type' + $scope.disableCd=true; + } + $scope.editEnforcerType = message.enforcerDictionaryData; + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.saveEnforcerType = function(enforcerDictionaryData) { + var uuu = "saveDictionary/enforcer_dictionary/save_enforcerType"; + var postData={enforcerDictionaryData: enforcerDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWActionListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWActionListDictController.js new file mode 100644 index 000000000..e52fd6d5e --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWActionListDictController.js @@ -0,0 +1,71 @@ +/*- + * ============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========================================================= + */ +app.controller('editFWActionListController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.actionListDictionaryData==null) + $scope.label='Add Action Name' + else{ + $scope.label='Edit Action Name' + $scope.disableCd=true; + } + + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editActionList = message.actionListDictionaryData; + + $scope.saveFWActionList = function(actionListDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(actionListDictionaryData.actionName)) { + Notification.error("Enter Valid ActionList Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/fw_dictionary/save_ActionList"; + var postData={actionListDictionaryData: actionListDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWAddressGroupDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWAddressGroupDictController.js new file mode 100644 index 000000000..70c88bc23 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWAddressGroupDictController.js @@ -0,0 +1,116 @@ +/*- + * ============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========================================================= + */ +app.controller('editFWAddressGroupController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, PolicyAppService, 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}); + } + } + } + + + PolicyAppService.getData('getDictionary/get_PrefixListDataByName').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 userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editAddressGroup = message.addressGroupDictionaryData; + + $scope.saveFWAddressGroup = function(addressGroupDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(addressGroupDictionaryData.groupName)) { + Notification.error("Enter Valid Address Group Name without spaces or special characters"); + }else{ + var finalData = extend(addressGroupDictionaryData, $scope.attributeDatas[0]); + var uuu = "saveDictionary/fw_dictionary/save_addressGroup"; + var postData={addressGroupDictionaryData: finalData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWParentListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWParentListDictController.js new file mode 100644 index 000000000..96fb57734 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWParentListDictController.js @@ -0,0 +1,151 @@ +/*- + * ============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========================================================= + */ +app.controller('editFWParentListController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, PolicyAppService, 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}); + } + } + } + + PolicyAppService.getData('getDictionary/get_ServiceListDictionaryDataByName').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"); + }); + + PolicyAppService.getData('getDictionary/get_AddressGroupDictionaryDataByName').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 userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editParentList = message.fwDictListDictionaryData; + + $scope.saveFWParentList = function(fwDictListDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(fwDictListDictionaryData.parentItemName)) { + Notification.error("Enter Valid Parent List Name without spaces or special characters"); + }else{ + var addSLData = extend(fwDictListDictionaryData, $scope.attributeDatas[0]); + var finalData = extend(addSLData, $scope.attributeALDatas[0]); + var uuu = "saveDictionary/fw_dictionary/save_FWDictionaryList"; + var postData={fwDictListDictionaryData: finalData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWPortListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWPortListDictController.js new file mode 100644 index 000000000..aac43e8a9 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWPortListDictController.js @@ -0,0 +1,71 @@ +/*- + * ============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========================================================= + */ +app.controller('editFWPortListController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.portListDictionaryData==null) + $scope.label='Add Port Name' + else{ + $scope.label='Edit Port Name' + $scope.disableCd=true; + } + + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editPortList = message.portListDictionaryData; + + $scope.saveFWPortList = function(portListDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(portListDictionaryData.portName)) { + Notification.error("Enter Valid Port Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/fw_dictionary/save_portName"; + var postData={portListDictionaryData: portListDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js new file mode 100644 index 000000000..372837f39 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js @@ -0,0 +1,98 @@ +/*- + * ============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========================================================= + */ +app.controller('editFWPrefixListController' , function ($scope, $modalInstance, message, Notification, UserInfoServiceDS2, Notification){ + $scope.validate = 'false'; + if(message.prefixListDictionaryData==null) + $scope.label='Add PrefixList' + else{ + $scope.label='Edit PrefixList' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editPrefixList = message.prefixListDictionaryData; + + $scope.saveFWPrefixList = function(prefixListDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(prefixListDictionaryData.prefixListName)) { + Notification.error("Enter Valid PrefixList Name without spaces or special characters"); + }else{ + if($scope.validate == 'true'){ + var uuu = "saveDictionary/fw_dictionary/save_prefixList"; + var postData={prefixListDictionaryData: prefixListDictionaryData, userid: userid}; + $.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 = "saveDictionary/fw_dictionary/validate_prefixList"; + 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'; + Notification.success('Validation Success'); + } + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWProtocolListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWProtocolListDictController.js new file mode 100644 index 000000000..a87727380 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWProtocolListDictController.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========================================================= + */ +app.controller('editFWProtocolListController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.protocolListDictionaryData==null) + $scope.label='Add Protocol Name' + else{ + $scope.label='Edit Protocol Name' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editProtocolList = message.protocolListDictionaryData; + + $scope.saveProtocolList = function(protocolListDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(protocolListDictionaryData.protocolName)) { + Notification.error("Enter Valid ProtocolList Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/fw_dictionary/save_protocolList"; + var postData={protocolListDictionaryData: protocolListDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWSecurityZoneDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWSecurityZoneDictController.js new file mode 100644 index 000000000..ecda8c27a --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWSecurityZoneDictController.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========================================================= + */ +app.controller('editfwSecurityZoneController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.securityZoneDictionaryData==null) + $scope.label='Add Security Zone' + else{ + $scope.label='Edit Security Zone' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editSecurityZone = message.securityZoneDictionaryData; + + $scope.saveSecurityZone = function(securityZoneDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(securityZoneDictionaryData.zoneName)) { + Notification.error("Enter Valid Security Zone Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/fw_dictionary/save_securityZone"; + var postData={securityZoneDictionaryData: securityZoneDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceGroupDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceGroupDictController.js new file mode 100644 index 000000000..1de45ecf6 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceGroupDictController.js @@ -0,0 +1,118 @@ +/*- + * ============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========================================================= + */ +app.controller('editFWServiceGroupController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, PolicyAppService, 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}); + } + } + } + + + PolicyAppService.getData('getDictionary/get_ServiceListDictionaryDataByName').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 userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editServiceGroup = message.serviceGroupDictionaryData; + + $scope.saveFWServiceGroup = function(serviceGroupDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(serviceGroupDictionaryData.groupName)) { + Notification.error("Enter Valid Service Group Name without spaces or special characters"); + }else{ + var finalData = extend(serviceGroupDictionaryData, $scope.attributeDatas[0]); + var uuu = "saveDictionary/fw_dictionary/save_serviceGroup"; + var postData={serviceGroupDictionaryData: finalData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceListDictController.js new file mode 100644 index 000000000..458601bb9 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceListDictController.js @@ -0,0 +1,144 @@ +/*- + * ============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========================================================= + */ +app.controller('editFWServiceListController' , function ($scope, $modalInstance, message, PolicyAppService, UserInfoServiceDS2, 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}); + } + } + } + + + PolicyAppService.getData('getDictionary/get_ProtocolListDataByName').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 userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editServiceList = message.serviceListDictionaryData; + + $scope.saveFWServiceList = function(serviceListDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(serviceListDictionaryData.serviceName)) { + Notification.error("Enter Valid ServiceList Name without spaces or special characters"); + }else{ + var addtcpData = extend(serviceListDictionaryData, $scope.attributeTCPDatas[0]); + var finalData = extend(addtcpData, $scope.attributeAPPDatas[0]); + var uuu = "saveDictionary/fw_dictionary/save_serviceList"; + var postData={serviceListDictionaryData: finalData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTagListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTagListDictController.js new file mode 100644 index 000000000..0d65b8209 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTagListDictController.js @@ -0,0 +1,105 @@ +/*- + * ============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========================================================= + */ +app.controller('editFWTagListController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + + if(message.fwTagDictionaryDatas==null) + $scope.label='Add Tag', + $scope.choices = []; + else{ + $scope.label='Edit Tag' + $scope.disableCd=true; + $scope.choices = []; + var headers = message.fwTagDictionaryDatas.tagValues; + var SplitChars = ','; + if (headers.indexOf(SplitChars) >= 0) { + var splitHeader = headers.split(SplitChars); + var singleHeader = splitHeader; + for(i = 0; i < singleHeader.length; i++){ + var splitValue = singleHeader[i]; + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo, 'tags': splitValue }); + } + }else{ + $scope.choices.push({'id':'choice'+1, 'tags': headers }); + } + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editFWTag = message.fwTagDictionaryDatas; + + $scope.saveFWTag = function(fwTagDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(fwTagDictionaryData.fwTagName)) { + Notification.error("Enter Valid Tag Name without spaces or special characters"); + }else{ + var finalData = extend(fwTagDictionaryData, $scope.attributeDatas[0]); + var uuu = "saveDictionary/fw_dictionary/save_fwTag"; + var postData={fwTagDictionaryData: finalData, userid: userid}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.fwTagDictionaryDatas=data.fwTagDictionaryDatas;}); + if($scope.fwTagDictionaryDatas == "Duplicate"){ + Notification.error("Tag Dictionary exists with Same Tag Name.") + }else{ + console.log($scope.fwTagDictionaryDatas); + $modalInstance.close({fwTagDictionaryDatas:$scope.fwTagDictionaryDatas}); + } + }, + 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 = [{"tags" : $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); + }; + + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTagPickerListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTagPickerListDictController.js new file mode 100644 index 000000000..534edd0bc --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTagPickerListDictController.js @@ -0,0 +1,151 @@ +/*- + * ============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========================================================= + */ +app.controller('editFWTagPickerController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification, PolicyAppService){ + if(message.fwTagPickerDictionaryData==null) + $scope.label='Add TagPicker', + $scope.choices = []; + else{ + $scope.label='Edit TagPicker' + $scope.disableCd=true; + $scope.choices = []; + var headers = message.fwTagPickerDictionaryData.tagValues; + 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 }); + } + } + } + + + PolicyAppService.getData('getDictionary/get_TagListData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.fwTagDictionaryDatas = JSON.parse($scope.data.fwTagDictionaryDatas); + console.log($scope.fwTagDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('getDictionary/get_TagNameByName').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.fwTagDictionaryKeyDatas = JSON.parse($scope.data.fwTagDictionaryDatas); + console.log($scope.fwTagDictionaryKeyDatas); + }, function (error) { + console.log("failed"); + }); + + + $scope.fwTagDictionaryDataValues = []; + $scope.getTagListValues = function(key){ + for (var i = 0; i < $scope.fwTagDictionaryDatas.length; ++i) { + var obj = $scope.fwTagDictionaryDatas[i]; + if (obj.fwTagName == key){ + var splitValue = obj.tagValues.split(','); + for (var j = 0; j < splitValue.length; ++j) { + $scope.fwTagDictionaryDataValues.push(splitValue[j].split(',')[0]); + } + } + } + }; + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editFWTagPicker = message.fwTagPickerDictionaryData; + + $scope.saveFWTagPicker = function(fwTagPickerDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(fwTagPickerDictionaryData.tagPickerName)) { + Notification.error("Enter Valid TagPicker Name without spaces or special characters"); + }else{ + var finalData = extend(fwTagPickerDictionaryData, $scope.actions[0]); + var uuu = "saveDictionary/fw_dictionary/save_fwTagPicker"; + var postData={fwTagPickerDictionaryData: finalData, userid: userid}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.fwTagPickerDictionaryDatas=data.fwTagPickerDictionaryDatas;}); + if($scope.fwTagPickerDictionaryDatas == "Duplicate"){ + Notification.error("TagPicker Dictionary exists with TagPicker Name.") + }else{ + console.log($scope.fwTagPickerDictionaryDatas); + $modalInstance.close({fwTagPickerDictionaryDatas:$scope.fwTagPickerDictionaryDatas}); + } + + }, + 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 = [{"tags" : $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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js new file mode 100644 index 000000000..4c3ddb4ab --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js @@ -0,0 +1,328 @@ +/*- + * ============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========================================================= + */ +app.controller('editFWTermListController' , function ($scope, $modalInstance, message, PolicyAppService, UserInfoServiceDS2, 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}); + } + } + } + + + PolicyAppService.getData('getDictionary/get_PrefixListDataByName').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"); + }); + + PolicyAppService.getData('getDictionary/get_ZoneDictionaryDataByName').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"); + }); + + PolicyAppService.getData('getDictionary/get_AddressGroupDictionaryDataByName').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"); + }); + + PolicyAppService.getData('getDictionary/get_ServiceListDictionaryDataByName').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"); + }); + + PolicyAppService.getData('getDictionary/get_ServiceGroupDictionaryDataByName').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"); + }); + + PolicyAppService.getData('getDictionary/get_ActionListDictionaryDataByName').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 userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editTermList = message.termListDictionaryData; + + $scope.saveTermName = function(termListDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(termListDictionaryData.termName)) { + Notification.error("Enter Valid Term Name without spaces or special characters"); + }else{ + 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 = "saveDictionary/fw_dictionary/save_termList"; + var postData={termListDictionaryData: finalData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWZoneDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWZoneDictController.js new file mode 100644 index 000000000..e655e2c5b --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWZoneDictController.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========================================================= + */ +app.controller('editFWZoneController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.zoneDictionaryData==null) + $scope.label='Add Zone Name' + else{ + $scope.label='Edit Zone Name' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editZoneName = message.zoneDictionaryData; + + $scope.saveZoneName = function(zoneDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(zoneDictionaryData.zoneName)) { + Notification.error("Enter Valid Zone Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/fw_dictionary/save_zoneName"; + var postData={zoneDictionaryData: zoneDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js new file mode 100644 index 000000000..b985beb7d --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js @@ -0,0 +1,71 @@ +/*- + * ============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========================================================= + */ +app.controller('editMSConfigController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.microServiceCongigNameDictionaryData==null) + $scope.label='Add Config Name' + else{ + $scope.label='Edit Config Name' + $scope.disableCd=true; + } + + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editMSConfig = message.microServiceCongigNameDictionaryData; + + $scope.saveMSConfig = function(microServiceCongigNameDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(microServiceCongigNameDictionaryData.name)) { + Notification.error("Enter Valid Config Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/ms_dictionary/save_configName"; + var postData={microServiceCongigNameDictionaryData: microServiceCongigNameDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSDcaeUUIDDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSDcaeUUIDDictController.js new file mode 100644 index 000000000..a67fad81d --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSDcaeUUIDDictController.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========================================================= + */ +app.controller('editDCAEuuidController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.dcaeUUIDDictionaryData==null) + $scope.label='Add Micro Service UUID' + else{ + $scope.label='Edit Micro Service UUID' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editDCAEuuid = message.dcaeUUIDDictionaryData; + + $scope.saveDCAEUUID = function(dcaeUUIDDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(dcaeUUIDDictionaryData.name)) { + Notification.error("Enter Valid DCAEUUID Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/ms_dictionary/save_dcaeUUID"; + var postData={dcaeUUIDDictionaryData: dcaeUUIDDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSLocationDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSLocationDictController.js new file mode 100644 index 000000000..808eddd40 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSLocationDictController.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========================================================= + */ +app.controller('editMSLocationController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.microServiceLocationDictionaryData==null) + $scope.label='Add Micro Service Location' + else{ + $scope.label='Edit Micro Service Location' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editMSLocation = message.microServiceLocationDictionaryData; + + $scope.saveMSLocation = function(microServiceLocationDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(microServiceLocationDictionaryData.name)) { + Notification.error("Enter Valid Micro Service Location Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/ms_dictionary/save_location"; + var postData={microServiceLocationDictionaryData: microServiceLocationDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js new file mode 100644 index 000000000..2e30523ad --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js @@ -0,0 +1,97 @@ +/*- + * ============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========================================================= + */ +app.controller('editMSModelController' , function ($scope, $modalInstance, message, $http, UserInfoServiceDS2, Notification){ + if(message.microServiceModelsDictionaryData==null) + $scope.label='Add Micro Service Model' + else{ + $scope.label='Edit Micro Service Model' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + var valid = true; + $scope.editMSmodelName = message.microServiceModelsDictionaryData; + + $scope.uploadFile = function(files) { + var extn = files[0].name.substr(files[0].name.lastIndexOf('.')+1); + if(extn == 'zip' || extn == 'xmi'){ + valid = true; + var fd = new FormData(); + fd.append("file", files[0]); + $http.post("ms_dictionary/set_MSModelData", fd, { + withCredentials: false, + headers: {'Content-Type': undefined }, + transformRequest: angular.identity + }).success(function(data){ + if(data.classListDatas == "EMPTY"){ + Notification.error("No Micro Services Avaialble.") + }else{ + $scope.classListDatas=data.classListDatas; + $scope.modalDatas = data.modelDatas; + console.log($scope.classListDatas); + } + }).error( ); + }else{ + Notification.error("Micro Service Model Upload file should ends with .zip or .xmi extension"); + valid = false; + } + + }; + + $scope.saveMSModel = function(microServiceModelsDictionaryData) { + if(valid){ + var uuu = "saveDictionary/ms_dictionary/save_model"; + var postData={microServiceModelsDictionaryData: microServiceModelsDictionaryData, userid: userid, classMap: $scope.modalDatas}; + $.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){ + Notification.error("Error while saving."); + } + }); + }else{ + Notification.error("Please check Micro Service Model Upload file format."); + } + + }; + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/ModelAttributeDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/ModelAttributeDictController.js new file mode 100644 index 000000000..1eae88daa --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/ModelAttributeDictController.js @@ -0,0 +1,96 @@ +/*- + * ============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========================================================= + */ +app.controller('editModelAttributeController' , function ($scope, $modalInstance, message, PolicyAppService, UserInfoServiceDS2, Notification){ + if(message.modelAttributeDictionaryData==null) + $scope.label='Add New Dictionary Entry' + else{ + $scope.label='Edit Dictionary Entry' + $scope.disableCd=true; + } + + PolicyAppService.getData('getDictionary/get_MicroServiceAttributeData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.microServiceAttributeDictionaryDatas = JSON.parse($scope.data.microServiceAttributeDictionaryDatas); + console.log($scope.microServiceAttributeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('getDictionary/get_MicroServiceModelsDataServiceVersion').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.microServiceModelsDictionaryDatas = JSON.parse($scope.data.microServiceModelsDictionaryDatas); + console.log($scope.microServiceModelsDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editModelAttribute = message.modelAttributeDictionaryData; + $scope.editModelAttribute1 = {microservice: []}; + if($scope.edit){ + if(message.modelAttributeDictionaryData.groupList != null){ + var splitValue = message.modelAttributeDictionaryData.groupList.split(","); + console.log(splitValue); + } + } + $scope.saveModelAttribute = function(modelAttributeDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(modelAttributeDictionaryData.name)) { + Notification.error("Enter Valid Micro Service Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/ms_dictionary/save_modelAttribute"; + var postData={modelAttributeDictionaryData: modelAttributeDictionaryData, userid: userid}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.microServiceAttributeDictionaryDatas=data.microServiceAttributeDictionaryDatas;}); + if($scope.microServiceAttributeDictionaryDatas == "Duplicate"){ + Notification.error("Model Attribute Dictionary exists with Same Attribute Name.") + }else{ + console.log($scope.microServiceAttributeDictionaryDatas); + $modalInstance.close({microServiceAttributeDictionaryDatas:$scope.microServiceAttributeDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + } + }; + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSClosedLoopDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSClosedLoopDictController.js new file mode 100644 index 000000000..746eb44ed --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSClosedLoopDictController.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========================================================= + */ +app.controller('editPSClosedLoopController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.psClosedLoopDictionaryData==null) + $scope.label='Add New Policy Scope ClosedLoop' + else{ + $scope.label='Edit Policy Scope ClosedLoop' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editPSClosedLoop = message.psClosedLoopDictionaryData; + + $scope.savePSClosedLoop = function(psClosedLoopDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(psClosedLoopDictionaryData.name)) { + Notification.error("Enter Valid Policy Scope Closed Loop Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/ps_dictionary/save_psClosedLoop"; + var postData={psClosedLoopDictionaryData: psClosedLoopDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js new file mode 100644 index 000000000..5ddf1489f --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js @@ -0,0 +1,136 @@ +/*- + * ============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========================================================= + */ +app.controller('editPSGroupPolicyScopeController' , function ($scope, $modalInstance, message, PolicyAppService, UserInfoServiceDS2, 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; + } + + PolicyAppService.getData('getDictionary/get_PSServiceDataByName').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"); + }); + + PolicyAppService.getData('getDictionary/get_PSTypeDataByName').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"); + }); + + PolicyAppService.getData('getDictionary/get_PSResourceDataByName').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"); + }); + + PolicyAppService.getData('getDictionary/get_PSClosedLoopDataByName').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 userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = 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) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(groupPolicyScopeListData.groupName)) { + Notification.error("Enter Valid Policy Scope Group Name without spaces or special characters"); + }else{ + console.log(groupPolicyScopeListData1); + if(groupPolicyScopeListData1.resource[0] != undefined && groupPolicyScopeListData1.type[0] != undefined && groupPolicyScopeListData1.service[0] != undefined && groupPolicyScopeListData1.closedloop[0] != undefined){ + var uuu = "saveDictionary/ps_dictionary/save_psGroupPolicyScope"; + var postData={groupPolicyScopeListData: groupPolicyScopeListData, + groupPolicyScopeListData1: groupPolicyScopeListData1, userid: userid}; + $.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){ + Notification.error("Error while saving."); + } + }); + }else{ + Notification.error("Please Select all the required fields to Save"); + } + } + }; + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSResourceDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSResourceDictController.js new file mode 100644 index 000000000..d5afa347a --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSResourceDictController.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========================================================= + */ +app.controller('editPSResourceController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.psResourceDictionaryData==null) + $scope.label='Add New Resource' + else{ + $scope.label='Edit Resource' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editPSResource = message.psResourceDictionaryData; + + $scope.savePSResource = function(psResourceDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(psResourceDictionaryData.name)) { + Notification.error("Enter Valid Resource Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/ps_dictionary/save_psResource"; + var postData={psResourceDictionaryData: psResourceDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSServiceDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSServiceDictController.js new file mode 100644 index 000000000..b3813656e --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSServiceDictController.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========================================================= + */ +app.controller('editPSServiceController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.psServiceDictionaryData==null) + $scope.label='Add New Service' + else{ + $scope.label='Edit Service' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editPSService = message.psServiceDictionaryData; + + $scope.savePSService = function(psServiceDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(psServiceDictionaryData.name)) { + Notification.error("Enter Valid Service Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/ps_dictionary/save_psService"; + var postData={psServiceDictionaryData: psServiceDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSTypeDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSTypeDictController.js new file mode 100644 index 000000000..bb7ef00c3 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSTypeDictController.js @@ -0,0 +1,71 @@ +/*- + * ============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========================================================= + */ +app.controller('editPSTypeController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.psTypeDictionaryData==null) + $scope.label='Add New Type' + else{ + $scope.label='Edit Type' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editPSType = message.psTypeDictionaryData; + + $scope.savePSType = function(psTypeDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(psTypeDictionaryData.name)) { + Notification.error("Enter Valid PS Type Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/ps_dictionary/save_psType"; + var postData={psTypeDictionaryData: psTypeDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/RiskTypeDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/RiskTypeDictController.js new file mode 100644 index 000000000..b5fe5f38a --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/RiskTypeDictController.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========================================================= + */ +app.controller('editRiskTypeController', function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.riskTypeDictionaryData==null) + $scope.label='Add New Type' + else{ + $scope.label='Edit Type' + $scope.disableCd=true; + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editRiskType = message.riskTypeDictionaryData; + + $scope.saveRiskType = function(riskTypeDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(riskTypeDictionaryData.riskName)) { + Notification.error("Enter Valid Risk Type Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/sp_dictionary/save_riskType"; + var postData={riskTypeDictionaryData: riskTypeDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/SafePolicyWarningDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/SafePolicyWarningDictController.js new file mode 100644 index 000000000..9d9a500b3 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/SafePolicyWarningDictController.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========================================================= + */ +app.controller('editSafePolicyWarningController' , function ($scope, $modalInstance, message, PolicyAppService, UserInfoServiceDS2, 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; + } + + PolicyAppService.getData('getDictionary/get_SafePolicyWarningDataByName').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"); + }); + + PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').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 userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = 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) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(safePolicyWarningData.name)) { + Notification.error("Enter Valid Safe Policy Warning Name without spaces or special characters"); + }else{ + console.log(safePolicyWarningData); + var uuu = "saveDictionary/sp_dictionary/save_safePolicyWarning"; + var postData={safePolicyWarningData: safePolicyWarningData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/actionPolicyDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/actionPolicyDictController.js new file mode 100644 index 000000000..36bc73929 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/actionPolicyDictController.js @@ -0,0 +1,114 @@ +/*- + * ============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========================================================= + */ +app.controller('editActionPolicyDictController', function ($scope, $modalInstance, message, UserInfoServiceDS2, 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 }); + } + } + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editActionDict = message.actionPolicyDictionaryData; + $scope.saveActionDict = function(actionPolicyDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(actionPolicyDictionaryData.attributeName)) { + Notification.error("Enter Valid Attribute Name without spaces or special characters"); + }else{ + var finalData = extend(actionPolicyDictionaryData, $scope.headerDatas[0]); + var uuu = "saveDictionary/action_dictionary/save_ActionDict"; + var postData={actionPolicyDictionaryData: finalData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js new file mode 100644 index 000000000..51909162a --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js @@ -0,0 +1,104 @@ +/*- + * ============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========================================================= + */ +app.controller('editAttributeController' ,function ($scope, $modalInstance, message, UserInfoServiceDS2, 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}); + } + } + } + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editAttributeName = message.attributeDictionaryData; + + $scope.saveAttributeName = function(attributeDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(attributeDictionaryData.xacmlId)) { + Notification.error("Enter Valid Attribute Name without spaces or special characters"); + }else{ + var finalData = extend(attributeDictionaryData, $scope.attributeDatas[0]); + var uuu = "saveDictionary/attribute_dictionary/save_attribute"; + var postData={attributeDictionaryData: attributeDictionaryData, userid: userid}; + $.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/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/ecompNameEditorController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/ecompNameEditorController.js new file mode 100644 index 000000000..04c8d812a --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/ecompNameEditorController.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========================================================= + */ +app.controller('editEcompNameController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){ + if(message.ecompNameDictionaryData==null) + $scope.label='Add New Ecomp Name' + else{ + $scope.label='Edit Ecomp Name' + $scope.disableCd=true; + } + $scope.editEcompName = message.ecompNameDictionaryData; + + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.saveEcompName = function(ecompNameDictionaryData) { + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(ecompNameDictionaryData.ecompName)) { + Notification.error("Enter Valid Ecomp Name without spaces or special characters"); + }else{ + var uuu = "saveDictionary/ecomp_dictionary/save_ecompName"; + var postData={ecompNameDictionaryData: ecompNameDictionaryData, userid: userid}; + $.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 diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js new file mode 100644 index 000000000..c8eca84bb --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js @@ -0,0 +1,183 @@ +/*- + * ============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========================================================= + */ +appDS2.controller('brmsControllerDictGridController', function ($scope, PolicyAppService,modalService, $modal){ + $( "#dialog" ).hide(); + + + PolicyAppService.getData('getDictionary/get_BRMSControllerData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.brmsControllerDictionaryDatas = JSON.parse($scope.data.brmsControllerDictionaryDatas); + console.log($scope.brmsControllerDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.brmsControllerDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.brmsControllerDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.brmsControllerDictionaryGrid = { + data : 'brmsControllerDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'BRMSControllerDictionary.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewBRMSControllerWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.viewBRMSControllerWindow(row.entity)"><i class="glyphicon glyphicon-eye-open"></i></button> ' + + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editBRMSControllerWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteBRMSController(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '12%' + }, + { field: 'controllerName', displayName : 'Controller Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'description'}, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editBRMSController = null; + $scope.createNewBRMSControllerWindow = function(){ + $scope.editBRMSController = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_brmsController_popup.html', + controller: 'editBRMSControllerController', + resolve: { + message: function () { + var message = { + brmsControllerDictionaryDatas: $scope.editBRMSController, + disabled : false + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.brmsControllerDictionaryDatas=response.brmsControllerDictionaryDatas; + }); + }; + + $scope.viewBRMSControllerWindow = function(brmsControllerDictionaryData) { + $scope.editBRMSController = brmsControllerDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_brmsController_popup.html', + controller: 'editBRMSControllerController', + resolve: { + message: function () { + var message = { + brmsControllerDictionaryDatas: $scope.editBRMSController, + disabled : true + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.brmsControllerDictionaryDatas=response.brmsControllerDictionaryDatas; + }); + }; + + $scope.editBRMSControllerWindow = function(brmsControllerDictionaryData) { + $scope.editBRMSController = brmsControllerDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_brmsController_popup.html', + controller: 'editBRMSControllerController', + resolve: { + message: function () { + var message = { + brmsControllerDictionaryDatas: $scope.editBRMSController, + disabled : false + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.brmsControllerDictionaryDatas=response.brmsControllerDictionaryDatas; + }); + }; + + $scope.deleteBRMSController = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the BRMS Controller "+data.controllerName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/brms_dictionary/remove_brmsController"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.brmsControllerDictionaryDatas=data.brmsControllerDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js new file mode 100644 index 000000000..596f1bbcd --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js @@ -0,0 +1,182 @@ +/*- + * ============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========================================================= + */ +app.controller('brmsDependencyDictGridController', function ($scope, PolicyAppService,modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_BRMSDependencyData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.brmsDependencyDictionaryDatas = JSON.parse($scope.data.brmsDependencyDictionaryDatas); + console.log($scope.brmsDependencyDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.brmsDependencyDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.brmsDependencyDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.brmsDependencyDictionaryGrid = { + data : 'brmsDependencyDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'BRMSDependencyDictionary.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewBRMSDependencyWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.viewBRMSDependencyWindow(row.entity)"><i class="glyphicon glyphicon-eye-open"></i></button> ' + + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editBRMSDependencyWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteBRMSDependency(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '12%' + }, + { field: 'dependencyName', displayName : 'Dependency Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'description'}, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editBRMSDependency = null; + $scope.createNewBRMSDependencyWindow = function(){ + $scope.editBRMSDependency = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_brmsDependency_popup.html', + controller: 'editBRMSDependencyController', + resolve: { + message: function () { + var message = { + brmsDependencyDictionaryDatas: $scope.editBRMSDependency, + disabled : false + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.brmsDependencyDictionaryDatas=response.brmsDependencyDictionaryDatas; + }); + }; + + $scope.viewBRMSDependencyWindow = function(brmsDependencyDictionaryData) { + $scope.editBRMSDependency = brmsDependencyDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_brmsDependency_popup.html', + controller: 'editBRMSDependencyController', + resolve: { + message: function () { + var message = { + brmsDependencyDictionaryDatas: $scope.editBRMSDependency, + disabled : true + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.brmsDependencyDictionaryDatas=response.brmsDependencyDictionaryDatas; + }); + }; + + $scope.editBRMSDependencyWindow = function(brmsDependencyDictionaryData) { + $scope.editBRMSDependency = brmsDependencyDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_brmsDependency_popup.html', + controller: 'editBRMSDependencyController', + resolve: { + message: function () { + var message = { + brmsDependencyDictionaryDatas: $scope.editBRMSDependency, + disabled : false + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.brmsDependencyDictionaryDatas=response.brmsDependencyDictionaryDatas; + }); + }; + + $scope.deleteBRMSDependency = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the BRMS Dependency "+data.dependencyName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/brms_dictionary/remove_brmsDependency"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.brmsDependencyDictionaryDatas=data.brmsDependencyDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js new file mode 100644 index 000000000..fd49a3a9e --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js @@ -0,0 +1,163 @@ +/*- + * ============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========================================================= + */ +app.controller('brmsParamDictGridController', function ($scope, PolicyAppService,modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_BRMSParamData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.brmsParamDictionaryDatas = JSON.parse($scope.data.brmsParamDictionaryDatas); + console.log($scope.brmsParamDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.brmsParamDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.brmsParamDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.brmsParamDictionaryGrid = { + data : 'brmsParamDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'BRMSParamDictionary.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewBRMSParamWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteBRMSParam(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'ruleName', displayName : 'Rule Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'description'}, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editBRMSParam = null; + $scope.createNewBRMSParamWindow = function(){ + $scope.editBRMSParam = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_brmsParam_popup.html', + controller: 'editBRMSParamController', + resolve: { + message: function () { + var message = { + brmsParamDictionaryDatas: $scope.editBRMSParam + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.brmsParamDictionaryDatas=response.brmsParamDictionaryDatas; + }); + }; + + $scope.deleteBRMSParam = function(data) { + var uuu = "searchDictionary"; + var postData={data: data, type: "brmsParam"}; + var searchString = "\n"; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(resultList){ + $scope.$apply(function(){ + $scope.list =resultList.result;}); + $scope.searchData = JSON.stringify(resultList.result); + $scope.searchDatas = JSON.parse($scope.searchData); + $scope.success = true; + var i; + if($scope.searchDatas.length > 0){ + for(i = 0 ; i < $scope.searchDatas.length; i++){ + searchString += $scope.searchDatas[i].name + "\n"; + } + }else{ + searchString += "No Policies is Using this Value" + } + + console.log($scope.list); + if($scope.success){ + modalService.popupConfirmWin("Confirm","You are about to delete the BRMS Param Name: "+data.ruleName+". \n used in the following policie(s)\n "+searchString+" \n Do you want to continue?", + function(){ + var uuu = "deleteDictionary/brms_dictionary/remove_brmsParam"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.brmsParamDictionaryDatas=data.brmsParamDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + })} + }, + error : function(data){ + alert("Error while Searching."); + } + }); + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js new file mode 100644 index 000000000..9ec2a2091 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js @@ -0,0 +1,189 @@ +/*- + * ============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========================================================= + */ +app.controller('pepOptionsDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + + PolicyAppService.getData('getDictionary/get_PEPOptionsData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.pepOptionsDictionaryDatas = JSON.parse($scope.data.pepOptionsDictionaryDatas); + console.log($scope.pepOptionsDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.pepOptionsDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.pepOptionsDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.pepOptionsDictionaryGrid = { + data : 'pepOptionsDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'PEPOptions.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewPEPOptionsWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPEPOptionsWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePEPOptions(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'pepName', displayName : 'PEP Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'actions', displayName : 'Actions'}, + { field: 'description'}, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editPEPOptions = null; + $scope.createNewPEPOptionsWindow = function(){ + $scope.editEcompName = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PEPOptions_popup.html', + controller: 'editPEPOptionsController', + resolve: { + message: function () { + var message = { + pepOptionsDictionaryDatas: $scope.editPEPOptions + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.pepOptionsDictionaryDatas=response.pepOptionsDictionaryDatas; + }); + }; + + $scope.editPEPOptionsWindow = function(pepOptionsDictionaryData) { + $scope.editPEPOptions = pepOptionsDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PEPOptions_popup.html', + controller: 'editPEPOptionsController', + resolve: { + message: function () { + var message = { + pepOptionsDictionaryData: $scope.editPEPOptions + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.pepOptionsDictionaryDatas = response.pepOptionsDictionaryDatas; + }); + }; + + $scope.deletePEPOptions = function(data) { + var uuu = "searchDictionary"; + var postData={data: data, type: "pepOptions"}; + var searchString = "\n"; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(resultList){ + $scope.$apply(function(){ + $scope.list =resultList.result;}); + $scope.searchData = JSON.stringify(resultList.result); + $scope.searchDatas = JSON.parse($scope.searchData); + $scope.success = true; + var i; + if($scope.searchDatas.length > 0){ + for(i = 0 ; i < $scope.searchDatas.length; i++){ + searchString += $scope.searchDatas[i].name + "\n"; + } + }else{ + searchString += "No Policies is Using this Value" + } + + console.log($scope.list); + if($scope.success){ + modalService.popupConfirmWin("Confirm","You are about to delete the PEP Options : "+data.pepName+". \n "+searchString+" \n Do you want to continue?", + function(){ + var uuu = "deleteDictionary/cl_dictionary/remove_pepOptions"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.pepOptionsDictionaryDatas=data.pepOptionsDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + })} + }, + error : function(data){ + alert("Error while Searching."); + } + }); + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js new file mode 100644 index 000000000..099c1e648 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js @@ -0,0 +1,165 @@ +/*- + * ============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========================================================= + */ +app.controller('serviceDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_ClosedLoopServicesData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.closedLoopServiceDictionaryDatas = JSON.parse($scope.data.closedLoopServiceDictionaryDatas); + console.log($scope.closedLoopServiceDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.serviceDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.serviceDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.serviceDictionaryGrid = { + data : 'closedLoopServiceDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewServiceDictWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editServiceDictWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteServiceDict(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'serviceName', displayName : 'Service Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'description'}, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ] + }; + + $scope.editCLService = null; + $scope.createNewServiceDictWindow = function(){ + $scope.editCLService = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_CLService_popup.html', + controller: 'editCLServiceController', + resolve: { + message: function () { + var message = { + closedLoopServiceDictionaryDatas: $scope.editCLService + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.closedLoopServiceDictionaryDatas=response.closedLoopServiceDictionaryDatas; + }); + }; + + $scope.editServiceDictWindow = function(closedLoopServiceDictionaryData) { + $scope.editCLService = closedLoopServiceDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_CLService_popup.html', + controller: 'editCLServiceController', + resolve: { + message: function () { + var message = { + closedLoopServiceDictionaryData: $scope.editCLService + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.closedLoopServiceDictionaryDatas = response.closedLoopServiceDictionaryDatas; + }); + }; + + $scope.deleteServiceDict = function(data) { + var uuu = "searchDictionary"; + var postData={data: data, type: "clService"}; + var searchString = "\n"; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(resultList){ + $scope.$apply(function(){ + $scope.list =resultList.result;}); + $scope.searchData = JSON.stringify(resultList.result); + $scope.searchDatas = JSON.parse($scope.searchData); + $scope.success = true; + var i; + if($scope.searchDatas.length > 0){ + for(i = 0 ; i < $scope.searchDatas.length; i++){ + searchString += $scope.searchDatas[i].name + "\n"; + } + }else{ + searchString += "No Policies is Using this Value" + } + + console.log($scope.list); + if($scope.success){ + modalService.popupConfirmWin("Confirm","You are about to delete the Service Dictionary "+data.serviceName+". \n "+searchString+" \n Do you want to continue?", + function(){ + var uuu = "deleteDictionary/cl_dictionary/remove_Service"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.closedLoopServiceDictionaryDatas=data.closedLoopServiceDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + })} + }, + error : function(data){ + alert("Error while Searching."); + } + }); + }; + + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js new file mode 100644 index 000000000..d42674a33 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js @@ -0,0 +1,165 @@ +/*- + * ============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========================================================= + */ +app.controller('siteDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_ClosedLoopSiteData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.closedLoopSiteDictionaryDatas = JSON.parse($scope.data.closedLoopSiteDictionaryDatas); + console.log($scope.closedLoopSiteDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.siteDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.siteDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.siteDictionaryGrid = { + data : 'closedLoopSiteDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewSiteDictWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editSiteDictWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteSiteDict(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'siteName', displayName : 'Site Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'description'}, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ] + }; + + $scope.editCLSite = null; + $scope.createNewSiteDictWindow = function(){ + $scope.editCLSite = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_CLSite_popup.html', + controller: 'editCLSiteController', + resolve: { + message: function () { + var message = { + closedLoopSiteDictionaryDatas: $scope.editCLSite + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.closedLoopSiteDictionaryDatas=response.closedLoopSiteDictionaryDatas; + }); + }; + + $scope.editSiteDictWindow = function(closedLoopSiteDictionaryData) { + $scope.editCLSite = closedLoopSiteDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_CLSite_popup.html', + controller: 'editCLSiteController', + resolve: { + message: function () { + var message = { + closedLoopSiteDictionaryData: $scope.editCLSite + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.closedLoopSiteDictionaryDatas = response.closedLoopSiteDictionaryDatas; + }); + }; + + $scope.deleteSiteDict = function(data) { + var uuu = "searchDictionary"; + var postData={data: data, type: "clSite"}; + var searchString = "\n"; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(resultList){ + $scope.$apply(function(){ + $scope.list =resultList.result;}); + $scope.searchData = JSON.stringify(resultList.result); + $scope.searchDatas = JSON.parse($scope.searchData); + $scope.success = true; + var i; + if($scope.searchDatas.length > 0){ + for(i = 0 ; i < $scope.searchDatas.length; i++){ + searchString += $scope.searchDatas[i].name + "\n"; + } + }else{ + searchString += "No Policies is Using this Value" + } + + console.log($scope.list); + if($scope.success){ + modalService.popupConfirmWin("Confirm","You are about to delete the Site Dictionary : "+data.siteName+". \n "+searchString+" \n Do you want to continue?", + function(){ + var uuu = "deleteDictionary/cl_dictionary/remove_site"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.closedLoopSiteDictionaryDatas=data.closedLoopSiteDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + })} + }, + error : function(data){ + alert("Error while Searching."); + } + }); + }; + + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js new file mode 100644 index 000000000..f191da9c7 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js @@ -0,0 +1,189 @@ +/*- + * ============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========================================================= + */ +app.controller('varbindDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_VarbindDictionaryData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.varbindDictionaryDatas = JSON.parse($scope.data.varbindDictionaryDatas); + console.log($scope.varbindDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.varbindDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.varbindDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.varbindDictionaryGrid = { + data : 'varbindDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'VarbindDictionary.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewVarbindDictWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editVarbindDictWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteVarbindDictionary(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'varbindName', displayName : 'Varbind Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'varbindDescription', displayName : 'Varbind Description'}, + { field: 'varbindOID', displayName : 'Varbind OID'}, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editCLVarbind = null; + $scope.createNewVarbindDictWindow = function(){ + $scope.editCLVarbind = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_varbind_popup.html', + controller: 'editCLVarbindController', + resolve: { + message: function () { + var message = { + varbindDictionaryDatas: $scope.editCLVarbind + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.varbindDictionaryDatas=response.varbindDictionaryDatas; + }); + }; + + $scope.editVarbindDictWindow = function(varbindDictionaryData) { + $scope.editCLVarbind = varbindDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_varbind_popup.html', + controller: 'editCLVarbindController', + resolve: { + message: function () { + var message = { + varbindDictionaryData: $scope.editCLVarbind + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.varbindDictionaryDatas = response.varbindDictionaryDatas; + }); + }; + + $scope.deleteVarbindDictionary = function(data) { + var uuu = "searchDictionary"; + var postData={data: data, type: "clVarbind"}; + var searchString = "\n"; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(resultList){ + $scope.$apply(function(){ + $scope.list =resultList.result;}); + $scope.searchData = JSON.stringify(resultList.result); + $scope.searchDatas = JSON.parse($scope.searchData); + $scope.success = true; + var i; + if($scope.searchDatas.length > 0){ + for(i = 0 ; i < $scope.searchDatas.length; i++){ + searchString += $scope.searchDatas[i].name + "\n"; + } + }else{ + searchString += "No Policies is Using this Value" + } + + console.log($scope.list); + if($scope.success){ + modalService.popupConfirmWin("Confirm","You are about to delete the Varbind Dictionary "+data.varbindName+". \n "+searchString+" \n Do you want to continue?", + function(){ + var uuu = "deleteDictionary/cl_dictionary/remove_varbindDict"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.varbindDictionaryDatas=data.varbindDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + })} + }, + error : function(data){ + alert("Error while Searching."); + } + }); + }; + + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js new file mode 100644 index 000000000..545568f68 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js @@ -0,0 +1,186 @@ +/*- + * ============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========================================================= + */ +app.controller('vnfTypeDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_VNFTypeData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.vnfTypeDictionaryDatas = JSON.parse($scope.data.vnfTypeDictionaryDatas); + console.log($scope.vnfTypeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.vnfTypeDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.vnfTypeDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.vnfTypeDictionaryGrid = { + data : 'vnfTypeDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'VNFType.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewVnfTypeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editVnfTypeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteVnfType(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'vnftype', displayName : 'VNF Type', sort: { direction: 'asc', priority: 0 }}, + { field: 'description'}, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editVnfType = null; + $scope.createNewVnfTypeWindow = function(){ + $scope.editVnfType = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_vnfType_popup.html', + controller: 'editVnfTypeController', + resolve: { + message: function () { + var message = { + vnfTypeDictionaryDatas: $scope.editVnfType + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.vnfTypeDictionaryDatas=response.vnfTypeDictionaryDatas; + }); + }; + + $scope.editVnfTypeWindow = function(vnfTypeDictionaryData) { + $scope.editVnfType = vnfTypeDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_vnfType_popup.html', + controller: 'editVnfTypeController', + resolve: { + message: function () { + var message = { + vnfTypeDictionaryData: $scope.editVnfType + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.vnfTypeDictionaryDatas = response.vnfTypeDictionaryDatas; + }); + }; + + $scope.deleteVnfType = function(data) { + var uuu = "searchDictionary"; + var postData={data: data, type: "attribute"}; + var searchString = "\n"; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(resultList){ + $scope.$apply(function(){ + $scope.list =resultList.result;}); + $scope.searchData = JSON.stringify(resultList.result); + $scope.searchDatas = JSON.parse($scope.searchData); + $scope.success = true; + var i; + if($scope.searchDatas.length > 0){ + for(i = 0 ; i < $scope.searchDatas.length; i++){ + searchString += $scope.searchDatas[i].name + "\n"; + } + }else{ + searchString += "No Policies is Using this Value" + } + + console.log($scope.list); + if($scope.success){ + modalService.popupConfirmWin("Confirm","You are about to delete the Vnf Type Dictionary Item "+data.vnftype+". \n "+searchString+" \n Do you want to continue?", + function(){ + var uuu = "deleteDictionary/cl_dictionary/remove_vnfType"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.vnfTypeDictionaryDatas=data.vnfTypeDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + })} + }, + error : function(data){ + alert("Error while Searching."); + } + }); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js new file mode 100644 index 000000000..61091523f --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js @@ -0,0 +1,188 @@ +/*- + * ============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========================================================= + */ +app.controller('vsclActionDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_VSCLActionData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.vsclActionDictionaryDatas = JSON.parse($scope.data.vsclActionDictionaryDatas); + console.log($scope.vsclActionDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.vsclActionDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.vsclActionDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.vsclActionDictionaryGrid = { + data : 'vsclActionDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'VSCLAction.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createvsclActionWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editvsclActionWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletevsclAction(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'vsclaction', displayName : 'VSCL Action', sort: { direction: 'asc', priority: 0 }}, + { field: 'description'}, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editvsclAction = null; + $scope.createvsclActionWindow = function(){ + $scope.editvsclAction = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_vsclAction_popup.html', + controller: 'editVsclActionController', + resolve: { + message: function () { + var message = { + vsclActionDictionaryDatas: $scope.editvsclAction + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.vsclActionDictionaryDatas=response.vsclActionDictionaryDatas; + }); + }; + + $scope.editvsclActionWindow = function(vsclActionDictionaryData) { + $scope.editvsclAction = vsclActionDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_vsclAction_popup.html', + controller: 'editVsclActionController', + resolve: { + message: function () { + var message = { + vsclActionDictionaryData: $scope.editvsclAction + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.vsclActionDictionaryDatas = response.vsclActionDictionaryDatas; + }); + }; + + $scope.success = false; + $scope.deletevsclAction = function(data) { + var uuu = "searchDictionary"; + var postData={data: data, type: "clVSCL"}; + var searchString = "\n"; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(resultList){ + $scope.$apply(function(){ + $scope.list =resultList.result;}); + $scope.searchData = JSON.stringify(resultList.result); + $scope.searchDatas = JSON.parse($scope.searchData); + $scope.success = true; + var i; + if($scope.searchDatas.length > 0){ + for(i = 0 ; i < $scope.searchDatas.length; i++){ + searchString += $scope.searchDatas[i].name + "\n"; + } + }else{ + searchString += "No Policies is Using this Value" + } + + console.log($scope.list); + if($scope.success){ + modalService.popupConfirmWin("Confirm","You are about to delete the Vscl Action Item "+data.vsclaction+". \n "+searchString+" \n Do you want to continue?", + function(){ + var uuu = "deleteDictionary/cl_dictionary/remove_VsclAction"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.vsclActionDictionaryDatas=data.vsclActionDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + })} + }, + error : function(data){ + alert("Error while Searching."); + } + }); + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js new file mode 100644 index 000000000..01b55d08a --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js @@ -0,0 +1,157 @@ +/*- + * ============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========================================================= + */ +app.controller('decisionSettingsDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_SettingsDictionaryData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.settingsDictionaryDatas = JSON.parse($scope.data.settingsDictionaryDatas); + console.log($scope.settingsDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.decisionSettingsDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.decisionSettingsDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.decisionSettingsDictionaryGrid = { + data : 'settingsDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'Settings.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewSettingsDictWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editSettingsDictWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteSettingsDict(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'xacmlId', displayName : 'Settings ID', sort: { direction: 'asc', priority: 0 }}, + { field: 'datatypeBean.shortName', displayName : 'Data Type' }, + { field: 'description' }, + {field: 'userCreatedBy.userName', displayName : 'Created By' }, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editSettingsDict = null; + $scope.createNewSettingsDictWindow = function(){ + $scope.editSettingsDict = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_SettingsDict_popup.html', + controller: 'editSettingsDictController', + resolve: { + message: function () { + var message = { + settingsDictionaryDatas: $scope.editSettingsDict + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.settingsDictionaryDatas=response.settingsDictionaryDatas; + }); + }; + + $scope.editSettingsDictWindow = function(settingsDictionaryData) { + $scope.editSettingsDict = settingsDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_SettingsDict_popup.html', + controller: 'editSettingsDictController', + resolve: { + message: function () { + var message = { + settingsDictionaryData: $scope.editSettingsDict + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.settingsDictionaryDatas = response.settingsDictionaryDatas; + }); + }; + + $scope.deleteSettingsDict = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Settings Dictionary "+data.xacmlId+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/settings_dictionary/remove_settings"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.settingsDictionaryDatas=data.settingsDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js new file mode 100644 index 000000000..8c3493907 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js @@ -0,0 +1,155 @@ +/*- + * ============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========================================================= + */ +app.controller('descriptiveDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_DescriptiveScope').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.descriptiveScopeDictionaryDatas = JSON.parse($scope.data.descriptiveScopeDictionaryDatas); + console.log($scope.descriptiveScopeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.descriptiveDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.descriptiveDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.descriptiveDictionaryGrid = { + data : 'descriptiveScopeDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'SearchCriteria.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewDescriptiveScopeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editDescriptiveScopeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteDescriptiveScope(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'scopeName', displayName : 'Descriptive Scope Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'search', displayName : 'Search Criteria' }, + { field: 'description' }, + {field: 'userCreatedBy.userName', displayName : 'Created By' }, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editDescriptiveScope = null; + $scope.createNewDescriptiveScopeWindow = function(){ + $scope.editDescriptiveScope = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_descriptiveScope_popup.html', + controller: 'editDescriptiveScopeController', + resolve: { + message: function () { + var message = { + descriptiveScopeDictionaryDatas: $scope.editDescriptiveScope + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.descriptiveScopeDictionaryDatas=response.descriptiveScopeDictionaryDatas; + }); + }; + + $scope.editDescriptiveScopeWindow = function(descriptiveScopeDictionaryData) { + $scope.editDescriptiveScope = descriptiveScopeDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_descriptiveScope_popup.html', + controller: 'editDescriptiveScopeController', + resolve: { + message: function () { + var message = { + descriptiveScopeDictionaryData: $scope.editDescriptiveScope + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.descriptiveScopeDictionaryDatas = response.descriptiveScopeDictionaryDatas; + }); + }; + + $scope.deleteDescriptiveScope = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Descriptive Scope : "+data.scopeName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/descriptive_dictionary/remove_descriptiveScope"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.descriptiveScopeDictionaryDatas=data.descriptiveScopeDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/EnforcerTypeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/EnforcerTypeDictGridController.js new file mode 100644 index 000000000..1012a64e2 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/EnforcerTypeDictGridController.js @@ -0,0 +1,114 @@ +/*- + * ============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========================================================= + */ +app.controller('enforcerDictGridController', function ($scope, PolicyAppService,modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_EnforcerTypeData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.enforcerDictionaryDatas = JSON.parse($scope.data.enforcerDictionaryDatas); + console.log($scope.enforcerDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + $scope.enforcerDictionaryGrid = { + data : 'enforcerDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewEnforcerTypeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editEnforcerTypeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteEnforcerType(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'enforcingType', displayName : 'Enforcing Type', sort: { direction: 'asc', priority: 0 }}, + { field: 'script' , displayName : 'Script'}, + {field: 'connectionQuery', displayName : 'Connection Query' }, + {field: 'valueQuery', displayName : 'Value Query'} + ] + }; + + $scope.editEnforcerType = null; + $scope.createNewEnforcerTypeWindow = function(){ + $scope.editEnforcerType = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_EnforcerType_popup.html', + controller: 'editEnforcerTypeController', + resolve: { + message: function () { + var message = { + enforcerDictionaryDatas: $scope.editEnforcerType + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.enforcerDictionaryDatas=response.enforcerDictionaryDatas; + }); + }; + + $scope.editEnforcerTypeWindow = function(enforcerDictionaryData) { + $scope.editEnforcerType = enforcerDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_EnforcerType_popup.html', + controller: 'editEnforcerTypeController', + resolve: { + message: function () { + var message = { + enforcerDictionaryData: $scope.editEnforcerType + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.enforcerDictionaryDatas = response.enforcerDictionaryDatas; + }); + }; + + $scope.deleteEnforcerType = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Enforcing Type "+data.enforcingType+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/enforcer_dictionary/remove_enforcer"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.enforcerDictionaryDatas=data.enforcerDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWActionListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWActionListDictGridController.js new file mode 100644 index 000000000..73a2a8d02 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWActionListDictGridController.js @@ -0,0 +1,150 @@ +/*- + * ============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========================================================= + */ +app.controller('actionListDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_ActionListData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.actionListDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.actionListDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.actionListDictionaryGrid = { + data : 'actionListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'ActionList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWActionListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWActionListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWActionList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'actionName', displayName : 'Action Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'description' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editActionList = null; + $scope.createNewFWActionListWindow = function(){ + $scope.editActionList = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWActionList_popup.html', + controller: 'editFWActionListController', + resolve: { + message: function () { + var message = { + actionListDictionaryDatas: $scope.editActionList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.actionListDictionaryDatas=response.actionListDictionaryDatas; + }); + }; + + $scope.editFWActionListWindow = function(actionListDictionaryData) { + $scope.editActionList = actionListDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWActionList_popup.html', + controller: 'editFWActionListController', + resolve: { + message: function () { + var message = { + actionListDictionaryData: $scope.editActionList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.actionListDictionaryDatas = response.actionListDictionaryDatas; + }); + }; + + $scope.deleteFWActionList = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Action List "+data.actionName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_ActionList"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.actionListDictionaryDatas=data.actionListDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWAddressGroupDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWAddressGroupDictGridController.js new file mode 100644 index 000000000..183bc02e4 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWAddressGroupDictGridController.js @@ -0,0 +1,153 @@ +/*- + * ============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========================================================= + */ +app.controller('addressGroupDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_AddressGroupData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.addressGroupDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.addressGroupDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + + $scope.addressGroupDictionaryGrid = { + data : 'addressGroupDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'AddressGroup.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWAddressGroupWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWAddressGroupWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWAddressGroup(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'groupName', displayName : 'Group Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'prefixList', displayName : 'Prefix List' }, + { field: 'description' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + + $scope.editAddressGroup = null; + $scope.createNewFWAddressGroupWindow = function(){ + $scope.editAddressGroup = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWAddressGroup_popup.html', + controller: 'editFWAddressGroupController', + resolve: { + message: function () { + var message = { + addressGroupDictionaryDatas: $scope.editAddressGroup + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.addressGroupDictionaryDatas=response.addressGroupDictionaryDatas; + }); + }; + + $scope.editFWAddressGroupWindow = function(addressGroupDictionaryData) { + $scope.editAddressGroup = addressGroupDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWAddressGroup_popup.html', + controller: 'editFWAddressGroupController', + resolve: { + message: function () { + var message = { + addressGroupDictionaryData: $scope.editAddressGroup + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.addressGroupDictionaryDatas = response.addressGroupDictionaryDatas; + }); + }; + + $scope.deleteFWAddressGroup = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Address Group "+data.groupName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_AddressGroup"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.addressGroupDictionaryDatas=data.addressGroupDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js new file mode 100644 index 000000000..7261aa3f0 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js @@ -0,0 +1,153 @@ +/*- + * ============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========================================================= + */ +app.controller('parentDictGridController', function ($scope, PolicyAppService,modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_FWDictionaryListData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.fwDictListDictionaryDatas = JSON.parse($scope.data.fwDictListDictionaryDatas); + console.log($scope.fwDictListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.parentDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.parentDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.parentDictionaryGrid = { + data : 'fwDictListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'ParentList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWParentListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWParentListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWParentList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'parentItemName', displayName : 'Parent Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'description', displayName : 'Description' }, + { field: 'addressList', displayName : 'Address List' }, + { field: 'serviceList', displayName : 'Service List' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editParentList = null; + $scope.createNewFWParentListWindow = function(){ + $scope.editParentList = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwParentList_popup.html', + controller: 'editFWParentListController', + resolve: { + message: function () { + var message = { + fwDictListDictionaryDatas: $scope.editParentList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.fwDictListDictionaryDatas=response.fwDictListDictionaryDatas; + }); + }; + + $scope.editFWParentListWindow = function(fwDictListDictionaryData) { + $scope.editParentList = fwDictListDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwParentList_popup.html', + controller: 'editFWParentListController', + resolve: { + message: function () { + var message = { + fwDictListDictionaryData: $scope.editParentList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.fwDictListDictionaryDatas = response.fwDictListDictionaryDatas; + }); + }; + + $scope.deleteFWParentList = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Parent List: "+data.parentItemName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_FWDictionaryList"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.fwDictListDictionaryDatas=data.fwDictListDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPortListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPortListDictGridController.js new file mode 100644 index 000000000..3787a5e6b --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPortListDictGridController.js @@ -0,0 +1,127 @@ +/*- + * ============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========================================================= + */ +app.controller('portListDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_PortListData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.portListDictionaryDatas = JSON.parse($scope.data.portListDictionaryDatas); + console.log($scope.portListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.portListDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.portListDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.portListDictionaryGrid = { + data : 'portListDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWPortListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWPortListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWPortList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'portName', displayName : 'Port Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'description' } + ] + }; + + $scope.editPortList = null; + $scope.createNewFWPortListWindow = function(){ + $scope.editPortList = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWPortList_popup.html', + controller: 'editFWPortListController', + resolve: { + message: function () { + var message = { + portListDictionaryDatas: $scope.editPortList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.portListDictionaryDatas=response.portListDictionaryDatas; + }); + }; + + $scope.editFWPortListWindow = function(portListDictionaryData) { + $scope.editPortList = portListDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWPortList_popup.html', + controller: 'editFWPortListController', + resolve: { + message: function () { + var message = { + portListDictionaryData: $scope.editPortList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.portListDictionaryDatas = response.portListDictionaryDatas; + }); + }; + + $scope.deleteFWPortList = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Port List "+data.portName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_PortList"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.portListDictionaryDatas=data.portListDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPrefixListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPrefixListDictGridController.js new file mode 100644 index 000000000..d39729689 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPrefixListDictGridController.js @@ -0,0 +1,153 @@ +/*- + * ============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========================================================= + */ +app.controller('prefixListDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_PrefixListData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.prefixListDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.prefixListDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.prefixListDictionaryGrid = { + data : 'prefixListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'PrefixList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWPrefixListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWPrefixListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWPrefixList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'prefixListName', displayName : 'PrefixList Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'description' }, + {field: 'prefixListValue', displayName : 'PrefixList Value' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + + $scope.editPrefixList = null; + $scope.createNewFWPrefixListWindow = function(){ + $scope.editPrefixList = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWPrefixList_popup.html', + controller: 'editFWPrefixListController', + resolve: { + message: function () { + var message = { + prefixListDictionaryDatas: $scope.editPrefixList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.prefixListDictionaryDatas=response.prefixListDictionaryDatas; + }); + }; + + $scope.editFWPrefixListWindow = function(prefixListDictionaryData) { + $scope.editPrefixList = prefixListDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWPrefixList_popup.html', + controller: 'editFWPrefixListController', + resolve: { + message: function () { + var message = { + prefixListDictionaryData: $scope.editPrefixList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.prefixListDictionaryDatas = response.prefixListDictionaryDatas; + }); + }; + + $scope.deleteFWPrefixList = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Prefix List "+data.prefixListName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_PrefixList"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.prefixListDictionaryDatas=data.prefixListDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWProtocolListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWProtocolListDictGridController.js new file mode 100644 index 000000000..a4a3ea8c0 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWProtocolListDictGridController.js @@ -0,0 +1,153 @@ +/*- + * ============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========================================================= + */ +app.controller('protocolListDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + + PolicyAppService.getData('getDictionary/get_ProtocolListData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.protocolListDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.protocolListDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.protocolListDictionaryGrid = { + data : 'protocolListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'ProtocolList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWProtocolListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWProtocolListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWProtocolList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'protocolName', displayName : 'Protocol Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'description' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + + $scope.editProtocolList = null; + $scope.createNewFWProtocolListWindow = function(){ + $scope.editProtocolList = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWProtocolList_popup.html', + controller: 'editFWProtocolListController', + resolve: { + message: function () { + var message = { + protocolListDictionaryDatas: $scope.editProtocolList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.protocolListDictionaryDatas=response.protocolListDictionaryDatas; + }); + }; + + $scope.editFWProtocolListWindow = function(protocolListDictionaryData) { + $scope.editProtocolList = protocolListDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWProtocolList_popup.html', + controller: 'editFWProtocolListController', + resolve: { + message: function () { + var message = { + protocolListDictionaryData: $scope.editProtocolList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.protocolListDictionaryDatas = response.protocolListDictionaryDatas; + }); + }; + + $scope.deleteFWProtocolList = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Protocol List "+data.protocolName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_protocol"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.protocolListDictionaryDatas=data.protocolListDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWSecurityZoneDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWSecurityZoneDictGridController.js new file mode 100644 index 000000000..0923581a7 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWSecurityZoneDictGridController.js @@ -0,0 +1,151 @@ +/*- + * ============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========================================================= + */ +app.controller('securityZoneDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_SecurityZoneData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.securityZoneDictionaryDatas = JSON.parse($scope.data.securityZoneDictionaryDatas); + console.log($scope.securityZoneDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.securityZoneDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.securityZoneDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.securityZoneDictionaryGrid = { + data : 'securityZoneDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'SecurityZone.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWSecurityZoneWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWSecurityZoneWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWSecurityZone(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'zoneName', displayName : 'Zone Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'zoneValue', displayName : 'Zone Value' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editSecurityZone = null; + $scope.createNewFWSecurityZoneWindow = function(){ + $scope.editSecurityZone = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwSecurityZone_popup.html', + controller: 'editfwSecurityZoneController', + resolve: { + message: function () { + var message = { + securityZoneDictionaryDatas: $scope.editSecurityZone + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.securityZoneDictionaryDatas=response.securityZoneDictionaryDatas; + }); + }; + + $scope.editFWSecurityZoneWindow = function(securityZoneDictionaryData) { + $scope.editSecurityZone = securityZoneDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwSecurityZone_popup.html', + controller: 'editfwSecurityZoneController', + resolve: { + message: function () { + var message = { + securityZoneDictionaryData: $scope.editSecurityZone + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.securityZoneDictionaryDatas = response.securityZoneDictionaryDatas; + }); + }; + + $scope.deleteFWSecurityZone = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Security Zone "+data.zoneName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_securityZone"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.securityZoneDictionaryDatas=data.securityZoneDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceGroupDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceGroupDictGridController.js new file mode 100644 index 000000000..d7dc43348 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceGroupDictGridController.js @@ -0,0 +1,151 @@ +/*- + * ============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========================================================= + */ +app.controller('serviceGroupDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_ServiceGroupData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.serviceGroupDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.serviceGroupDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.serviceGroupDictionaryGrid = { + data : 'serviceGroupDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'ServiceGroup.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWServiceGroupWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWServiceGroupWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWServiceGroup(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'groupName', displayName : 'Group Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'serviceList', displayName : 'Service List' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editServiceGroup = null; + $scope.createNewFWServiceGroupWindow = function(){ + $scope.editServiceGroup = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwServiceGroup_popup.html', + controller: 'editFWServiceGroupController', + resolve: { + message: function () { + var message = { + serviceGroupDictionaryDatas: $scope.editServiceGroup + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.serviceGroupDictionaryDatas=response.serviceGroupDictionaryDatas; + }); + }; + + $scope.editFWServiceGroupWindow = function(serviceGroupDictionaryData) { + $scope.editServiceGroup = serviceGroupDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwServiceGroup_popup.html', + controller: 'editFWServiceGroupController', + resolve: { + message: function () { + var message = { + serviceGroupDictionaryData: $scope.editServiceGroup + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.serviceGroupDictionaryDatas = response.serviceGroupDictionaryDatas; + }); + }; + + $scope.deleteFWServiceGroup = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Service Group: "+data.groupName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_serviceGroup"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.serviceGroupDictionaryDatas=data.serviceGroupDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceListDictGridController.js new file mode 100644 index 000000000..dfd96e817 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceListDictGridController.js @@ -0,0 +1,165 @@ +/*- + * ============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========================================================= + */ +app.controller('serviceListDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_ServiceListData').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"); + }); + + PolicyAppService.getData('getDictionary/get_ProtocolListData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.serviceListDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.serviceListDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.serviceListDictionaryGrid = { + data : 'serviceListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'ServiceList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWServiceListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWServiceListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWServiceList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'serviceName', displayName : 'Service Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'serviceDescription' , displayName : 'Description'}, + {field: 'serviceType', displayName : 'Service Type' }, + {field: 'serviceTransProtocol', displayName : 'Transport Protocol'}, + {field: 'serviceAppProtocol',displayName : 'APP Protocol' }, + {field: 'servicePorts',displayName : 'Ports' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editServiceList = null; + $scope.createNewFWServiceListWindow = function(){ + $scope.editServiceList = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWServiceList_popup.html', + controller: 'editFWServiceListController', + resolve: { + message: function () { + var message = { + serviceListDictionaryDatas: $scope.editServiceList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.serviceListDictionaryDatas=response.serviceListDictionaryDatas; + }); + }; + + $scope.editFWServiceListWindow = function(serviceListDictionaryData) { + $scope.editServiceList = serviceListDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWServiceList_popup.html', + controller: 'editFWServiceListController', + resolve: { + message: function () { + var message = { + serviceListDictionaryData: $scope.editServiceList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.serviceListDictionaryDatas = response.serviceListDictionaryDatas; + }); + }; + + $scope.deleteFWServiceList = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Service List "+data.serviceName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_serviceList"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.serviceListDictionaryDatas=data.serviceListDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagListDictGridController.js new file mode 100644 index 000000000..74618e086 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagListDictGridController.js @@ -0,0 +1,157 @@ +/*- + * ============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========================================================= + */ +app.controller('tagListDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_TagListData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.fwTagDictionaryDatas = JSON.parse($scope.data.fwTagDictionaryDatas); + console.log($scope.fwTagDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.tagListDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.tagListDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.tagListDictionaryGrid = { + data : 'fwTagDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'FWTag.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWTagWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWTagWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWTag(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'fwTagName', displayName : 'Tag Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'tagValues', displayName : 'Values' }, + { field: 'description' }, + {field: 'userCreatedBy.userName', displayName : 'Created By' }, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editFWTag = null; + $scope.createNewFWTagWindow = function(){ + $scope.editFWTag = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwTag_popup.html', + controller: 'editFWTagListController', + resolve: { + message: function () { + var message = { + fwTagDictionaryDatas: $scope.editFWTag + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.fwTagDictionaryDatas=response.fwTagDictionaryDatas; + }); + }; + + $scope.editFWTagWindow = function(fwTagDictionaryDatas) { + $scope.editFWTag = fwTagDictionaryDatas; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwTag_popup.html', + controller: 'editFWTagListController', + resolve: { + message: function () { + var message = { + fwTagDictionaryDatas: $scope.editFWTag + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.fwTagDictionaryDatas = response.fwTagDictionaryDatas; + }); + }; + + $scope.deleteFWTag = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the tag: "+data.fwTagName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_tagList"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.fwTagDictionaryDatas=data.fwTagDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagPickerListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagPickerListDictGridController.js new file mode 100644 index 000000000..b34a7892a --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagPickerListDictGridController.js @@ -0,0 +1,155 @@ +/*- + * ============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========================================================= + */ +app.controller('tagPickerListDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_TagPickerListData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.fwTagPickerDictionaryDatas = JSON.parse($scope.data.fwTagPickerDictionaryDatas); + console.log($scope.fwTagPickerDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.tagPickerListDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.tagPickerListDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.tagPickerListDictionaryGrid = { + data : 'fwTagPickerDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'SearchCriteria.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWTagPickerWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWTagPickerWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWTagPicker(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'tagPickerName', displayName : 'Tag Picker Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'tagValues', displayName : 'Select Tags' }, + { field: 'description' }, + {field: 'userCreatedBy.userName', displayName : 'Created By' }, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterMenuPdf: false, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editFWTagPicker = null; + $scope.createNewFWTagPickerWindow = function(){ + $scope.editFWTagPicker = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwTagPicker_popup.html', + controller: 'editFWTagPickerController', + resolve: { + message: function () { + var message = { + fwTagPickerDictionaryDatas: $scope.editFWTagPicker + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.fwTagPickerDictionaryDatas=response.fwTagPickerDictionaryDatas; + }); + }; + + $scope.editFWTagPickerWindow = function(fwTagPickerDictionaryData) { + $scope.editFWTagPicker = fwTagPickerDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwTagPicker_popup.html', + controller: 'editFWTagPickerController', + resolve: { + message: function () { + var message = { + fwTagPickerDictionaryData: $scope.editFWTagPicker + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.fwTagPickerDictionaryDatas = response.fwTagPickerDictionaryDatas; + }); + }; + + $scope.deleteFWTagPicker = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the TagPicker: "+data.tagPickerName +". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_tagPicker"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.fwTagPickerDictionaryDatas=data.fwTagPickerDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js new file mode 100644 index 000000000..fa54db6d9 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js @@ -0,0 +1,173 @@ +/*- + * ============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========================================================= + */ +app.controller('termListDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_TermListData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.termListDictionaryDatas = JSON.parse($scope.data.termListDictionaryDatas); + console.log($scope.termListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('getDictionary/get_TagListData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.fwTagDictionaryDatasByName = JSON.parse($scope.data.fwTagDictionaryDatas); + console.log($scope.fwTagDictionaryDatasByName); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.termListDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.termListDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.termListDictionaryGrid = { + data : 'termListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'TermList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWTermListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWTermListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWTermList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'termName', displayName : 'Term-Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'termDescription', displayName : 'Term-Description' }, + { field: 'fromZone', displayName : 'From Zone' }, + {field: 'toZone', displayName : 'To Zone' }, + {field: 'srcIPList', displayName : 'Source-IP-List'}, + {field: 'destIPList',displayName : 'Destination-IP-List' }, + {field: 'srcPortList',displayName : 'Source-Port-List' }, + {field: 'destPortList',displayName : 'Destination-Port-List' }, + {field: 'action',displayName : 'Action List' }, + {field: 'userCreatedBy.userName',displayName : 'Created By' }, + {field: 'userModifiedBy.userName',displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editTermList = null; + $scope.createNewFWTermListWindow = function(){ + $scope.editTermList = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwTermList_popup.html', + controller: 'editFWTermListController', + resolve: { + message: function () { + var message = { + termListDictionaryDatas: $scope.editTermList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.termListDictionaryDatas=response.termListDictionaryDatas; + }); + }; + + $scope.editFWTermListWindow = function(termListDictionaryData) { + $scope.editTermList = termListDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_fwTermList_popup.html', + controller: 'editFWTermListController', + resolve: { + message: function () { + var message = { + termListDictionaryData: $scope.editTermList + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.termListDictionaryDatas = response.termListDictionaryDatas; + }); + }; + + $scope.deleteFWTermList = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the TermList "+data.termName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_termList"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.termListDictionaryDatas=data.termListDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWZoneDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWZoneDictGridController.js new file mode 100644 index 000000000..b10a9b820 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWZoneDictGridController.js @@ -0,0 +1,152 @@ +/*- + * ============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========================================================= + */ +app.controller('zoneDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_ZoneData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.zoneDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.zoneDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.zoneDictionaryGrid = { + data : 'zoneDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'Zone.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWZoneWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWZoneWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWZone(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'zoneName', displayName : 'Zone Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'zoneValue', displayName : 'Zone Value' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $scope.editZoneName = null; + $scope.createNewFWZoneWindow = function(){ + $scope.editZoneName = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWZone_popup.html', + controller: 'editFWZoneController', + resolve: { + message: function () { + var message = { + zoneDictionaryDatas: $scope.editZoneName + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.zoneDictionaryDatas=response.zoneDictionaryDatas; + }); + }; + + $scope.editFWZoneWindow = function(zoneDictionaryData) { + $scope.editZoneName = zoneDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_FWZone_popup.html', + controller: 'editFWZoneController', + resolve: { + message: function () { + var message = { + zoneDictionaryData: $scope.editZoneName + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.zoneDictionaryDatas = response.zoneDictionaryDatas; + }); + }; + + $scope.deleteFWZone = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Zone Name "+data.zoneName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/fw_dictionary/remove_zone"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.zoneDictionaryDatas=data.zoneDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js new file mode 100644 index 000000000..c9850e238 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js @@ -0,0 +1,127 @@ +/*- + * ============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========================================================= + */ +app.controller('msConfigNameDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_MicroServiceConfigNameData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.microServiceCongigNameDictionaryDatas = JSON.parse($scope.data.microServiceCongigNameDictionaryDatas); + console.log($scope.microServiceCongigNameDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.msConfigNameDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.msConfigNameDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.msConfigNameDictionaryGrid = { + data : 'microServiceCongigNameDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewMSConfigNameWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editMSConfigNameWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSConfigName(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'descriptionValue', displayName : 'Description' } + ] + }; + + $scope.editMSConfig = null; + $scope.createNewMSConfigNameWindow = function(){ + $scope.editMSConfig = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_msConfigName_popup.html', + controller: 'editMSConfigController', + resolve: { + message: function () { + var message = { + microServiceCongigNameDictionaryDatas: $scope.editMSConfig + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.microServiceCongigNameDictionaryDatas=response.microServiceCongigNameDictionaryDatas; + }); + }; + + $scope.editMSConfigNameWindow = function(microServiceCongigNameDictionaryData) { + $scope.editMSConfig = microServiceCongigNameDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_msConfigName_popup.html', + controller: 'editMSConfigController', + resolve: { + message: function () { + var message = { + microServiceCongigNameDictionaryData: $scope.editMSConfig + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.microServiceCongigNameDictionaryDatas = response.microServiceCongigNameDictionaryDatas; + }); + }; + + $scope.deleteMSConfigName = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Micro Service Config Name "+data.name+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ms_dictionary/remove_msConfigName"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.microServiceCongigNameDictionaryDatas=data.microServiceCongigNameDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSDcaeUUIDDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSDcaeUUIDDictGridController.js new file mode 100644 index 000000000..550505b91 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSDcaeUUIDDictGridController.js @@ -0,0 +1,128 @@ +/*- + * ============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========================================================= + */ +app.controller('msDCAEUUIDDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_DCAEUUIDData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.dcaeUUIDDictionaryDatas = JSON.parse($scope.data.dcaeUUIDDictionaryDatas); + console.log($scope.dcaeUUIDDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.dcaeUUIDDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.dcaeUUIDDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.dcaeUUIDDictionaryGrid = { + data : 'dcaeUUIDDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewMSDCAEUUIDWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editMSDCAEUUIDWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSDCAEUUID(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'description' } + ] + }; + + $scope.editDCAEuuid = null; + $scope.createNewMSDCAEUUIDWindow = function(){ + $scope.editDCAEuuid = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_DCAEuuid_popup.html', + controller: 'editDCAEuuidController', + resolve: { + message: function () { + var message = { + dcaeUUIDDictionaryDatas: $scope.editDCAEuuid + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.dcaeUUIDDictionaryDatas=response.dcaeUUIDDictionaryDatas; + }); + }; + + $scope.editMSDCAEUUIDWindow = function(dcaeUUIDDictionaryData) { + $scope.editDCAEuuid = dcaeUUIDDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_DCAEuuid_popup.html', + controller: 'editDCAEuuidController', + resolve: { + message: function () { + var message = { + dcaeUUIDDictionaryData: $scope.editDCAEuuid + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.dcaeUUIDDictionaryDatas = response.dcaeUUIDDictionaryDatas; + }); + }; + + $scope.deleteMSDCAEUUID = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the DCAE UUID : "+data.name+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ms_dictionary/remove_dcaeuuid"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.dcaeUUIDDictionaryDatas=data.dcaeUUIDDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSLocationDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSLocationDictGridController.js new file mode 100644 index 000000000..a2c447309 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSLocationDictGridController.js @@ -0,0 +1,128 @@ +/*- + * ============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========================================================= + */ +app.controller('msLocationDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_MicroServiceLocationData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.microServiceLocationDictionaryDatas = JSON.parse($scope.data.microServiceLocationDictionaryDatas); + console.log($scope.microServiceLocationDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.msLocationDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.msLocationDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.msLocationDictionaryGrid = { + data : 'microServiceLocationDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewMSLocationWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editMSLocationWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSLocation(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'descriptionValue', displayName : 'Description' } + ] + }; + + $scope.editMSLocation = null; + $scope.createNewMSLocationWindow = function(){ + $scope.editMSLocation = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_msLocation_popup.html', + controller: 'editMSLocationController', + resolve: { + message: function () { + var message = { + microServiceLocationDictionaryDatas: $scope.editMSLocation + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.microServiceLocationDictionaryDatas=response.microServiceLocationDictionaryDatas; + }); + }; + + $scope.editMSLocationWindow = function(microServiceLocationDictionaryData) { + $scope.editMSLocation = microServiceLocationDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_msLocation_popup.html', + controller: 'editMSLocationController', + resolve: { + message: function () { + var message = { + microServiceLocationDictionaryData: $scope.editMSLocation + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.microServiceLocationDictionaryDatas = response.microServiceLocationDictionaryDatas; + }); + }; + + $scope.deleteMSLocation = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Micro Service Location "+data.name+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ms_dictionary/remove_msLocation"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.microServiceLocationDictionaryDatas=data.microServiceLocationDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js new file mode 100644 index 000000000..a90b00a1e --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js @@ -0,0 +1,128 @@ +/*- + * ============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========================================================= + */ +app.controller('msModelsDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_MicroServiceModelsData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.microServiceModelsDictionaryDatas = JSON.parse($scope.data.microServiceModelsDictionaryDatas); + console.log($scope.microServiceModelsDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.msModelsDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.msModelsDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.msModelsDictionaryGrid = { + data : 'microServiceModelsDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewMSModelsWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSModels(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'modelName', displayName : 'Micro Service Model', sort: { direction: 'asc', priority: 0 }}, + { field: 'description' }, + { field: 'version', displayName : 'Model Version' }, + {field: 'userCreatedBy.userName', displayName : 'Imported By' } + ] + }; + $scope.editMSmodelName = null; + $scope.createNewMSModelsWindow = function(){ + $scope.editMSmodelName = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_msModel_popup.html', + controller: 'editMSModelController', + resolve: { + message: function () { + var message = { + microServiceModelsDictionaryDatas: $scope.editMSmodelName + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.microServiceModelsDictionaryDatas=response.microServiceModelsDictionaryDatas; + }); + }; + + $scope.editMSModelsWindow = function(microServiceModelsDictionaryData) { + $scope.editMSmodelName = microServiceModelsDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_msModel_popup.html', + controller: 'editMSModelController', + resolve: { + message: function () { + var message = { + microServiceModelsDictionaryData: $scope.editMSmodelName + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.microServiceModelsDictionaryDatas = response.microServiceModelsDictionaryDatas; + }); + }; + + $scope.deleteMSModels = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the MicroService Model : "+data.modelName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ms_dictionary/remove_msModel"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.microServiceModelsDictionaryDatas=data.microServiceModelsDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ModelAttributeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ModelAttributeDictGridController.js new file mode 100644 index 000000000..cb5cb89b8 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ModelAttributeDictGridController.js @@ -0,0 +1,138 @@ +/*- + * ============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========================================================= + */ +app.controller('modelAttributeDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_MicroServiceAttributeData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.microServiceAttributeDictionaryDatas = JSON.parse($scope.data.microServiceAttributeDictionaryDatas); + console.log($scope.microServiceAttributeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('getDictionary/get_MicroServiceModelsDataByName').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.microServiceModelsDictionaryDatas = JSON.parse($scope.data.microServiceModelsDictionaryDatas); + console.log($scope.microServiceModelsDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.modelAttributeDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.modelAttributeDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.modelAttributeDictionaryGrid = { + data : 'microServiceAttributeDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewModelAttributeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editModelAttributeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteModelAttribute(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName :'Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'value'}, {field: 'modelName' , displayName :'MicroService' } + ] + }; + + $scope.editModelAttribute = null; + $scope.createNewModelAttributeWindow = function(){ + $scope.editModelAttribute = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_modelAttribute_popup.html', + controller: 'editModelAttributeController', + resolve: { + message: function () { + var message = { + microServiceAttributeDictionaryDatas: $scope.editModelAttribute + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.microServiceAttributeDictionaryDatas=response.microServiceAttributeDictionaryDatas; + }); + }; + + $scope.editModelAttributeWindow = function(modelAttributeDictionaryData) { + $scope.editModelAttribute = modelAttributeDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_modelAttribute_popup.html', + controller: 'editModelAttributeController', + resolve: { + message: function () { + var message = { + modelAttributeDictionaryData: $scope.editModelAttribute + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.microServiceAttributeDictionaryDatas = response.microServiceAttributeDictionaryDatas; + }); + }; + + $scope.deleteModelAttribute = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Model Attribute : "+data.name+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ms_dictionary/remove_modelAttribute"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.microServiceAttributeDictionaryDatas=data.microServiceAttributeDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSClosedLoopDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSClosedLoopDictGridController.js new file mode 100644 index 000000000..3a8370b72 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSClosedLoopDictGridController.js @@ -0,0 +1,127 @@ +/*- + * ============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========================================================= + */ +app.controller('psClosedLoopDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_PSClosedLoopData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.psClosedLoopDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.psClosedLoopDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.psClosedLoopDictionaryGrid = { + data : 'psClosedLoopDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewPSClosedLoopWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPSClosedLoopWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePSClosedLoop(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Closed Loop Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'descriptionValue' , displayName : 'Description'} + ] + }; + + $scope.editPSClosedLoop = null; + $scope.createNewPSClosedLoopWindow = function(){ + $scope.editPSClosedLoop = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PSClosedLoop_popup.html', + controller: 'editPSClosedLoopController', + resolve: { + message: function () { + var message = { + psClosedLoopDictionaryDatas: $scope.editPSClosedLoop + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.psClosedLoopDictionaryDatas=response.psClosedLoopDictionaryDatas; + }); + }; + + $scope.editPSClosedLoopWindow = function(psClosedLoopDictionaryData) { + $scope.editPSClosedLoop = psClosedLoopDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PSClosedLoop_popup.html', + controller: 'editPSClosedLoopController', + resolve: { + message: function () { + var message = { + psClosedLoopDictionaryData: $scope.editPSClosedLoop + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.psClosedLoopDictionaryDatas = response.psClosedLoopDictionaryDatas; + }); + }; + + $scope.deletePSClosedLoop = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Closed Loop "+data.name+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ps_dictionary/remove_PSClosedLoop"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.psClosedLoopDictionaryDatas=data.psClosedLoopDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSGroupPolicyScopeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSGroupPolicyScopeDictGridController.js new file mode 100644 index 000000000..a331bfa83 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSGroupPolicyScopeDictGridController.js @@ -0,0 +1,131 @@ +/*- + * ============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========================================================= + */ +app.controller('psGroupPolicyScopeDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_GroupPolicyScopeData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.groupPolicyScopeListDatas = JSON.parse($scope.data.groupPolicyScopeListDatas); + console.log($scope.groupPolicyScopeListDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.psGroupPolicyScopeDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.psGroupPolicyScopeDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.psGroupPolicyScopeDictionaryGrid = { + data : 'groupPolicyScopeListDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewGroupPolicyScopeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editGroupPolicyScopeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteGroupPolicyScope(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'groupName', displayName : 'Policy Scope Group Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'groupList', displayName : 'Policy Scope List'} + ], + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + $scope.gridApi.core.refresh(); + } + }; + + $scope.editPSGroupPolicyScope = null; + $scope.createNewGroupPolicyScopeWindow = function(){ + $scope.editPSGroupPolicyScope = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PSGroupPolicyScope_popup.html', + controller: 'editPSGroupPolicyScopeController', + resolve: { + message: function () { + var message = { + groupPolicyScopeListDatas: $scope.editPSGroupPolicyScope + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.groupPolicyScopeListDatas=response.groupPolicyScopeListDatas; + }); + }; + + $scope.editGroupPolicyScopeWindow = function(groupPolicyScopeListData) { + $scope.editPSGroupPolicyScope = groupPolicyScopeListData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PSGroupPolicyScope_popup.html', + controller: 'editPSGroupPolicyScopeController', + resolve: { + message: function () { + var message = { + groupPolicyScopeListData: $scope.editPSGroupPolicyScope + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.groupPolicyScopeListDatas = response.groupPolicyScopeListDatas; + }); + }; + + $scope.deleteGroupPolicyScope = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Group Policy Scope "+data.name+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ps_dictionary/remove_GroupPolicyScope"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.groupPolicyScopeListDatas=data.groupPolicyScopeListDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSResourceDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSResourceDictGridController.js new file mode 100644 index 000000000..9c0159446 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSResourceDictGridController.js @@ -0,0 +1,127 @@ +/*- + * ============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========================================================= + */ +app.controller('psResourceDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_PSResourceData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.psResourceDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.psResourceDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.psResourceDictionaryGrid = { + data : 'psResourceDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewPSResourceWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPSResourceWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePSResource(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Resource Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'descriptionValue' } + ] + }; + + $scope.editPSResource = null; + $scope.createNewPSResourceWindow = function(){ + $scope.editPSResource = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PSResource_popup.html', + controller: 'editPSResourceController', + resolve: { + message: function () { + var message = { + psResourceDictionaryDatas: $scope.editPSResource + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.psResourceDictionaryDatas=response.psResourceDictionaryDatas; + }); + }; + + $scope.editPSResourceWindow = function(psResourceDictionaryData) { + $scope.editPSResource = psResourceDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PSResource_popup.html', + controller: 'editPSResourceController', + resolve: { + message: function () { + var message = { + psResourceDictionaryData: $scope.editPSResource + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.psResourceDictionaryDatas = response.psResourceDictionaryDatas; + }); + }; + + $scope.deletePSResource = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Resource "+data.name+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ps_dictionary/remove_PSResource"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.psResourceDictionaryDatas=data.psResourceDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSServiceDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSServiceDictGridController.js new file mode 100644 index 000000000..d516e1e64 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSServiceDictGridController.js @@ -0,0 +1,127 @@ +/*- + * ============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========================================================= + */ +app.controller('psServiceDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_PSServiceData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.psServiceDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.psServiceDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.psServiceDictionaryGrid = { + data : 'psServiceDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewPSServiceWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPSServiceWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePSService(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Service Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'descriptionValue' } + ] + }; + + $scope.editPSService = null; + $scope.createNewPSServiceWindow = function(){ + $scope.editPSService = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PSService_popup.html', + controller: 'editPSServiceController', + resolve: { + message: function () { + var message = { + psServiceDictionaryDatas: $scope.editPSService + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.psServiceDictionaryDatas=response.psServiceDictionaryDatas; + }); + }; + + $scope.editPSServiceWindow = function(psServiceDictionaryData) { + $scope.editPSService = psServiceDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PSService_popup.html', + controller: 'editPSServiceController', + resolve: { + message: function () { + var message = { + psServiceDictionaryData: $scope.editPSService + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.psServiceDictionaryDatas = response.psServiceDictionaryDatas; + }); + }; + + $scope.deletePSService = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Port List "+data.name+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ps_dictionary/remove_PSService"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.psServiceDictionaryDatas=data.psServiceDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSTypeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSTypeDictGridController.js new file mode 100644 index 000000000..465db4af7 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSTypeDictGridController.js @@ -0,0 +1,127 @@ +/*- + * ============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========================================================= + */ +app.controller('psTypeDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_PSTypeData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.psTypeDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.psTypeDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.psTypeDictionaryGrid = { + data : 'psTypeDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createPSTypeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPSTypeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePSType(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Type Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'descriptionValue' } + ] + }; + + $scope.editPSType = null; + $scope.createPSTypeWindow = function(){ + $scope.editPSType = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PSType_popup.html', + controller: 'editPSTypeController', + resolve: { + message: function () { + var message = { + psTypeDictionaryDatas: $scope.editPSType + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.psTypeDictionaryDatas=response.psTypeDictionaryDatas; + }); + }; + + $scope.editPSTypeWindow = function(psTypeDictionaryData) { + $scope.editPSType = psTypeDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_PSType_popup.html', + controller: 'editPSTypeController', + resolve: { + message: function () { + var message = { + psTypeDictionaryData: $scope.editPSType + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.psTypeDictionaryDatas = response.psTypeDictionaryDatas; + }); + }; + + $scope.deletePSType = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Type "+data.name+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ps_dictionary/remove_PSType"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.psTypeDictionaryDatas=data.psTypeDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js new file mode 100644 index 000000000..0e119ba2d --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js @@ -0,0 +1,157 @@ +/*- + * ============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========================================================= + */ +app.controller('riskTypeDictGridController', function ($scope, PolicyAppService, modalService, $modal, uiGridConstants,Grid){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_RiskTypeData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.riskTypeDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.riskTypeDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.riskTypeDictionaryGrid = { + data : 'riskTypeDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'RiskType.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewRiskType()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editRiskTypeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteRiskType(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'riskName', displayName : 'Risk Type Name', sort: { direction: 'asc', priority: 0 } }, + { field: 'description', width: '20%' }, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'userModifiedBy.userName', displayName : 'Modified By' }, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\''}, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\''} + ], + enableColumnResize : true, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + + $scope.editRiskType = null; + $scope.createNewRiskType = function(){ + $scope.editRiskType = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_riskType_popup.html', + controller: 'editRiskTypeController', + resolve: { + message: function () { + var message = { + riskTypeDictionaryDatas: $scope.editRiskType + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.riskTypeDictionaryDatas=response.riskTypeDictionaryDatas; + }); + }; + + $scope.editRiskTypeWindow = function(riskTypeDictionaryData) { + $scope.editRiskType = riskTypeDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_riskType_popup.html', + controller: 'editRiskTypeController', + resolve: { + message: function () { + var message = { + riskTypeDictionaryData: $scope.editRiskType + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.riskTypeDictionaryDatas = response.riskTypeDictionaryData; + }); + }; + + $scope.deleteRiskType = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Ecomp Name "+data.riskType+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/sp_dictionary/remove_riskType"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.riskTypeDictionaryDatas=data.riskTypeDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/SafePolicyWarningDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/SafePolicyWarningDictGridController.js new file mode 100644 index 000000000..d24610591 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/SafePolicyWarningDictGridController.js @@ -0,0 +1,131 @@ +/*- + * ============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========================================================= + */ +app.controller('safePolicyWarningDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_SafePolicyWarningData').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"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.safePolicyWarningDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.safePolicyWarningDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.safePolicyWarningDictionaryGrid = { + data : 'safePolicyWarningDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewSafePolicyWarningWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editSafePolicyWarningWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteSafePolicyWarning(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Safe Policy Warning Name', sort: { direction: 'asc', priority: 0 }}, + { field: 'riskType', displayName : 'Risk Type'},{ field: 'message', displayName : 'Message'} + ], + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + $scope.gridApi.core.refresh(); + } + }; + + $scope.editSafePolicyWarning = null; + $scope.createNewSafePolicyWarningWindow = function(){ + $scope.editSafePolicyWarning = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_SafePolicyWarning_popup.html', + controller: 'editSafePolicyWarningController', + resolve: { + message: function () { + var message = { + safePolicyWarningDatas: $scope.editSafePolicyWarningScope + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.safePolicyWarningDatas=response.safePolicyWarningDatas; + }); + }; + + $scope.editSafePolicyWarningWindow = function(safePolicyWarningData) { + $scope.editSafePolicyWarning = safePolicyWarningData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_SafePolicyWarning_popup.html', + controller: 'editSafePolicyWarningController', + resolve: { + message: function () { + var message = { + safePolicyWarningData: $scope.editSafePolicyWarning + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.groupPolicyScopeListDatas = response.safePolicyWarningData; + }); + }; + + $scope.deleteSafePolicyWarning = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Safe Policy Warning "+data.name+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/sp_dictionary/remove_SafePolicyWarning"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.safePolicyWarningDatas=data.safePolicyWarningDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js new file mode 100644 index 000000000..e828bd963 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js @@ -0,0 +1,167 @@ +/*- + * ============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 Actiontype = ["REST"]; +app.controller('actionPolicyDictGridController', function ($scope,modalService, $modal, uiGridConstants,Grid, PolicyAppService){ + $( "#dialog" ).hide(); + $scope.type = Actiontype; + + PolicyAppService.getData('getDictionary/get_ActionPolicyDictData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.actionPolicyDictionaryDatas = JSON.parse($scope.data.actionPolicyDictionaryDatas); + console.log($scope.actionPolicyDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.actionPolicyDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.actionPolicyDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.actionPolicyDictionaryGrid = { + enableFiltering: true, + data: 'actionPolicyDictionaryDatas', + exporterCsvFilename: 'ActionPolicyDictionary.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', + enableFiltering: false, + headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewActionPolicyDictWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editActionPolicyDictWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteActionPolicyDict(row.entity)" ><i class="fa fa-trash-o"></i></button> ', + width: '8%' + }, + {field: 'attributeName', displayName: 'Attribute Name', sort: { direction: 'asc', priority: 0 }}, + {field: 'type'}, + {field: 'url'}, + {field: 'method'}, + {field: 'header', displayName: 'Headers'}, + {field: 'description'}, + {field: 'userCreatedBy.userName', displayName: 'Created By'}, + {field: 'userModifiedBy.userName', displayName: 'Modified By'}, + {field: 'createdDate', type: 'date', cellFilter: 'date:\'yyyy-MM-dd\''}, + {field: 'modifiedDate', type: 'date', cellFilter: 'date:\'yyyy-MM-dd\''} + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + + $scope.editActionPolicyName = null; + $scope.createNewActionPolicyDictWindow = function () { + $scope.editActionPolicyName = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'add_actionPolicyDict_popup.html', + controller: 'editActionPolicyDictController', + resolve: { + message: function () { + var message = { + actionPolicyDictionaryDatas: $scope.editActionPolicyName + }; + return message; + } + } + }); + modalInstance.result.then(function (response) { + console.log('response', response); + $scope.actionPolicyDictionaryDatas = response.actionPolicyDictionaryDatas; + }); + }; + + $scope.editActionPolicyDictWindow = function (actionPolicyDictionaryData) { + $scope.editActionPolicyName = actionPolicyDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'add_actionPolicyDict_popup.html', + controller: 'editActionPolicyDictController', + resolve: { + message: function () { + var message = { + actionPolicyDictionaryData: $scope.editActionPolicyName + }; + return message; + } + } + }); + modalInstance.result.then(function (response) { + console.log('response', response); + $scope.actionPolicyDictionaryDatas = response.actionPolicyDictionaryDatas; + }); + }; + + $scope.deleteActionPolicyDict = function (data) { + modalService.popupConfirmWin("Confirm", "You are about to delete the Action Policy Dictionary Item " + data.attributeName + ". Do you want to continue?", + function () { + var uuu = "deleteDictionary/action_dictionary/remove_actionPolicyDict"; + var postData = {data: data}; + $.ajax({ + type: 'POST', + url: uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success: function (data) { + $scope.$apply(function () { + $scope.actionPolicyDictionaryDatas = data.actionPolicyDictionaryDatas; + }); + }, + error: function (data) { + console.log(data); + modalService.showFailure("Fail", "Error while deleting: " + data.responseText); + } + }); + + }) + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js new file mode 100644 index 000000000..d7b4c2b01 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js @@ -0,0 +1,199 @@ +/*- + * ============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========================================================= + */ +app.controller('attributeDictGridController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_AttributeData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.attributeDictionaryDatas = JSON.parse($scope.data.attributeDictionaryDatas); + console.log($scope.attributeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + + $scope.exportData = function () { + var blob = new Blob([document.getElementById('attributeTable').innerHTML], { + type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8" + }); + saveAs(blob, "Attribute.xls"); + }; + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.attributeDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.attributeDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.attributeDictionaryGrid = { + data : 'attributeDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'Attribute.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id' , enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewAttributeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editAttributeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteAttribute(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'xacmlId', displayName : 'Attribute ID', sort: { direction: 'asc', priority: 0 }}, + { field: 'datatypeBean.shortName', displayName : 'Data Type' }, + { field: 'attributeValue'}, + { field: 'description' }, + { field: 'priority' , displayName : 'Priority'}, + {field: 'userCreatedBy.userName', displayName : 'Created By' }, + {field: 'userModifiedBy.userName', displayName : 'Modified By'}, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' } + ], + exporterMenuPdf: false, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + + $scope.editAttributeName = null; + $scope.createNewAttributeWindow = function(){ + $scope.editAttributeName = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_Attribute_popup.html', + controller: 'editAttributeController', + resolve: { + message: function () { + var message = { + attributeDictionaryDatas: $scope.editAttributeName + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.attributeDictionaryDatas=response.attributeDictionaryDatas; + }); + }; + + $scope.editAttributeWindow = function(attributeDictionaryData) { + $scope.editAttributeName = attributeDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_Attribute_popup.html', + controller: 'editAttributeController', + resolve: { + message: function () { + var message = { + attributeDictionaryData: $scope.editAttributeName + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.attributeDictionaryDatas = response.attributeDictionaryDatas; + }); + }; + + $scope.deleteAttribute = function(data) { + var uuu = "searchDictionary"; + var postData={data: data, type: "attribute"}; + var searchString = "\n"; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(resultList){ + $scope.$apply(function(){ + $scope.list =resultList.result;}); + $scope.searchData = JSON.stringify(resultList.result); + $scope.searchDatas = JSON.parse($scope.searchData); + $scope.success = true; + var i; + if($scope.searchDatas.length > 0){ + for(i = 0 ; i < $scope.searchDatas.length; i++){ + searchString += $scope.searchDatas[i].name + "\n"; + } + }else{ + searchString += "No Policies is Using this Value" + } + + console.log($scope.list); + if($scope.success){ + modalService.popupConfirmWin("Confirm","You are about to delete the Attribute Dictionary : "+data.xacmlId+". \n "+searchString+" \n Do you want to continue?", + function(){ + var uuu = "deleteDictionary/attribute_dictionary/remove_attribute"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.attributeDictionaryDatas=data.attributeDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + })} + }, + error : function(data){ + alert("Error while Searching."); + } + }); + }; + + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js new file mode 100644 index 000000000..1c356ec19 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js @@ -0,0 +1,158 @@ +/*- + * ============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========================================================= + */ +app.controller('ecompNameDictGridController', function ($scope, PolicyAppService, modalService, $modal, uiGridConstants,Grid){ + $( "#dialog" ).hide(); + + PolicyAppService.getData('getDictionary/get_EcompNameData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.ecompNameDictionaryDatas = JSON.parse($scope.data.ecompNameDictionaryDatas); + console.log($scope.ecompNameDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.ecompNameDictionaryGrid.columnDefs[0].visible = false; + $scope.gridApi.grid.refresh(); + }else{ + $scope.ecompNameDictionaryGrid.columnDefs[0].visible = true; + $scope.gridApi.grid.refresh(); + } + },function(error){ + console.log("failed"); + }); + + $scope.ecompNameDictionaryGrid = { + data : 'ecompNameDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'EcompName.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewEcompName()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editEcompNameWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteEcompName(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'ecompName', displayName : 'Ecomp Name', sort: { direction: 'asc', priority: 0 } }, + { field: 'description', width: '20%' }, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'userModifiedBy.userName', displayName : 'Modified By' }, + {field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\''}, + {field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\''} + ], + exporterMenuPdf: false, + enableColumnResize : true, + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + + $scope.editEcompName = null; + $scope.createNewEcompName = function(){ + $scope.editEcompName = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_ecompName_popup.html', + controller: 'editEcompNameController', + resolve: { + message: function () { + var message = { + ecompNameDictionaryDatas: $scope.editEcompName + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.ecompNameDictionaryDatas=response.ecompNameDictionaryDatas; + }); + }; + + $scope.editEcompNameWindow = function(ecompNameDictionaryData) { + $scope.editEcompName = ecompNameDictionaryData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_ecompName_popup.html', + controller: 'editEcompNameController', + resolve: { + message: function () { + var message = { + ecompNameDictionaryData: $scope.editEcompName + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.ecompNameDictionaryDatas = response.ecompNameDictionaryDatas; + }); + }; + + $scope.deleteEcompName = function(data) { + modalService.popupConfirmWin("Confirm","You are about to delete the Ecomp Name "+data.ecompName+". Do you want to continue?", + function(){ + var uuu = "deleteDictionary/ecomp_dictionary/remove_ecomp"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.ecompNameDictionaryDatas=data.ecompNameDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpController.js new file mode 100644 index 000000000..0135172e9 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpController.js @@ -0,0 +1,177 @@ +/*- + * ============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========================================================= + */ +app.controller('pdpTabController', function ($scope, PolicyAppService, modalService, $modal){ + $( "#dialog" ).hide(); + + $scope.isDisabled = true; + $scope.createPdpGroupId = false; + $scope.deletePdpGroupId = false; + $scope.editPdpGroupId = false; + $scope.pdpdatas = []; + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.isDisabled = true; + }else{ + $scope.isDisabled = false; + } + console.log($scope.data); + + PolicyAppService.getData('get_UserRolesData').then(function(data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.userRolesDatas = JSON.parse($scope.data.userRolesDatas); + console.log($scope.userRolesDatas); + if($scope.isDisabled == false){ + if($scope.userRolesDatas[0] == 'super-admin' || $scope.userRolesDatas[0] == 'admin'){ + $scope.createPdpGroupId = true; + $scope.deletePdpGroupId = true; + $scope.editPdpGroupId = true; + }else if($scope.userRolesDatas[0] == 'super-editor' || $scope.userRolesDatas[0] == 'editor'){ + $scope.editPdpGroupId = true; + }else if($scope.userRolesDatas[0] == 'super-guest' || $scope.userRolesDatas[0] == 'guest'){ + $scope.editPdpGroupId = true; + } + } + + PolicyAppService.getData('get_PDPGroupData').then(function(data){ + var j = data; + $scope.pdpdatas = JSON.parse(j.data); + console.log($scope.pdpdatas); + },function(error){ + console.log("failed"); + }); + },function (error) { + console.log("failed"); + }); + },function(error){ + console.log("failed"); + }); + + + $scope.addNewPDPGroupFunctionPopup = function() { + $scope.editPDPGroup = null; + $( "#dialog" ).dialog({ + modal: true + }); + }; + + $scope.editPDPGroup = null; + var dialog = null; + $scope.editPDPGroupFunctionPopup = function(pdpGroupData) { + $scope.editPDPGroup = pdpGroupData; + $( "#dialog" ).dialog({ + modal: true + }); + }; + + $scope.editPDPGroupFunctionModalPopup = function(pdpGroupData) { + $scope.editPDPGroup = pdpGroupData; + if($scope.userRolesDatas[0] == 'super-guest' || $scope.userRolesDatas[0] == 'guest'){ + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'show_policies_pdp_group_popup.html', + controller: 'editPDPGrouppopupController', + resolve: { + message: function () { + var message = { + pdpGroupData : $scope.editPDPGroup + }; + return message; + } + } + }); + }else{ + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'edit_pdp_group_popup.html', + controller: 'editPDPGrouppopupController', + resolve: { + message: function () { + var message = { + pdpGroupData : $scope.editPDPGroup + }; + return message; + } + } + }); + } + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.pdpdatas=response.data; + }); + }; + + $scope.addNewPDPGroupPopUpWindow = function(editPDPGroup) { + $scope.editPDPGroup = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_pdp_group_popup.html', + controller: 'editPDPGrouppopupController', + resolve: { + message: function () { + var message = { + data: $scope.editPDPGroup + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.pdpdatas=JSON.parse(response.data); + }); + }; + + $scope.addNewPDPGroupFunctionPopup = function() { + $scope.editPDPGroup = null; + $( "#dialog" ).dialog({ + modal: true + }); + }; + + $scope.removePDPGroup = function(pdpGroupData) { + modalService.popupConfirmWin("Confirm","You are about to delete the PDP Group "+pdpGroupData.name+". Do you want to continue?", + function(){ + var uuu = "pdp_Group/remove_pdp_group.htm"; + var postData={pdpGroupData: pdpGroupData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.pdpdata=data.data;}); + $scope.pdpdatas=JSON.parse(data.data); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + + }; +}); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js new file mode 100644 index 000000000..e1079379e --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js @@ -0,0 +1,178 @@ +/*- + * ============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========================================================= + */ +app.controller('editPDPGrouppopupController' , function ($scope, $modalInstance, message, modalService, $modal, Notification){ + if(message.pdpGroupData==null) + $scope.label='Add New PDP Group' + else{ + $scope.label='Edit PDP Group' + $scope.disableCd=true; + $scope.policies = message.pdpGroupData.policies; + $scope.pdps = message.pdpGroupData.pdps; + $scope.selectedPdp = message.pdpGroupData; + } + $scope.editPDPGroup = message.pdpGroupData; + + $scope.policiesGrid = { + data : 'policies', + enableFiltering: true, + columnDefs: [ + { field: 'root', displayName : 'Root', width : '10%'}, + { field: 'name', displayName : 'Name' }, + { field: 'version' , width : '10%'}, + { field: 'id' } + ] + }; + + $scope.pdpsGrid = { + data : 'pdps', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewPDPInGroup()" class="btn btn-success">' + 'Create PDP</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPDPInGroup(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePDPFromGroup(row.entity)" ><i class="fa fa-trash-o"></i></button> '+ + '<button type="button" class="btn btn-success" ng-click="grid.appScope.statusOfPDP(row.entity.status)" >Status</button>', width: '25%' + }, + { field: 'id', displayName : 'PDP URL'}, + { field: 'jmxPort', displayName : 'JMX Port' , width : '10%' }, + { field: 'name' , displayName : 'PDP Name'}, + { field: 'description' } + ] + }; + + $scope.createNewPDPInGroup = function(pdpInGroup) { + $scope.pdpInGroup = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'create_newPDP_InGroup.html', + controller: 'pdpInGroupController', + resolve: { + message: function () { + var message = { + data: $scope.pdpInGroup, + activePDP : $scope.selectedPdp + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.data=response.data; + }); + }; + + $scope.editPDPInGroup = function(pdpInGroup) { + $scope.editPDPInGroupData = pdpInGroup; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'create_newPDP_InGroup.html', + controller: 'pdpInGroupController', + resolve: { + message: function () { + var message = { + pdpInGroup : $scope.editPDPInGroupData, + activePDP : $scope.selectedPdp + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.data=response.data; + }); + }; + + $scope.deletePDPFromGroup = function(data){ + modalService.popupConfirmWin("Confirm","You are about to delete the PDP Group : "+data.name+". Do you want to continue?", + function(){ + var uuu = "pdp_Group/remove_pdpFromGroup.htm"; + var postData={data: data, + activePDP : $scope.selectedPdp}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.data=data.data;}); + Notification.success("PDP Group Deleted Successfully"); + }, + error : function(data){ + console.log(data); + Notification.error("Error Occured While Deleting a PDP Group") + //modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + + $scope.statusOfPDP = function(status){ + $scope.pdpStatus = status; + console.log($scope.pdpStatus); + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'pdpGroupStatusWindow.html', + controller: 'pdpGroupStatusController', + resolve: { + message: function () { + var message = { + status : $scope.pdpStatus, + policies : $scope.policies + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.data=response.data; + }); + }; + + $scope.savePDPGroup = function(pdpGroupData) { + var uuu = "pdp_Group/save_pdp_group.htm"; + var postData={pdpGroupData: pdpGroupData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.data=data.data;}); + console.log($scope.data); + $modalInstance.close({data:$scope.data}); + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/policyAdminTabController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/policyAdminTabController.js new file mode 100644 index 000000000..483bdcaf4 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/policyAdminTabController.js @@ -0,0 +1,66 @@ +/*- + * ============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========================================================= + */ +app.controller("policyAdminController", function($scope, PolicyAppService, modalService, $modal, Notification){ + $( "#dialog" ).hide(); + + $scope.isDisabled = true; + PolicyAppService.getData('get_LockDownData').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.isDisabled = true; + }else{ + $scope.isDisabled = false; + } + console.log($scope.data); + },function(error){ + console.log("failed"); + }); + + $scope.saveLockDownValue = function(lockdownValue){ + console.log(lockdownValue); + if(lockdownValue == true){ + Notification.success("Policy Application has been Locked Successfully"); + $scope.isDisabled = true; + }else{ + Notification.success("Policy Application has been UnLocked Successfully"); + $scope.isDisabled = false; + } + var uuu = "adminTabController/save_LockDownValue.htm"; + var postData={lockdowndata: {lockdown : lockdownValue}}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.data=data.data; + }); + console.log($scope.data); + }, + error : function(data){ + alert("Error Occured while saving Lockdown Value."); + } + }); + }; +});
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/policyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/policyController.js new file mode 100644 index 000000000..ec6a56c05 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/policyController.js @@ -0,0 +1,65 @@ +/*- + * ============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========================================================= + */ +angular.module('abs').requires.push('ui.grid','ui.grid.pagination','ui.grid.selection', 'ui.grid.exporter', 'ui.grid.edit', 'ui.grid.autoResize', + 'ui.grid.resizeColumns','ngRoute', 'pascalprecht.translate', 'ngCookies', 'ui-notification', 'ui.grid.treeView'); +app.config(function($routeProvider) { + $routeProvider + .when('/Editor', { + templateUrl:'app/policyApp/policy-models/Editor/templates/policyEditor.html', + controller : "PolicyManagerController" + }) + .when('/Dictionary', { + templateUrl: 'app/policyApp/policy-models/policy_Dictionary.html', + controller : "dictionaryTabController" + }) + .when('/Pdp', { + templateUrl: 'app/policyApp/policy-models/policy_PDPManagement.html', + controller : "pdpTabController" + }) + .when('/Push', { + templateUrl: 'app/policyApp/policy-models/policy_AutoPush.html', + controller : "policyPushController" + }) + .when('/Admin', { + templateUrl: 'app/policyApp/policy-models/policy_AdminTab.html', + controller : "policyAdminController" + }) + .when('/Roles', { + templateUrl: 'app/policyApp/policy-models/policy_Roles.html', + controller : "policyRolesController" + }) + .when('/Dashboard', { + templateUrl: 'app/policyApp/policy-models/policy_DashboardLogging.html', + controller : "policyDashboardController" + }) + .when('/Dashboard_Health', { + templateUrl: 'app/policyApp/policy-models/policy_DashboardHealth.html', + controller : "policyDashboardHealthController" + }) + .when('/policy_SearchFilter', { + templateUrl: 'app/policyApp/policy-models/policy_SearchFilter.html', + controller : "PolicyManagerController" + }) + .otherwise({ + templateUrl:'app/policyApp/policy-models/Editor/templates/policyEditor.html', + controller : "PolicyManagerController" + }); + +});
\ No newline at end of file |