From e0addf5b588a1244f9679becd90999dfcb4c3a94 Mon Sep 17 00:00:00 2001 From: "ITSERVICES\\rb7147" Date: Tue, 25 Apr 2017 11:46:00 -0400 Subject: Policy 1707 commit to LF Change-Id: Ibe6f01d92f9a434c040abb05d5386e89d675ae65 Signed-off-by: ITSERVICES\rb7147 --- .../BRMSControllerDictGridController.js | 183 +++++++++++++++++++ .../BRMSDependencyDictGridController.js | 182 +++++++++++++++++++ .../BRMSParamDictGridController.js | 163 +++++++++++++++++ .../CLPepOptionsDictGridController.js | 189 +++++++++++++++++++ .../CLServiceDictGridController.js | 165 +++++++++++++++++ .../CLSiteDictGridController.js | 165 +++++++++++++++++ .../CLVarbindDictGridController.js | 189 +++++++++++++++++++ .../CLVnfTypeDictGridController.js | 186 +++++++++++++++++++ .../CLVsclActionDictGridController.js | 188 +++++++++++++++++++ .../DecisionSettingsDictGridController.js | 157 ++++++++++++++++ .../DescriptiveScopeDictGridController.js | 155 ++++++++++++++++ .../EnforcerTypeDictGridController.js | 114 ++++++++++++ .../FWActionListDictGridController.js | 150 ++++++++++++++++ .../FWAddressGroupDictGridController.js | 153 ++++++++++++++++ .../FWParentListDictGridController.js | 153 ++++++++++++++++ .../FWPortListDictGridController.js | 127 +++++++++++++ .../FWPrefixListDictGridController.js | 153 ++++++++++++++++ .../FWProtocolListDictGridController.js | 153 ++++++++++++++++ .../FWSecurityZoneDictGridController.js | 151 ++++++++++++++++ .../FWServiceGroupDictGridController.js | 151 ++++++++++++++++ .../FWServiceListDictGridController.js | 165 +++++++++++++++++ .../FWTagListDictGridController.js | 157 ++++++++++++++++ .../FWTagPickerListDictGridController.js | 155 ++++++++++++++++ .../FWTermListDictGridController.js | 173 ++++++++++++++++++ .../FWZoneDictGridController.js | 152 ++++++++++++++++ .../MSConfigNameDictGridController.js | 127 +++++++++++++ .../MSDcaeUUIDDictGridController.js | 128 +++++++++++++ .../MSLocationDictGridController.js | 128 +++++++++++++ .../MSModelDictGridController.js | 128 +++++++++++++ .../ModelAttributeDictGridController.js | 138 ++++++++++++++ .../PSClosedLoopDictGridController.js | 127 +++++++++++++ .../PSGroupPolicyScopeDictGridController.js | 131 ++++++++++++++ .../PSResourceDictGridController.js | 127 +++++++++++++ .../PSServiceDictGridController.js | 127 +++++++++++++ .../PSTypeDictGridController.js | 127 +++++++++++++ .../RiskTypeDictGridController.js | 157 ++++++++++++++++ .../SafePolicyWarningDictGridController.js | 131 ++++++++++++++ .../actionPolicyDictGridController.js | 167 +++++++++++++++++ .../attributeDictGridController.js | 199 +++++++++++++++++++++ .../ecompNameDictGridController.js | 158 ++++++++++++++++ 40 files changed, 6129 insertions(+) create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/EnforcerTypeDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWActionListDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWAddressGroupDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPortListDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPrefixListDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWProtocolListDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWSecurityZoneDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceGroupDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceListDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagListDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagPickerListDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWZoneDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSDcaeUUIDDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSLocationDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ModelAttributeDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSClosedLoopDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSGroupPolicyScopeDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSResourceDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSServiceDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSTypeDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/SafePolicyWarningDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js (limited to 'POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController') 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: '' + + '', + cellTemplate: + ' ' + + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: ' ' + + ' ', + 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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: '' + + '', + cellTemplate: + ' ' + + ' ', 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 -- cgit 1.2.3-korg