diff options
Diffstat (limited to 'ecomp-sdk-app/src/main/webapp/app/policyApp/controller')
86 files changed, 10316 insertions, 0 deletions
diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/AutoPushController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/AutoPushController.js new file mode 100644 index 000000000..c6a6e3587 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/AutoPushController.js @@ -0,0 +1,201 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +app.controller('policyPushController', function ($scope, PDPService, AdminTabService, AutoPushService, modalService, $modal, Notification,$filter){ + $( "#dialog" ).hide(); + + $scope.isDisabled = true; + $scope.loading = true; + + AdminTabService.getData().then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.isDisabled = true; + }else{ + $scope.isDisabled = false; + } + console.log($scope.data); + },function(error){ + console.log("failed"); + }); + + $scope.pdpdata; + PDPService.getPDPData().then(function (data) { + var j = data; + $scope.pdpdata = JSON.parse(j.data); + console.log($scope.pdpdata); + $scope.pushTabPDPGrid.data = $scope.pdpdata; + }, function (error) { + console.log("failed"); + }); + + $scope.getPDPData = function(){ + $scope.pushTabPDPGrid.data = $scope.pdpdata; + }; + $scope.filterPdpGroup; + $scope.filterPDPGroupData = function() { + $scope.pushTabPDPGrid.data = $filter('filter')($scope.pdpdata, $scope.filterPdpGroup, undefined); + }; + + $scope.pushTabPDPGrid = { + onRegisterApi: function(gridApi) { + $scope.gridApi = gridApi; + }, + enableFiltering: true, + columnDefs: [ + { field: 'default',displayName : '', enableFiltering : false, enableSorting : false, + cellTemplate: '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPDPGroupWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ', + width: '8%' + }, + { field: 'id', displayName : 'ID'}, + { field: 'name', displayName : 'Name' }, + { field: 'description' } + ] + }; + + + $scope.editPDPGroupWindow = function (selectedPdpGroupData) { + $scope.removePDPGroupPolicies = selectedPdpGroupData; + if($scope.isDisabled){ + Notification.error("Policy Application has been LockDown."); + }else{ + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'remove_PDPGroupPolicies_popup.html', + controller: 'removeGroupPoliciesController', + resolve: { + message: function () { + var message = { + selectedPdpGroupData: $scope.removePDPGroupPolicies + }; + return message; + } + } + }); + modalInstance.result.then(function (response) { + console.log('response', response); + $scope.pdpdata = JSON.parse(response.data); + $scope.pushTabPDPGrid.data = $scope.pdpdata; + }); + } + }; + + $scope.gridOptions = { + onRegisterApi: function(gridApi) { + $scope.gridPolicyApi = gridApi; + }, + enableSorting: true, + enableFiltering: true, + showTreeExpandNoChildren: true, + paginationPageSizes: [10, 20, 50, 100], + paginationPageSize: 20, + columnDefs: [{name: 'name'}, {name: 'version'}, {name: 'dateModified'}] + }; + + $scope.files; + var data = []; + $scope.filterPolicy; + $scope.filterPolicyData = function() { + $scope.gridOptions.data = $filter('filter')($scope.files, $scope.filterPolicy, undefined); + }; + + AutoPushService.getAutoPushPoliciesData().then(function (data1) { + $scope.loading = false; + $scope.files = data1.data; + var data = data1.data; + + var id=0; + var writeoutNode = function(childArray, currentLevel, dataArray){ + childArray.forEach( function(childNode){ + if (childNode.files.length > 0){ + childNode.$$treeLevel = currentLevel; + id=childNode.categoryId; + if(childNode.categoryId == childNode.parentCategoryId){ + childNode.parent=''; + } + }else{ + if((id!=childNode.parentCategoryId) || (childNode.categoryId == childNode.parentCategoryId)){ + if(childNode.categoryId == childNode.parentCategoryId){ + childNode.parent=''; + } + childNode.$$treeLevel = currentLevel; + } + } + dataArray.push( childNode ); + writeoutNode( childNode.files, currentLevel + 1, dataArray ); + }); + }; + + $scope.gridOptions.data = []; + writeoutNode(data, 0, $scope.gridOptions.data); + }, function (error) { + console.log("failed"); + }); + + + + $scope.pushPoliciesButton = function(){ + var policySelection = $scope.gridPolicyApi.selection.getSelectedRows(); + console.log(policySelection); + var currentSelection = $scope.gridApi.selection.getSelectedRows(); + if(policySelection.length == 0 && currentSelection.length == 0){ + Notification.error("Please Select Policy and PDP Group to Push"); + } + if(policySelection.length == 0 && currentSelection.length != 0){ + Notification.error("Please Select Policy to Push"); + } + if(policySelection.length != 0 && currentSelection.length == 0){ + Notification.error("Please Select PDP Group to Push"); + } + if(policySelection.length != 0 && currentSelection.length != 0){ + var finalData = { + "pdpDatas": currentSelection, + "policyDatas": policySelection + }; + console.log(finalData); + var uuu = "auto_Push/PushPolicyToPDP.htm"; + var postData={pushTabData: finalData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.data=data.data; + $scope.pdpdata = JSON.parse(data.data); + $scope.pushTabPDPGrid.data = $scope.pdpdata; + Notification.success("Policy Pushed Successfully"); + }); + console.log($scope.data); + }, + error : function(data){ + Notification.error("Error Occured while Pushing Policy."); + } + }); + + } + }; + + +}); diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/AutoPushTabController/RemovePDPGroupPoliciesController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/AutoPushTabController/RemovePDPGroupPoliciesController.js new file mode 100644 index 000000000..2a6c8c38f --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/AutoPushTabController/RemovePDPGroupPoliciesController.js @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var removeGroupPoliciesController = function ($scope, $modalInstance, message, Notification){ + if(message.selectedPdpGroupData !=null){ + $scope.label='Remove PDP Group Policies' + $scope.disableCd=true; + } + $scope.policies = message.selectedPdpGroupData.policies; + $scope.pdpGroupData = message.selectedPdpGroupData; + + $scope.removePoliciesGrid = { + data : 'policies', + enableFiltering: true, + columnDefs: [ + { field: 'root', displayName : 'Root', width : '10%'}, + { field: 'name', displayName : 'Name' }, + { field: 'version' , width : '10%'}, + { field: 'id' } + ] + }; + + $scope.removePoliciesGrid.onRegisterApi = function(gridApi){ + //set gridApi on scope + $scope.gridApi = gridApi; + gridApi.selection.on.rowSelectionChanged($scope,function(row){ + var msg = 'row selected ' + row.isSelected; + }); + + gridApi.selection.on.rowSelectionChangedBatch($scope,function(rows){ + var msg = 'rows changed ' + rows.length; + }); + }; + + $scope.removePolicies = function() { + $scope.removeGroupData = []; + angular.forEach($scope.gridApi.selection.getSelectedRows(), function (data, index) { + $scope.removeGroupData.push(data); + }); + var uuu = "auto_Push/remove_GroupPolicies.htm"; + var postData={data: $scope.removeGroupData, + activePdpGroup : $scope.pdpGroupData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.data=data.data;}); + console.log($scope.data); + $modalInstance.close({data:$scope.data}); + Notification.success("Policy Removed Successfully"); + }, + error : function(data){ + Notification.error("Error Occured while removing Policy"); + } + }); + + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/DictionaryController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/DictionaryController.js new file mode 100644 index 000000000..ea3f6c8dc --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/DictionaryController.js @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +var mainDictionarys = ["Action Policy", "BRMS Policy", "Common Dictionary", "ClosedLoop Policy","Decision Policy", "Descriptive Policy", + "Enforcer Policy", "Firewall Policy", "MicroService Policy", "Policy Scope", "Safe Policy Dictionary"]; +var subDictionarys = [["Action Dictionary"], + ["BRMS Param Template"], + ["Attribute Dictionary","EcompName Dictionary"], + ["PEP Options","Site Dictionary","Service Dictionary","Varbind Dictionary", "VNF Type","VSCL Action"], + ["Settings Dictionary"], + ["Descriptive Scope"], + ["Enforcer Dictionary"], + ["Action List", "Address Group", "Parent Dictionary List", "Port List", "Prefix List", "Protocol List", "Security Zone", "Service Group", "Service List", "Term List", "Zone"], + ["DCAE UUID","MicroService ConfigName","MicroService Location", "MicroService Models"], + ["Closed Loop", "Group Policy Scope", "Resource", "Service", "Type"], + ["Risk Type", "Safe Policy Warning"]]; +app.controller('dictionaryTabController', function ($scope, AdminTabService, modalService, $modal){ + $( "#dialog" ).hide(); + + $scope.isDisabled = true; + AdminTabService.getData().then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.isDisabled = true; + this.isDisabled = true; + }else{ + $scope.isDisabled = false; + this.isDisabled = false; + } + console.log($scope.data); + },function(error){ + console.log("failed"); + }); + + $scope.options1 = mainDictionarys; + $scope.options2 = []; + $scope.getOptions2 = function(){ + var key = $scope.options1.indexOf($scope.option1); + var myNewOptions = subDictionarys[key]; + $scope.options2 = myNewOptions; + }; + + $scope.import = function() { + $scope.data = {}; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'import_dictionary_popup.html', + controller: 'importDictionaryController', + resolve: { + message: function () { + var message = { + data: $scope.data + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + }); + }; + +});
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/FileSaver.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/FileSaver.js new file mode 100644 index 000000000..8a77cd007 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/FileSaver.js @@ -0,0 +1,170 @@ +var saveAs = saveAs || (function(view) { + "use strict"; + // IE <10 is explicitly unsupported + if (typeof view === "undefined" || typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) { + return; + } + var + doc = view.document + // only get URL when necessary in case Blob.js hasn't overridden it yet + , get_URL = function() { + return view.URL || view.webkitURL || view; + } + , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a") + , can_use_save_link = "download" in save_link + , click = function(node) { + var event = new MouseEvent("click"); + node.dispatchEvent(event); + } + , is_safari = /constructor/i.test(view.HTMLElement) + , throw_outside = function(ex) { + (view.setImmediate || view.setTimeout)(function() { + throw ex; + }, 0); + } + , force_saveable_type = "application/octet-stream" + // the Blob API is fundamentally broken as there is no "downloadfinished" event to subscribe to + , arbitrary_revoke_timeout = 1000 * 40 // in ms + , revoke = function(file) { + var revoker = function() { + if (typeof file === "string") { // file is an object URL + get_URL().revokeObjectURL(file); + } else { // file is a File + file.remove(); + } + }; + setTimeout(revoker, arbitrary_revoke_timeout); + } + , dispatch = function(filesaver, event_types, event) { + event_types = [].concat(event_types); + var i = event_types.length; + while (i--) { + var listener = filesaver["on" + event_types[i]]; + if (typeof listener === "function") { + try { + listener.call(filesaver, event || filesaver); + } catch (ex) { + throw_outside(ex); + } + } + } + } + , auto_bom = function(blob) { + // prepend BOM for UTF-8 XML and text/* types (including HTML) + // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF + if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) { + return new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type}); + } + return blob; + } + , FileSaver = function(blob, name, no_auto_bom) { + if (!no_auto_bom) { + blob = auto_bom(blob); + } + // First try a.download, then web filesystem, then object URLs + var + filesaver = this + , type = blob.type + , force = type === force_saveable_type + , object_url + , dispatch_all = function() { + dispatch(filesaver, "writestart progress write writeend".split(" ")); + } + // on any filesys errors revert to saving with object URLs + , fs_error = function() { + if (force && is_safari && view.FileReader) { + // Safari doesn't allow downloading of blob urls + var reader = new FileReader(); + reader.onloadend = function() { + var base64Data = reader.result; + view.location.href = "data:attachment/file" + base64Data.slice(base64Data.search(/[,;]/)); + filesaver.readyState = filesaver.DONE; + dispatch_all(); + }; + reader.readAsDataURL(blob); + filesaver.readyState = filesaver.INIT; + return; + } + // don't create more object URLs than needed + if (!object_url) { + object_url = get_URL().createObjectURL(blob); + } + if (force) { + view.location.href = object_url; + } else { + var opened = view.open(object_url, "_blank"); + if (!opened) { + // Apple does not allow window.open, see https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html + view.location.href = object_url; + } + } + filesaver.readyState = filesaver.DONE; + dispatch_all(); + revoke(object_url); + } + ; + filesaver.readyState = filesaver.INIT; + + if (can_use_save_link) { + object_url = get_URL().createObjectURL(blob); + setTimeout(function() { + save_link.href = object_url; + save_link.download = name; + click(save_link); + dispatch_all(); + revoke(object_url); + filesaver.readyState = filesaver.DONE; + }); + return; + } + + fs_error(); + } + , FS_proto = FileSaver.prototype + , saveAs = function(blob, name, no_auto_bom) { + return new FileSaver(blob, name || blob.name || "download", no_auto_bom); + } + ; + // IE 10+ (native saveAs) + if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) { + return function(blob, name, no_auto_bom) { + name = name || blob.name || "download"; + + if (!no_auto_bom) { + blob = auto_bom(blob); + } + return navigator.msSaveOrOpenBlob(blob, name); + }; + } + + FS_proto.abort = function(){}; + FS_proto.readyState = FS_proto.INIT = 0; + FS_proto.WRITING = 1; + FS_proto.DONE = 2; + + FS_proto.error = + FS_proto.onwritestart = + FS_proto.onprogress = + FS_proto.onwrite = + FS_proto.onabort = + FS_proto.onerror = + FS_proto.onwriteend = + null; + + return saveAs; + }( + typeof self !== "undefined" && self + || typeof window !== "undefined" && window + || this.content + )); +// `self` is undefined in Firefox for Android content script context +// while `this` is nsIContentFrameMessageManager +// with an attribute `content` that corresponds to the window + +if (typeof module !== "undefined" && module.exports) { + module.exports.saveAs = saveAs; +} else if ((typeof define !== "undefined" && define !== null) && (define.amd !== null)) { + define([], function() { + return saveAs; + }); +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/ImportDictionaryController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/ImportDictionaryController.js new file mode 100644 index 000000000..c8e535363 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/ImportDictionaryController.js @@ -0,0 +1,53 @@ +/*- + * ============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 importDictionaryController = function ($scope, $modalInstance, message, $http, PapUrlService, UserInfoService){ + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.uploadFile = function(files) { + var fd = new FormData(); + fd.append("file", files[0]); + + $http.post(papUrl + "/ecomp/dictionary/import_dictionary.htm/" + loginId, fd, { + withCredentials: false, + headers: {'Content-Type': undefined}, + transformRequest: angular.identity + }).success().error( ); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PDPTabController/AddorEditPdpInGroup.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PDPTabController/AddorEditPdpInGroup.js new file mode 100644 index 000000000..c1d42287d --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PDPTabController/AddorEditPdpInGroup.js @@ -0,0 +1,62 @@ +/*- + * ============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 pdpInGroupController = function ($scope, $modalInstance, message, Notification){ + $scope.edit = 'false'; + if(message.pdpInGroup==null) + $scope.label='Add PDP to Group' + else{ + $scope.label='Edit PDP In Group' + $scope.disableCd=true; + $scope.edit = 'true'; + } + $scope.editPDPInGroup = message.pdpInGroup; + $scope.editActivePDP = message.activePDP; + + $scope.savePDPInGroup = function(pdpInGroup) { + var uuu = "pdp_Group/save_pdpTogroup.htm"; + var postData={pdpInGroup: pdpInGroup, + activePDP: $scope.editActivePDP, + update : $scope.edit}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.data=data.data;}); + console.log($scope.data); + $modalInstance.close({data:$scope.data}); + }, + error : function(data){ + Notification.error("Error Occured while Creating/Updating a PDP Group"); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +} + diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PDPTabController/PDPGroupStatusController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PDPTabController/PDPGroupStatusController.js new file mode 100644 index 000000000..293b853b9 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PDPTabController/PDPGroupStatusController.js @@ -0,0 +1,44 @@ +/*- + * ============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 pdpGroupStatusController = function ($scope, $modalInstance, message){ + if(message.status==null) { + $scope.label = 'No Status to Display' + }else{ + $scope.label='Status' + $scope.disableCd=true; + $scope.policies = message.policies; + $scope.pdpStatusDatas = message.status; + } + + $scope.policiesGrid = { + data : 'policies', + enableFiltering: true, + columnDefs: [ + { field: 'name', displayName : 'Name' } + ] + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PolicyAddScopeRoleController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PolicyAddScopeRoleController.js new file mode 100644 index 000000000..4722144bc --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PolicyAddScopeRoleController.js @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + * + */ +var editRoleController = function ($scope, RolesTabService, $modalInstance, message){ + if(message.editRoleData!=null){ + $scope.label='Edit Role' + $scope.disableCd=true; + } + $scope.editRole = message.editRoleData; + + RolesTabService.getPolicyScopesData().then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.scopeDatas = JSON.parse($scope.data.scopeDatas); + console.log($scope.scopeDatas); + }, function (error) { + console.log("failed"); + }); + + $scope.saveRole = function(editRoleData) { + var uuu = "save_NonSuperRolesData.htm"; + var postData={editRoleData: editRoleData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.rolesDatas=data.rolesDatas;}); + console.log($scope.rolesDatas); + $modalInstance.close({rolesDatas:$scope.rolesDatas}); + }, + error : function(data){ + alert("Error while saving Role."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PolicyRolesController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PolicyRolesController.js new file mode 100644 index 000000000..d5859abe3 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/PolicyRolesController.js @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + * + */ +app.controller('policyRolesController', function ($scope, RolesTabService,modalService, $modal, AdminTabService, Notification){ + $( "#dialog" ).hide(); + + $scope.isDisabled = true; + AdminTabService.getData().then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.isDisabled = true; + }else{ + $scope.isDisabled = false; + } + console.log($scope.data); + },function(error){ + console.log("failed"); + }); + + $scope.scopeDatas = []; + RolesTabService.getRolesData().then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.rolesDatas = JSON.parse($scope.data.rolesDatas); + console.log($scope.rolesDatas); + }, function (error) { + console.log("failed"); + }); + + $scope.rolesTableGrid = { + data : 'rolesDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editRolesWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button>', width: '8%' + }, + { field: 'loginId.userName', displayName : 'Name'}, + { field: 'scope', displayName : 'Scope' }, + { field: 'role', displayName : 'Role' } + ] + }; + + + $scope.editRoleName = null; + + $scope.editRolesWindow = function(editRoleData) { + if($scope.lockdowndata[0].lockdown == true){ + Notification.error("Policy Application has been Locked") + }else{ + $scope.editRoleName = editRoleData; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'edit_Role_popup.html', + controller: 'editRoleController', + resolve: { + message: function () { + var message = { + editRoleData: $scope.editRoleName + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + }); + } + + }; + +});
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dashboardController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dashboardController.js new file mode 100644 index 000000000..9ff974351 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dashboardController.js @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +app.controller('policyDashboardHealthController', function ($scope,DashboardService,modalService, $modal){ + $( "#dialog" ).hide(); + $scope.pdpTableDatas = []; + $scope.papTableDatas = []; + $scope.policyActivityTableDatas = []; + DashboardService.getSystemAlertData().then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.systemAlertsTableDatas =JSON.parse($scope.data.systemAlertsTableDatas); + },function(error){ + console.log("failed"); + //reloadPageOnce(); + }); + + DashboardService.getPAPStatusData().then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.papTableMapDatas =JSON.parse($scope.data.papTableDatas); + if($scope.papTableMapDatas != null){ + for(i = 0; i < $scope.papTableMapDatas.length; i++){ + $scope.papTableDatas.push($scope.papTableMapDatas[i].map); + } + } + },function(error){ + console.log("failed"); + //reloadPageOnce(); + }); + + DashboardService.getPDPStatusData().then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.pdpTableMapDatas =JSON.parse($scope.data.pdpTableDatas); + if($scope.pdpTableMapDatas != null) { + for (i = 0; i < $scope.pdpTableMapDatas.length; i++) { + $scope.pdpTableDatas.push($scope.pdpTableMapDatas[i].map); + } + } + },function(error){ + console.log("failed"); + //reloadPageOnce(); + }); + + DashboardService.getPolicyActivityData().then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.policyActivityTableMapDatas =JSON.parse($scope.data.policyActivityTableDatas); + if($scope.policyActivityTableMapDatas != null) { + for (i = 0; i < $scope.policyActivityTableMapDatas.length; i++) { + $scope.policyActivityTableDatas.push($scope.policyActivityTableMapDatas[i].map); + } + } + },function(error){ + console.log("failed"); + //reloadPageOnce(); + }); + + $scope.availableGridHealthDatas = { + data : 'systemAlertsTableDatas', + enableFiltering: true, + columnDefs: [{ field: 'id'}, + { field: 'type'}, + { field: 'system'}, + {field: 'logtype'}, + {field : 'date' ,type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field : 'description'} + ], + }; + + $scope.papStatusDatas = { + data : 'papTableDatas', + enableFiltering: true, + columnDefs: [{ field: 'system'}, + { field: 'status'}, + { field: 'noOfPolicy'}, + {field: 'noOfConnectedTrap'} + ], + }; + + $scope.pdpStatusDatas = { + data : 'pdpTableDatas', + enableFiltering: true, + columnDefs: [{ field: 'id'}, + { field: 'name'}, + { field: 'groupname'}, + {field: 'status'}, + {field : 'description' }, + {field : 'permitCount'}, + {field : 'denyCount'}, + {field : 'naCount'} + ], + }; + + $scope.policyActivityDatas = { + data : 'policyActivityTableDatas', + enableFiltering: true, + columnDefs: [{ field: 'policyId'}, + { field: 'fireCount'}, + { field: 'system'} + ], + }; +});
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dashboard_Logging_Controller.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dashboard_Logging_Controller.js new file mode 100644 index 000000000..7b07b1d71 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dashboard_Logging_Controller.js @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +app.controller('policyDashboardController', function ($scope,DashboardService,modalService, $modal, uiGridConstants,Grid){ + $( "#dialog" ).hide(); + + $scope.loading = true; + DashboardService.getData().then(function(data){ + $scope.loading = false; + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.availableLoggingDatas =JSON.parse($scope.data.availableLoggingDatas); + console.log($scope.availableLoggingDatas); + },function(error){ + console.log("failed"); + //reloadPageOnce(); + }); + + $scope.availableGridLoggingDatas = { + data : 'availableLoggingDatas', + enableFiltering: true, + columnDefs: [{ field: 'id'}, + { field: 'type'}, + { field: 'system'}, + {field: 'logtype'}, + {field : 'date' ,type: 'date', cellFilter: 'date:\'yyyy-MM-dd HH:MM:ss a\'' }, + {field : 'description'} + ], + enableGridMenu: true, + enableSelectAll: true, + exporterCsvFilename: 'DashboardLogging.csv', + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'date') { + var date = new Date(input); + return date; + } else { + return input; + } + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + + }; + +}); + diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js new file mode 100644 index 000000000..030f08f43 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editBRMSParamController = function ($scope, $modalInstance, message, $http, PapUrlService, UserInfoService, Notification){ + if(message.brmsParamDictionaryData==null) + $scope.label='Add BRMS Rule' + else{ + $scope.label='Edit BRMS Rule' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editBRMSParam = message.brmsParamDictionaryData; + + $scope.uploadFile = function(files) { + var fd = new FormData(); + fd.append("file", files[0]); + $http.post(papUrl + "/ecomp/brms_dictionary/set_BRMSParamData.htm", fd, { + withCredentials: false, + headers: {'Content-Type': undefined }, + transformRequest: angular.identity + }).success().error( ); + + }; + + $scope.MyFile = []; + $scope.saveBRMSParam = function(brmsParamDictionaryData) { + var file = $scope.MyFile; + var uuu = papUrl + "/ecomp/brms_dictionary/save_BRMSParam.htm"; + var postData={brmsParamDictionaryData: brmsParamDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.brmsParamDictionaryDatas=data.brmsParamDictionaryDatas;}); + if($scope.brmsParamDictionaryDatas == "Duplicate"){ + Notification.error("BRMSParan Dictionary exists with Same Name.") + }else{ + console.log($scope.brmsParamDictionaryDatas); + $modalInstance.close({brmsParamDictionaryDatas:$scope.brmsParamDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLPepOptionsDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLPepOptionsDictController.js new file mode 100644 index 000000000..5ec078f11 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLPepOptionsDictController.js @@ -0,0 +1,120 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPEPOptionsController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.pepOptionsDictionaryData==null) + $scope.label='Add PEP Options', + $scope.choices = []; + else{ + $scope.label='Edit PEP Options' + $scope.disableCd=true; + $scope.choices = []; + var headers = message.pepOptionsDictionaryData.actions; + var SplitChars = ':#@'; + if (headers.indexOf(SplitChars) >= 0) { + var splitHeader = headers.split(SplitChars); + var singleHeader = splitHeader; + var splitEqual = '=#@'; + for(i = 0; i < singleHeader.length; i++){ + if (singleHeader[i].indexOf(splitEqual) >= 0) { + var splitValue = singleHeader[i].split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo, 'option': key , 'number' : value }); + } + } + }else{ + var splitEqual = '=#@'; + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + $scope.choices.push({'id':'choice'+1, 'option': key , 'number' : value }); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPEPOptions = message.pepOptionsDictionaryData; + + $scope.saveCLPepOptions = function(pepOptionsDictionaryData) { + var finalData = extend(pepOptionsDictionaryData, $scope.actions[0]); + var uuu = papUrl + "/ecomp/cl_dictionary/save_pepOptions.htm"; + var postData={pepOptionsDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.pepOptionsDictionaryDatas=data.pepOptionsDictionaryDatas;}); + if($scope.pepOptionsDictionaryDatas == "Duplicate"){ + Notification.error("PEP Options Dictionary exists with Same PEP Name.") + }else{ + console.log($scope.pepOptionsDictionaryDatas); + $modalInstance.close({pepOptionsDictionaryDatas:$scope.pepOptionsDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.actions = [{"attributes" : $scope.choices}]; + $scope.addNewChoice = function() { + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo}); + }; + $scope.removeChoice = function() { + var lastItem = $scope.choices.length-1; + $scope.choices.splice(lastItem); + }; + +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLServiceDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLServiceDictController.js new file mode 100644 index 000000000..c3acc72b2 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLServiceDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editCLServiceController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.closedLoopServiceDictionaryData==null) + $scope.label='Add Service Name' + else{ + $scope.label='Edit Service Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editCLService = message.closedLoopServiceDictionaryData; + + $scope.saveCLServiceDict = function(closedLoopServiceDictionaryData) { + var uuu = papUrl + "/ecomp/cl_dictionary/save_service.htm"; + var postData={closedLoopServiceDictionaryData: closedLoopServiceDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.closedLoopServiceDictionaryDatas=data.closedLoopServiceDictionaryDatas;}); + if($scope.closedLoopServiceDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop Service Dictionary exists with Same Service Name.") + }else{ + console.log($scope.closedLoopServiceDictionaryDatas); + $modalInstance.close({closedLoopServiceDictionaryDatas:$scope.closedLoopServiceDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLSiteDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLSiteDictController.js new file mode 100644 index 000000000..7150ca891 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLSiteDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editCLSiteController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.closedLoopSiteDictionaryData==null) + $scope.label='Add Site Name' + else{ + $scope.label='Edit Site Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editCLSite = message.closedLoopSiteDictionaryData; + + $scope.saveCLSite = function(closedLoopSiteDictionaryData) { + var uuu = papUrl + "/ecomp/cl_dictionary/save_siteName.htm"; + var postData={closedLoopSiteDictionaryData: closedLoopSiteDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.closedLoopSiteDictionaryDatas=data.closedLoopSiteDictionaryDatas;}); + if($scope.closedLoopSiteDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop Site Dictionary exists with Same Site Name.") + }else{ + console.log($scope.closedLoopSiteDictionaryDatas); + $modalInstance.close({closedLoopSiteDictionaryDatas:$scope.closedLoopSiteDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVarbindDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVarbindDictController.js new file mode 100644 index 000000000..03c2eb345 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVarbindDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editCLVarbindController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.varbindDictionaryData==null) + $scope.label='Add Varbind ' + else{ + $scope.label='Edit Varbind' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editCLVarbind = message.varbindDictionaryData; + + $scope.saveCLVarbind = function(varbindDictionaryData) { + var uuu = papUrl + "/ecomp/cl_dictionary/save_varbind.htm"; + var postData={varbindDictionaryData: varbindDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.varbindDictionaryDatas=data.varbindDictionaryDatas;}); + if($scope.varbindDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop Varbind Dictionary exists with Same Varbind Name.") + }else{ + console.log($scope.varbindDictionaryDatas); + $modalInstance.close({varbindDictionaryDatas:$scope.varbindDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVnfTypeDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVnfTypeDictController.js new file mode 100644 index 000000000..5b46e67a2 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVnfTypeDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editVnfTypeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.vnfTypeDictionaryData==null) + $scope.label='Add VNF Type' + else{ + $scope.label='Edit VNF Type' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editVnfType = message.vnfTypeDictionaryData; + + $scope.saveCLVnfType = function(vnfTypeDictionaryData) { + var uuu = papUrl + "/ecomp/cl_dictionary/save_vnfType.htm"; + var postData={vnfTypeDictionaryData: vnfTypeDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.vnfTypeDictionaryDatas=data.vnfTypeDictionaryDatas;}); + if($scope.vnfTypeDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop VNFType Dictionary exists with Same VNFType Name.") + }else{ + console.log($scope.vnfTypeDictionaryDatas); + $modalInstance.close({vnfTypeDictionaryDatas:$scope.vnfTypeDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVsclActionDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVsclActionDictController.js new file mode 100644 index 000000000..d69a30e7a --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/CLVsclActionDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editVsclActionController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.vsclActionDictionaryData==null) + $scope.label='Add VSCL Action' + else{ + $scope.label='Edit VSCL Action' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editvsclAction = message.vsclActionDictionaryData; + + $scope.saveCLVSCLAction = function(vsclActionDictionaryData) { + var uuu = papUrl + "/ecomp/cl_dictionary/save_vsclAction.htm"; + var postData={vsclActionDictionaryData: vsclActionDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.vsclActionDictionaryDatas=data.vsclActionDictionaryDatas;}); + if($scope.vsclActionDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop VSCLAction Dictionary exists with Same VSCLAction Name.") + }else{ + console.log($scope.vsclActionDictionaryDatas); + $modalInstance.close({vsclActionDictionaryDatas:$scope.vsclActionDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionSettingsDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionSettingsDictController.js new file mode 100644 index 000000000..cbe99c094 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionSettingsDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editSettingsDictController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.settingsDictionaryData==null) + $scope.label='Add Decision Settings' + else{ + $scope.label='Edit Decision Settings' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editSettingsDict = message.settingsDictionaryData; + + $scope.saveDecisionSettings = function(settingsDictionaryData) { + var uuu = papUrl + "/ecomp/decision_dictionary/save_Settings.htm"; + var postData={settingsDictionaryData: settingsDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.settingsDictionaryDatas=data.settingsDictionaryDatas;}); + if($scope.settingsDictionaryDatas == "Duplicate"){ + Notification.error("Decision Dictionary exists with Same Settings Name.") + }else{ + console.log($scope.settingsDictionaryDatas); + $modalInstance.close({settingsDictionaryDatas:$scope.settingsDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DescriptiveSearchDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DescriptiveSearchDictController.js new file mode 100644 index 000000000..f78cedc24 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/DescriptiveSearchDictController.js @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editDescriptiveScopeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.descriptiveScopeDictionaryData==null) + $scope.label='Add Descriptive Scope', + $scope.choices = []; + else{ + $scope.label='Edit Descriptive Scope' + $scope.disableCd=true; + $scope.choices = []; + var headers = message.descriptiveScopeDictionaryData.search; + var SplitChars = 'AND'; + if (headers.indexOf(SplitChars) >= 0) { + var splitHeader = headers.split(SplitChars); + var singleHeader = splitHeader; + var splitEqual = ':'; + for(i = 0; i < singleHeader.length; i++){ + if (singleHeader[i].indexOf(splitEqual) >= 0) { + var splitValue = singleHeader[i].split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo, 'option': key , 'number' : value }); + } + } + }else{ + var splitEqual = ':'; + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + $scope.choices.push({'id':'choice'+1, 'option': key , 'number' : value }); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editDescriptiveScope = message.descriptiveScopeDictionaryData; + + $scope.saveDescriptiveScope = function(descriptiveScopeDictionaryData) { + var finalData = extend(descriptiveScopeDictionaryData, $scope.actions[0]); + var uuu = papUrl + "/ecomp/descriptive_dictionary/save_descriptive.htm"; + var postData={descriptiveScopeDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.descriptiveScopeDictionaryDatas=data.descriptiveScopeDictionaryDatas;}); + if($scope.descriptiveScopeDictionaryDatas == "Duplicate"){ + Notification.error("Descriptive Scope Dictionary exists with Same Scope Name.") + }else{ + console.log($scope.descriptiveScopeDictionaryDatas); + $modalInstance.close({descriptiveScopeDictionaryDatas:$scope.descriptiveScopeDictionaryDatas}); + } + + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.actions = [{"attributes" : $scope.choices}]; + $scope.addNewChoice = function() { + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo}); + }; + $scope.removeChoice = function() { + var lastItem = $scope.choices.length-1; + $scope.choices.splice(lastItem); + }; + +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/EnforcerDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/EnforcerDictController.js new file mode 100644 index 000000000..caf17204f --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/EnforcerDictController.js @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editEnforcerTypeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService){ + if(message.enforcerDictionaryData==null) + $scope.label='Add Enforcing Type' + else{ + $scope.label='Edit Enforcing Type' + $scope.disableCd=true; + } + $scope.editEnforcerType = message.enforcerDictionaryData; + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.saveEnforcerType = function(enforcerDictionaryData) { + var uuu = papUrl + "/ecomp/enforcer_dictionary/save_enforcerType.htm"; + var postData={enforcerDictionaryData: enforcerDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.enforcerDictionaryDatas=data.enforcerDictionaryDatas;}); + console.log($scope.enforcerDictionaryDatas); + $modalInstance.close({enforcerDictionaryDatas:$scope.enforcerDictionaryDatas}); + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWActionListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWActionListDictController.js new file mode 100644 index 000000000..14432e9b9 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWActionListDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWActionListController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.actionListDictionaryData==null) + $scope.label='Add Action Name' + else{ + $scope.label='Edit Action Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editActionList = message.actionListDictionaryData; + + $scope.saveFWActionList = function(actionListDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/save_ActionList.htm"; + var postData={actionListDictionaryData: actionListDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.actionListDictionaryDatas=data.actionListDictionaryDatas;}); + if($scope.actionListDictionaryDatas == "Duplicate"){ + Notification.error("FW ActionList Dictionary exists with Same ActionList Name.") + }else{ + console.log($scope.actionListDictionaryDatas); + $modalInstance.close({actionListDictionaryDatas:$scope.actionListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWAddressGroupDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWAddressGroupDictController.js new file mode 100644 index 000000000..57d9ae95d --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWAddressGroupDictController.js @@ -0,0 +1,120 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWAddressGroupController = function ($scope, $modalInstance, message, FWDictionaryService, PapUrlService, UserInfoService, Notification){ + if(message.addressGroupDictionaryData==null) + $scope.label='Add Address Group', + $scope.apchoices = []; + else{ + $scope.label='Edit Address Group' + $scope.disableCd=true; + $scope.apchoices = []; + var headers = message.addressGroupDictionaryData.prefixList; + var splitEqual = ','; + if(headers != null){ + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + for(i = 0; i < splitValue.length; i++){ + var key = splitValue[i]; + $scope.apchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = headers; + $scope.apchoices.push({'id':'choice'+1, 'option': key}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getPrefixListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.prefixListDictionaryDatas = JSON.parse($scope.data.prefixListDictionaryDatas); + console.log($scope.prefixListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editAddressGroup = message.addressGroupDictionaryData; + + $scope.saveFWAddressGroup = function(addressGroupDictionaryData) { + var finalData = extend(addressGroupDictionaryData, $scope.attributeDatas[0]); + var uuu = papUrl + "/ecomp/fw_dictionary/save_addressGroup.htm"; + var postData={addressGroupDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.addressGroupDictionaryDatas=data.addressGroupDictionaryDatas;}); + if($scope.addressGroupDictionaryDatas == "Duplicate"){ + Notification.error("FW AddressGroup Dictionary exists with Same Address group Name.") + }else{ + console.log($scope.addressGroupDictionaryDatas); + $modalInstance.close({addressGroupDictionaryDatas:$scope.addressGroupDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.attributeDatas = [{"attributes" : $scope.apchoices}]; + $scope.addAPNewChoice = function() { + var newItemNo = $scope.apchoices.length+1; + $scope.apchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeAPChoice = function() { + var lastItem = $scope.apchoices.length-1; + $scope.apchoices.splice(lastItem); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWParentListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWParentListDictController.js new file mode 100644 index 000000000..d73faf5f7 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWParentListDictController.js @@ -0,0 +1,156 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWParentListController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, FWDictionaryService, Notification){ + if(message.fwDictListDictionaryData==null){ + $scope.slchoices = []; + $scope.alchoices = []; + $scope.label='Add Parent List' + }else{ + $scope.label='Edit Parent List' + $scope.disableCd=true; + $scope.slchoices = []; + $scope.alchoices = []; + var slList = message.fwDictListDictionaryData.serviceList; + var alList = message.fwDictListDictionaryData.addressList; + var splitEqual = ','; + if(slList != null){ + if (slList.indexOf(splitEqual) >= 0) { + var splitValue = slList.split(splitEqual); + for(i = 0; i < splitValue.length; i++){ + var key = splitValue[i]; + $scope.slchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = slList; + $scope.slchoices.push({'id':'choice'+1, 'option': key}); + } + } + if(alList != null){ + if (alList.indexOf(splitEqual) >= 0) { + var splitALValue = alList.split(splitEqual); + for(i = 0; i < splitALValue.length; i++){ + var key = splitALValue[i]; + $scope.alchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = alList; + $scope.alchoices.push({'id':'choice'+1, 'option': key}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getServiceListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.serviceListDictionaryDatas = JSON.parse($scope.data.serviceListDictionaryDatas); + console.log($scope.serviceListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getAddressGroupDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.addressGroupDictionaryDatas = JSON.parse($scope.data.addressGroupDictionaryDatas); + console.log($scope.addressGroupDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editParentList = message.fwDictListDictionaryData; + + $scope.saveFWParentList = function(fwDictListDictionaryData) { + var addSLData = extend(fwDictListDictionaryData, $scope.attributeDatas[0]); + var finalData = extend(addSLData, $scope.attributeALDatas[0]); + var uuu = papUrl + "/ecomp/fw_dictionary/save_FWDictionaryList.htm"; + var postData={fwDictListDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.fwDictListDictionaryDatas=data.fwDictListDictionaryDatas;}); + if($scope.fwDictListDictionaryDatas == "Duplicate"){ + Notification.error("FW DictionaryList Dictionary exists with Same Name.") + }else{ + console.log($scope.fwDictListDictionaryDatas); + $modalInstance.close({fwDictListDictionaryDatas:$scope.fwDictListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + + $scope.attributeDatas = [{"attributes" : $scope.slchoices}]; + $scope.addServiceGroupNewChoice = function() { + var newItemNo = $scope.slchoices.length+1; + $scope.slchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeServiceGroupChoice = function() { + var lastItem = $scope.slchoices.length-1; + $scope.slchoices.splice(lastItem); + }; + + $scope.attributeALDatas = [{"alAttributes" : $scope.alchoices}]; + $scope.addAddressGroupNewChoice = function() { + var newItemNo = $scope.alchoices.length+1; + $scope.alchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeAddressGroupChoice = function() { + var lastItem = $scope.alchoices.length-1; + $scope.alchoices.splice(lastItem); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPortListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPortListDictController.js new file mode 100644 index 000000000..a2fbfe6d2 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPortListDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWPortListController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.portListDictionaryData==null) + $scope.label='Add Port Name' + else{ + $scope.label='Edit Port Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPortList = message.portListDictionaryData; + + $scope.saveFWPortList = function(portListDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/save_portName.htm"; + var postData={portListDictionaryData: portListDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.portListDictionaryDatas=data.portListDictionaryDatas;}); + if($scope.portListDictionaryDatas == "Duplicate"){ + Notification.error("FW PortList Dictionary exists with Same Port Name.") + }else{ + console.log($scope.portListDictionaryDatas); + $modalInstance.close({portListDictionaryDatas:$scope.portListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js new file mode 100644 index 000000000..f4e66e09c --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWPrefixListController = function ($scope, $modalInstance, message, Notification, PapUrlService, UserInfoService, Notification){ + $scope.validate = 'false'; + if(message.prefixListDictionaryData==null) + $scope.label='Add PrefixList' + else{ + $scope.label='Edit PrefixList' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPrefixList = message.prefixListDictionaryData; + + $scope.saveFWPrefixList = function(prefixListDictionaryData) { + if($scope.validate == 'true'){ + var uuu = papUrl + "/ecomp/fw_dictionary/save_prefixList.htm"; + var postData={prefixListDictionaryData: prefixListDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.prefixListDictionaryDatas=data.prefixListDictionaryDatas;}); + if($scope.prefixListDictionaryDatas == "Duplicate"){ + Notification.error("FW PrefixList Dictionary exists with Same PrefixList Name.") + }else{ + console.log($scope.prefixListDictionaryDatas); + $modalInstance.close({prefixListDictionaryDatas:$scope.prefixListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }else{ + Notification.error('Prefix List Validation is Not Successful'); + } + + }; + + $scope.validateFWPrefixList = function(prefixListDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/validate_prefixList.htm"; + var postData={prefixListDictionaryData: prefixListDictionaryData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.result=data.result;}); + console.log($scope.result); + if($scope.result == 'error'){ + Notification.error('IP not according to CIDR notation'); + }else{ + $scope.validate = 'true'; + } + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWProtocolListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWProtocolListDictController.js new file mode 100644 index 000000000..4de12b8fe --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWProtocolListDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWProtocolListController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.protocolListDictionaryData==null) + $scope.label='Add Protocol Name' + else{ + $scope.label='Edit Protocol Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editProtocolList = message.protocolListDictionaryData; + + $scope.saveProtocolList = function(protocolListDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/save_protocolList.htm"; + var postData={protocolListDictionaryData: protocolListDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.protocolListDictionaryDatas=data.protocolListDictionaryDatas;}); + if($scope.protocolListDictionaryDatas == "Duplicate"){ + Notification.error("FW ProtocolList Dictionary exists with Same Protocol Name.") + }else{ + console.log($scope.protocolListDictionaryDatas); + $modalInstance.close({protocolListDictionaryDatas:$scope.protocolListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWSecurityZoneDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWSecurityZoneDictController.js new file mode 100644 index 000000000..cd43a41b8 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWSecurityZoneDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editfwSecurityZoneController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.securityZoneDictionaryData==null) + $scope.label='Add Security Zone' + else{ + $scope.label='Edit Security Zone' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editSecurityZone = message.securityZoneDictionaryData; + + $scope.saveSecurityZone = function(securityZoneDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/save_securityZone.htm"; + var postData={securityZoneDictionaryData: securityZoneDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.securityZoneDictionaryDatas=data.securityZoneDictionaryDatas;}); + if($scope.securityZoneDictionaryDatas == "Duplicate"){ + Notification.error("FW SecurityZone Dictionary exists with Same Zone Name.") + }else{ + console.log($scope.securityZoneDictionaryDatas); + $modalInstance.close({securityZoneDictionaryDatas:$scope.securityZoneDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceGroupDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceGroupDictController.js new file mode 100644 index 000000000..3cf6d9be7 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceGroupDictController.js @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWServiceGroupController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, FWDictionaryService, Notification){ + if(message.serviceGroupDictionaryData==null){ + $scope.slchoices = []; + $scope.label='Add Service Group' + }else{ + $scope.label='Edit Service Group' + $scope.disableCd=true; + $scope.slchoices = []; + var headers = message.serviceGroupDictionaryData.serviceList; + var splitEqual = ','; + if(headers != null){ + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + for(i = 0; i < splitValue.length; i++){ + var key = splitValue[i]; + $scope.slchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = headers; + $scope.slchoices.push({'id':'choice'+1, 'option': key}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getServiceListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.serviceListDictionaryDatas = JSON.parse($scope.data.serviceListDictionaryDatas); + console.log($scope.serviceListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editServiceGroup = message.serviceGroupDictionaryData; + + $scope.saveFWServiceGroup = function(serviceGroupDictionaryData) { + var finalData = extend(serviceGroupDictionaryData, $scope.attributeDatas[0]); + var uuu = papUrl + "/ecomp/fw_dictionary/save_serviceGroup.htm"; + var postData={serviceGroupDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.serviceGroupDictionaryDatas=data.serviceGroupDictionaryDatas;}); + if($scope.serviceGroupDictionaryDatas == "Duplicate"){ + Notification.error("FW Service Group Dictionary exists with Same Group Name.") + }else{ + console.log($scope.serviceGroupDictionaryDatas); + $modalInstance.close({serviceGroupDictionaryDatas:$scope.serviceGroupDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + + + $scope.attributeDatas = [{"attributes" : $scope.slchoices}]; + $scope.addServiceGroupNewChoice = function() { + var newItemNo = $scope.slchoices.length+1; + $scope.slchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeServiceGroupChoice = function() { + var lastItem = $scope.slchoices.length-1; + $scope.slchoices.splice(lastItem); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceListDictController.js new file mode 100644 index 000000000..73da6c486 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWServiceListDictController.js @@ -0,0 +1,147 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWServiceListController = function ($scope, $modalInstance, message, FWDictionaryService, PapUrlService, UserInfoService, Notification){ + $scope.protocolListDictionaryDatas =[]; + + $scope.tpchoices = []; + $scope.apchoices = []; + if(message.serviceListDictionaryData==null){ + $scope.label='Add Service List' + }else{ + $scope.label='Edit Service List' + $scope.disableCd=true; + var tcpheaders = message.serviceListDictionaryData.serviceTransProtocol; + var splitEqual = ','; + if(tcpheaders != null){ + if (tcpheaders.indexOf(splitEqual) >= 0) { + var splitValue = tcpheaders.split(splitEqual); + for(i = 0; i < splitValue.length; i++){ + var key = splitValue[i]; + $scope.tpchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = tcpheaders; + $scope.tpchoices.push({'id':'choice'+1, 'option': key}); + } + } + var appheaders = message.serviceListDictionaryData.serviceAppProtocol; + var splitEqual1 = ','; + if(appheaders != null){ + if (appheaders.indexOf(splitEqual1) >= 0) { + var splitValue1 = appheaders.split(splitEqual1); + for(i = 0; i < splitValue1.length; i++){ + var key1 = splitValue1[i]; + $scope.apchoices.push({'id':'choice'+i+1, 'option': key1}); + } + }else{ + var key1 = appheaders; + $scope.apchoices.push({'id':'choice'+1, 'option': key1}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getProtocolListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.protocolListDictionaryDatas = JSON.parse($scope.data.protocolListDictionaryDatas); + console.log($scope.protocolListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editServiceList = message.serviceListDictionaryData; + + $scope.saveFWServiceList = function(serviceListDictionaryData) { + var addtcpData = extend(serviceListDictionaryData, $scope.attributeTCPDatas[0]); + var finalData = extend(addtcpData, $scope.attributeAPPDatas[0]); + var uuu = papUrl + "/ecomp/fw_dictionary/save_serviceList.htm"; + var postData={serviceListDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.serviceListDictionaryDatas=data.serviceListDictionaryDatas;}); + if($scope.serviceListDictionaryDatas == "Duplicate"){ + Notification.error("FW ServiceList Dictionary exists with Same ServiceList Name.") + }else{ + console.log($scope.serviceListDictionaryDatas); + $modalInstance.close({serviceListDictionaryDatas:$scope.serviceListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.attributeTCPDatas = [{"transportProtocols" : $scope.tpchoices}]; + $scope.addTPNewChoice = function() { + var newItemNo = $scope.tpchoices.length+1; + $scope.tpchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeTPChoice = function() { + var lastItem = $scope.tpchoices.length-1; + $scope.tpchoices.splice(lastItem); + }; + + + $scope.attributeAPPDatas = [{"appProtocols" : $scope.apchoices}]; + $scope.addAPNewChoice = function() { + var newItemNo = $scope.apchoices.length+1; + $scope.apchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeAPChoice = function() { + var lastItem = $scope.apchoices.length-1; + $scope.apchoices.splice(lastItem); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js new file mode 100644 index 000000000..8615082a2 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js @@ -0,0 +1,331 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWTermListController = function ($scope, $modalInstance, message, FWDictionaryService, PapUrlService, UserInfoService, Notification){ + $scope.fromZonechoices = []; + $scope.toZonechoices = []; + $scope.sourceListchoices = []; + $scope.destinationListchoices = []; + $scope.sourceServicechoices = []; + $scope.destinationServicechoices = []; + $scope.actionListchoices = []; + if(message.termListDictionaryData==null){ + $scope.label='Add Term List Name' + }else{ + $scope.label='Edit Term List Name' + $scope.disableCd=true; + var fromZoneheaders = message.termListDictionaryData.fromZone; + var splitFromZone = ','; + if(fromZoneheaders != null){ + if (fromZoneheaders.indexOf(splitFromZone) >= 0) { + var splitFromZoneValue = fromZoneheaders.split(splitFromZone); + for(i = 0; i < splitFromZoneValue.length; i++){ + var key = splitFromZoneValue[i]; + $scope.fromZonechoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = fromZoneheaders; + $scope.fromZonechoices.push({'id':'choice'+1, 'option': key}); + } + } + + var toZoneheaders = message.termListDictionaryData.toZone; + var splitToZone = ','; + if(toZoneheaders != null){ + if (toZoneheaders.indexOf(splitToZone) >= 0) { + var splitToZoneValue = toZoneheaders.split(splitToZone); + for(i = 0; i < splitToZoneValue.length; i++){ + var key = splitToZoneValue[i]; + $scope.toZonechoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = toZoneheaders; + $scope.toZonechoices.push({'id':'choice'+1, 'option': key}); + } + } + + var srcIPheaders = message.termListDictionaryData.srcIPList; + var splitSrcIP = ','; + if(srcIPheaders != null){ + if (srcIPheaders.indexOf(splitSrcIP) >= 0) { + var splitSrcIPValue = srcIPheaders.split(splitSrcIP); + for(i = 0; i < splitSrcIPValue.length; i++){ + var key = splitSrcIPValue[i]; + $scope.sourceListchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = srcIPheaders; + $scope.sourceListchoices.push({'id':'choice'+1, 'option': key}); + } + } + + var desIPheaders = message.termListDictionaryData.destIPList; + var splitDesIP = ','; + if(desIPheaders != null){ + if (desIPheaders.indexOf(splitDesIP) >= 0) { + var splitDestIPValue = desIPheaders.split(splitDesIP); + for(i = 0; i < splitDestIPValue.length; i++){ + var key = splitDestIPValue[i]; + $scope.destinationListchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = desIPheaders; + $scope.destinationListchoices.push({'id':'choice'+1, 'option': key}); + } + } + + var srcServheaders = message.termListDictionaryData.srcPortList; + var splitSrcServ = ','; + if(srcServheaders != null){ + if (srcServheaders.indexOf(splitSrcServ) >= 0) { + var splitSrcServValue = srcServheaders.split(splitSrcServ); + for(i = 0; i < splitSrcServValue.length; i++){ + var key = splitSrcServValue[i]; + $scope.sourceServicechoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = srcServheaders; + $scope.sourceServicechoices.push({'id':'choice'+1, 'option': key}); + } + } + + var desServheaders = message.termListDictionaryData.destPortList; + var splitdesSer = ','; + if(desServheaders != null){ + if (desServheaders.indexOf(splitdesSer) >= 0) { + var splitDesSerValue = desServheaders.split(splitdesSer); + for(i = 0; i < splitDesSerValue.length; i++){ + var key = splitDesSerValue[i]; + $scope.destinationServicechoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = desServheaders; + $scope.destinationServicechoices.push({'id':'choice'+1, 'option': key}); + } + } + + var actionheaders = message.termListDictionaryData.action; + var splitAction = ','; + if(actionheaders != null){ + if (actionheaders.indexOf(splitAction) >= 0) { + var splitActionValue = actionheaders.split(splitAction); + for(i = 0; i < splitActionValue.length; i++){ + var key = splitActionValue[i]; + $scope.actionListchoices.push({'id':'choice'+i+1, 'option': key}); + } + }else{ + var key = actionheaders; + $scope.actionListchoices.push({'id':'choice'+1, 'option': key}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getPrefixListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.prefixListDictionaryDatas = JSON.parse($scope.data.prefixListDictionaryDatas); + console.log($scope.prefixListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getZoneDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.zoneDictionaryDatas = JSON.parse($scope.data.zoneDictionaryDatas); + console.log($scope.zoneDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getAddressGroupDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.addressGroupDictionaryDatas = JSON.parse($scope.data.addressGroupDictionaryDatas); + console.log($scope.addressGroupDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getServiceListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.serviceListDictionaryDatas = JSON.parse($scope.data.serviceListDictionaryDatas); + console.log($scope.serviceListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getServiceGroupDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.serviceGroupDictionaryDatas = JSON.parse($scope.data.serviceGroupDictionaryDatas); + console.log($scope.serviceGroupDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getActionListDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.actionListDictionaryDatas = JSON.parse($scope.data.actionListDictionaryDatas); + console.log($scope.actionListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editTermList = message.termListDictionaryData; + + $scope.saveTermName = function(termListDictionaryData) { + var mergeFromZoneData = extend(termListDictionaryData, $scope.fromZoneDatas[0]); + var mergeToData = extend(mergeFromZoneData, $scope.toZoneDatas[0]); + var mergeSourceListData = extend(mergeToData, $scope.sourceListDatas[0]); + var mergeDListData = extend(mergeSourceListData, $scope.destinationListDatas[0]); + var mergeSServicesData = extend(mergeDListData, $scope.sourceServicesDatas[0]); + var mergeDServicesData = extend(mergeSServicesData, $scope.destinationServicesDatas[0]); + var finalData = extend(mergeDServicesData, $scope.actionListDatas[0]); + var uuu = papUrl + "/ecomp/fw_dictionary/save_termList.htm"; + var postData={termListDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.termListDictionaryDatas=data.termListDictionaryDatas;}); + if($scope.termListDictionaryDatas == "Duplicate"){ + Notification.error("FW TermList Dictionary exists with Same Term Name.") + }else{ + console.log($scope.termListDictionaryDatas); + $modalInstance.close({termListDictionaryDatas:$scope.termListDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.fromZoneDatas = [{"fromZoneDatas" : $scope.fromZonechoices}]; + $scope.addFromZoneNewChoice = function() { + var newItemNo = $scope.fromZonechoices.length+1; + $scope.fromZonechoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeFromZoneChoice = function() { + var lastItem = $scope.fromZonechoices.length-1; + $scope.fromZonechoices.splice(lastItem); + }; + + $scope.toZoneDatas = [{"toZoneDatas" : $scope.toZonechoices}]; + $scope.addToZoneNewChoice = function() { + var newItemNo = $scope.toZonechoices.length+1; + $scope.toZonechoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeToZoneChoice = function() { + var lastItem = $scope.toZonechoices.length-1; + $scope.toZonechoices.splice(lastItem); + }; + + $scope.sourceListDatas = [{"sourceListDatas" : $scope.sourceListchoices}]; + $scope.addSourceListNewChoice = function() { + var newItemNo = $scope.sourceListchoices.length+1; + $scope.sourceListchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeSourceListChoice = function() { + var lastItem = $scope.sourceListchoices.length-1; + $scope.sourceListchoices.splice(lastItem); + }; + + $scope.destinationListDatas = [{"destinationListDatas" : $scope.destinationListchoices}]; + $scope.addDListNewChoice = function() { + var newItemNo = $scope.destinationListchoices.length+1; + $scope.destinationListchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeDlistChoice = function() { + var lastItem = $scope.destinationListchoices.length-1; + $scope.destinationListchoices.splice(lastItem); + }; + + $scope.sourceServicesDatas = [{"sourceServiceDatas" : $scope.sourceServicechoices}]; + $scope.addSourceServiceNewChoice = function() { + var newItemNo = $scope.sourceServicechoices.length+1; + $scope.sourceServicechoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeSourceServiceChoice = function() { + var lastItem = $scope.sourceServicechoices.length-1; + $scope.sourceServicechoices.splice(lastItem); + }; + + $scope.destinationServicesDatas = [{"destinationServiceDatas" : $scope.destinationServicechoices}]; + $scope.addDServicesNewChoice = function() { + var newItemNo = $scope.destinationServicechoices.length+1; + $scope.destinationServicechoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeDServicesChoice = function() { + var lastItem = $scope.destinationServicechoices.length-1; + $scope.destinationServicechoices.splice(lastItem); + }; + + $scope.actionListDatas = [{"actionListDatas" : $scope.actionListchoices}]; + $scope.addActionListNewChoice = function() { + var newItemNo = $scope.actionListchoices.length+1; + $scope.actionListchoices.push({'id':'choice'+newItemNo}); + }; + $scope.removeActionListChoice = function() { + var lastItem = $scope.actionListchoices.length-1; + $scope.actionListchoices.splice(lastItem); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWZoneDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWZoneDictController.js new file mode 100644 index 000000000..8780ddd35 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/FWZoneDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editFWZoneController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.zoneDictionaryData==null) + $scope.label='Add Zone Name' + else{ + $scope.label='Edit Zone Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editZoneName = message.zoneDictionaryData; + + $scope.saveZoneName = function(zoneDictionaryData) { + var uuu = papUrl + "/ecomp/fw_dictionary/save_zoneName.htm"; + var postData={zoneDictionaryData: zoneDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.zoneDictionaryDatas=data.zoneDictionaryDatas;}); + if($scope.zoneDictionaryDatas == "Duplicate"){ + Notification.error("FW Zone Dictionary exists with Same Zone Name.") + }else{ + console.log($scope.zoneDictionaryDatas); + $modalInstance.close({zoneDictionaryDatas:$scope.zoneDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js new file mode 100644 index 000000000..d96a62ad8 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editMSConfigController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.microServiceCongigNameDictionaryData==null) + $scope.label='Add Config Name' + else{ + $scope.label='Edit Config Name' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editMSConfig = message.microServiceCongigNameDictionaryData; + + $scope.saveMSConfig = function(microServiceCongigNameDictionaryData) { + var uuu = papUrl + "/ecomp/ms_dictionary/save_configName.htm"; + var postData={microServiceCongigNameDictionaryData: microServiceCongigNameDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.microServiceCongigNameDictionaryDatas=data.microServiceCongigNameDictionaryDatas;}); + if($scope.microServiceCongigNameDictionaryDatas == "Duplicate"){ + Notification.error("MS ConfigName Dictionary exists with Same Config Name.") + }else{ + console.log($scope.microServiceCongigNameDictionaryDatas); + $modalInstance.close({microServiceCongigNameDictionaryDatas:$scope.microServiceCongigNameDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSDcaeUUIDDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSDcaeUUIDDictController.js new file mode 100644 index 000000000..c08dbbe22 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSDcaeUUIDDictController.js @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editDCAEuuidController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.dcaeUUIDDictionaryData==null) + $scope.label='Add Micro Service UUID' + else{ + $scope.label='Edit Micro Service UUID' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editDCAEuuid = message.dcaeUUIDDictionaryData; + + $scope.saveDCAEUUID = function(dcaeUUIDDictionaryData) { + var uuu = papUrl + "/ecomp/ms_dictionary/save_dcaeUUID.htm"; + var postData={dcaeUUIDDictionaryData: dcaeUUIDDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.dcaeUUIDDictionaryDatas=data.dcaeUUIDDictionaryDatas;}); + if($scope.dcaeUUIDDictionaryDatas == "Duplicate"){ + Notification.error("MS DCAEUUID Dictionary exists with Same DCAEUUID Name.") + }else{ + console.log($scope.dcaeUUIDDictionaryDatas); + $modalInstance.close({dcaeUUIDDictionaryDatas:$scope.dcaeUUIDDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSLocationDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSLocationDictController.js new file mode 100644 index 000000000..001f635a9 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSLocationDictController.js @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editMSLocationController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.microServiceLocationDictionaryData==null) + $scope.label='Add Micro Service Location' + else{ + $scope.label='Edit Micro Service Location' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editMSLocation = message.microServiceLocationDictionaryData; + + $scope.saveMSLocation = function(microServiceLocationDictionaryData) { + var uuu = papUrl + "/ecomp/ms_dictionary/save_location.htm"; + var postData={microServiceLocationDictionaryData: microServiceLocationDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.microServiceLocationDictionaryDatas=data.microServiceLocationDictionaryDatas;}); + if($scope.microServiceLocationDictionaryDatas == "Duplicate"){ + Notification.error("MS Location Dictionary exists with Same Location Name.") + }else{ + console.log($scope.microServiceLocationDictionaryDatas); + $modalInstance.close({microServiceLocationDictionaryDatas:$scope.microServiceLocationDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js new file mode 100644 index 000000000..101f2c1c9 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js @@ -0,0 +1,87 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editMSModelController = function ($scope, $modalInstance, message, $http, PapUrlService, UserInfoService, Notification){ + if(message.microServiceModelsDictionaryData==null) + $scope.label='Add Micro Service Model' + else{ + $scope.label='Edit Micro Service Model' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editMSmodelName = message.microServiceModelsDictionaryData; + + $scope.uploadFile = function(files) { + var fd = new FormData(); + fd.append("file", files[0]); + $http.post(papUrl + "/ecomp/ms_dictionary/set_MSModelData.htm", fd, { + withCredentials: false, + headers: {'Content-Type': undefined }, + transformRequest: angular.identity + }).success().error( ); + + }; + + $scope.saveMSModel = function(microServiceModelsDictionaryData) { + var uuu = papUrl + "/ecomp/ms_dictionary/save_model.htm"; + var postData={microServiceModelsDictionaryData: microServiceModelsDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.microServiceModelsDictionaryDatas=data.microServiceModelsDictionaryDatas;}); + if($scope.microServiceModelsDictionaryDatas == "Duplicate"){ + Notification.error("MS Models Dictionary exists with Same Model Name.") + }else{ + console.log($scope.microServiceModelsDictionaryDatas); + $modalInstance.close({microServiceModelsDictionaryDatas:$scope.microServiceModelsDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSClosedLoopDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSClosedLoopDictController.js new file mode 100644 index 000000000..6986209cd --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSClosedLoopDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPSClosedLoopController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.psClosedLoopDictionaryData==null) + $scope.label='Add New Policy Scope ClosedLoop' + else{ + $scope.label='Edit Policy Scope ClosedLoop' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPSClosedLoop = message.psClosedLoopDictionaryData; + + $scope.savePSClosedLoop = function(psClosedLoopDictionaryData) { + var uuu = papUrl + "/ecomp/ps_dictionary/save_psClosedLoop.htm"; + var postData={psClosedLoopDictionaryData: psClosedLoopDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.psClosedLoopDictionaryDatas=data.psClosedLoopDictionaryDatas;}); + if($scope.psClosedLoopDictionaryDatas == "Duplicate"){ + Notification.error("ClosedLoop Dictionary exists with Same ClosedLoop Name.") + }else{ + console.log($scope.psClosedLoopDictionaryDatas); + $modalInstance.close({psClosedLoopDictionaryDatas:$scope.psClosedLoopDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js new file mode 100644 index 000000000..ec1c575df --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPSGroupPolicyScopeController = function ($scope, $modalInstance, message, PolicyScopeService, PapUrlService, UserInfoService, Notification){ + $scope.edit = false; + if(message.groupPolicyScopeListData==null) + $scope.label='Add New Group Policy Scope' + else{ + $scope.label='Edit Group Policy Scope' + $scope.disableCd=true; + $scope.edit = true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + PolicyScopeService.getPSServiceDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psServiceDictionaryDatas = JSON.parse($scope.data.psServiceDictionaryDatas); + console.log($scope.psServiceDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyScopeService.getPSTypeDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psTypeDictionaryDatas = JSON.parse($scope.data.psTypeDictionaryDatas); + console.log($scope.psTypeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyScopeService.getPSResourceDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psResourceDictionaryDatas = JSON.parse($scope.data.psResourceDictionaryDatas); + console.log($scope.psResourceDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyScopeService.getPSClosedLoopDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psClosedLoopDictionaryDatas = JSON.parse($scope.data.psClosedLoopDictionaryDatas); + console.log($scope.psClosedLoopDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPSGroupPolicyScope = message.groupPolicyScopeListData; + $scope.editPSGroupPolicyScope1 = {resource: [], type:[], service: [], closedloop: []}; + if($scope.edit){ + if(message.groupPolicyScopeListData.groupList != null){ + var splitValue = message.groupPolicyScopeListData.groupList.split(","); + console.log(splitValue); + $scope.splittedGroupListValues = []; + var splitResource = splitValue[0].split("="); + $scope.editPSGroupPolicyScope1.resource.push(splitResource[1]); + var splitType = splitValue[1].split("="); + $scope.editPSGroupPolicyScope1.type.push(splitType[1]); + var splitService = splitValue[2].split("="); + $scope.editPSGroupPolicyScope1.service.push(splitService[1]); + var splitCloop = splitValue[3].split("="); + $scope.editPSGroupPolicyScope1.closedloop.push(splitCloop[1]); + } + } + + $scope.savePSGroupPolicyScope = function(groupPolicyScopeListData, groupPolicyScopeListData1) { + console.log(groupPolicyScopeListData1); + var uuu = papUrl + "/ecomp/ps_dictionary/save_psGroupPolicyScope.htm"; + var postData={groupPolicyScopeListData: groupPolicyScopeListData, + groupPolicyScopeListData1: groupPolicyScopeListData1, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.groupPolicyScopeListDatas=data.groupPolicyScopeListDatas;}); + if($scope.groupPolicyScopeListDatas == "Duplicate"){ + Notification.error("GroupPolicyScope Dictionary exists with Same Group Name.") + }else if($scope.groupPolicyScopeListDatas == "DuplicateGroup"){ + Notification.error("GroupPolicyScope Dictionary exists with Same Group List.") + }else{ + console.log($scope.groupPolicyScopeListDatas); + $modalInstance.close({groupPolicyScopeListDatas:$scope.groupPolicyScopeListDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSResourceDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSResourceDictController.js new file mode 100644 index 000000000..7aaf21834 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSResourceDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPSResourceController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.psResourceDictionaryData==null) + $scope.label='Add New Resource' + else{ + $scope.label='Edit Resource' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPSResource = message.psResourceDictionaryData; + + $scope.savePSResource = function(psResourceDictionaryData) { + var uuu = papUrl + "/ecomp/ps_dictionary/save_psResource.htm"; + var postData={psResourceDictionaryData: psResourceDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.psResourceDictionaryDatas=data.psResourceDictionaryDatas;}); + if($scope.psResourceDictionaryDatas == "Duplicate"){ + Notification.error("Resource Dictionary exists with Same Resource Name.") + }else{ + console.log($scope.psResourceDictionaryDatas); + $modalInstance.close({psResourceDictionaryDatas:$scope.psResourceDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSServiceDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSServiceDictController.js new file mode 100644 index 000000000..5cccf30ad --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSServiceDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPSServiceController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.psServiceDictionaryData==null) + $scope.label='Add New Service' + else{ + $scope.label='Edit Service' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPSService = message.psServiceDictionaryData; + + $scope.savePSService = function(psServiceDictionaryData) { + var uuu = papUrl + "/ecomp/ps_dictionary/save_psService.htm"; + var postData={psServiceDictionaryData: psServiceDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.psServiceDictionaryDatas=data.psServiceDictionaryDatas;}); + if($scope.psServiceDictionaryDatas == "Duplicate"){ + Notification.error("Service Dictionary exists with Same Service Name.") + }else{ + console.log($scope.psServiceDictionaryDatas); + $modalInstance.close({psServiceDictionaryDatas:$scope.psServiceDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSTypeDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSTypeDictController.js new file mode 100644 index 000000000..b3d5b833b --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/PSTypeDictController.js @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editPSTypeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.psTypeDictionaryData==null) + $scope.label='Add New Type' + else{ + $scope.label='Edit Type' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editPSType = message.psTypeDictionaryData; + + $scope.savePSType = function(psTypeDictionaryData) { + var uuu = papUrl + "/ecomp/ps_dictionary/save_psType.htm"; + var postData={psTypeDictionaryData: psTypeDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.psTypeDictionaryDatas=data.psTypeDictionaryDatas;}); + console.log($scope.psTypeDictionaryDatas); + if($scope.psTypeDictionaryDatas == "Duplicate"){ + Notification.error("Type Dictionary exists with Same Type Name.") + }else{ + console.log($scope.psTypeDictionaryDatas); + $modalInstance.close({psTypeDictionaryDatas:$scope.psTypeDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/RiskTypeDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/RiskTypeDictController.js new file mode 100644 index 000000000..9df0d4771 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/RiskTypeDictController.js @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editRiskTypeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.riskTypeDictionaryData==null) + $scope.label='Add New Type' + else{ + $scope.label='Edit Type' + $scope.disableCd=true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editRiskType = message.riskTypeDictionaryData; + + $scope.saveRiskType = function(riskTypeDictionaryData) { + var uuu = papUrl + "/ecomp/sp_dictionary/save_riskType.htm"; + var postData={riskTypeDictionaryData: riskTypeDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.riskTypeDictionaryDatas=data.riskTypeDictionaryDatas;}); + if($scope.riskTypeDictionaryDatas == "Duplicate"){ + Notification.error("Risk type Dictionary exists with Same RiskType Name.") + }else{ + console.log($scope.riskTypeDictionaryDatas); + $modalInstance.close({riskTypeDictionaryDatas:$scope.riskTypeDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/SafePolicyWarningDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/SafePolicyWarningDictController.js new file mode 100644 index 000000000..4fe700768 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/SafePolicyWarningDictController.js @@ -0,0 +1,107 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editSafePolicyWarningController = function ($scope, $modalInstance, message, SafePolicyService, PapUrlService, UserInfoService, Notification){ + $scope.edit = false; + if(message.safePolicyWarningData==null) + $scope.label='Add New Safe Policy Warning' + else{ + $scope.label='Edit Safe Policy Warning' + $scope.disableCd=true; + $scope.edit = true; + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + SafePolicyService.getSafePolicyWarningDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.safePolicyWarningDatas = JSON.parse($scope.data.safePolicyWarningDatas); + console.log($scope.safePolicyWarningDatas); + }, function (error) { + console.log("failed"); + }); + SafePolicyService.getRiskTypeDictionaryDataByName(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas); + console.log($scope.riskTypeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editSafePolicyWarning = message.safePolicyWarningData; + $scope.editSafePolicyWarning1 = {resource: [], type:[], service: [], closedloop: []}; + if($scope.edit){ + if(message.safePolicyWarningData.groupList != null){ + var splitValue = message.safePolicyWarningData.groupList.split(","); + console.log(splitValue); + $scope.splittedGroupListValues = []; + var splitResource = splitValue[0].split("="); + $scope.editSafePolicyWarningScope1.riskType.push(splitResource[1]); + } + } + + $scope.saveSafePolicyWarning = function(safePolicyWarningData) { + console.log(safePolicyWarningData); + var uuu = papUrl + "/ecomp/sp_dictionary/save_safePolicyWarning.htm"; + var postData={safePolicyWarningData: safePolicyWarningData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.safePolicyWarningDatas=data.safePolicyWarningDatas;}); + if($scope.safePolicyWarningDatas == "Duplicate"){ + Notification.error("Safe Policy Dictionary exists with Same Name.") + }else{ + console.log($scope.safePolicyWarningDatas); + $modalInstance.close({safePolicyWarningDatas:$scope.safePolicyWarningDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/actionPolicyDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/actionPolicyDictController.js new file mode 100644 index 000000000..b889a98cb --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/actionPolicyDictController.js @@ -0,0 +1,119 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editActionPolicyDictController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.actionPolicyDictionaryData==null) + $scope.label='Add Action Dictionary', + $scope.choices = []; + else{ + $scope.choices = []; + $scope.label='Edit Action Dictionary' + $scope.disableCd=true; + var headers = message.actionPolicyDictionaryData.header; + var SplitChars = ':'; + if (headers.indexOf(SplitChars) >= 0) { + var splitHeader = headers.split(SplitChars); + var singleHeader = splitHeader; + var splitEqual = '='; + for(i = 0; i < singleHeader.length; i++){ + if (singleHeader[i].indexOf(splitEqual) >= 0) { + var splitValue = singleHeader[i].split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo, 'option': key , 'number' : value }); + } + } + }else{ + var splitEqual = '='; + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + var key = splitValue[0]; + var value = splitValue[1]; + $scope.choices.push({'id':'choice'+1, 'option': key , 'number' : value }); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editActionDict = message.actionPolicyDictionaryData; + $scope.saveActionDict = function(actionPolicyDictionaryData) { + var finalData = extend(actionPolicyDictionaryData, $scope.headerDatas[0]); + var uuu = papUrl + "/ecomp/action_dictionary/save_ActionDict.htm"; + var postData={actionPolicyDictionaryData: finalData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.actionPolicyDictionaryDatas=data.actionPolicyDictionaryDatas;}); + if($scope.actionPolicyDictionaryDatas == "Duplicate"){ + Notification.error("ActionPolicy Dictionary exists with Same Attribute Name.") + }else{ + console.log($scope.actionPolicyDictionaryDatas); + $modalInstance.close({actionPolicyDictionaryDatas:$scope.actionPolicyDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.headerDatas = [{"headers" : $scope.choices}]; + $scope.addNewChoice = function() { + var newItemNo = $scope.choices.length+1; + $scope.choices.push({'id':'choice'+newItemNo}); + }; + $scope.removeChoice = function() { + var lastItem = $scope.choices.length-1; + $scope.choices.splice(lastItem); + }; + +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js new file mode 100644 index 000000000..9e32f0304 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editAttributeController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.attributeDictionaryData==null) + $scope.label='Add New Attribute', + $scope.attributes = []; + else{ + $scope.attributes = []; + $scope.label='Edit Attribute' + $scope.disableCd=true; + var headers = message.attributeDictionaryData.attributeValue; + var splitEqual = ','; + if(headers != null){ + if (headers.indexOf(splitEqual) >= 0) { + var splitValue = headers.split(splitEqual); + for(i = 0; i < splitValue.length; i++){ + var key = splitValue[i]; + $scope.attributes.push({'id':'choice'+i+1, 'attributeValues': key}); + } + }else{ + var key = headers; + $scope.attributes.push({'id':'choice'+1, 'attributeValues': key}); + } + } + } + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl) + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.editAttributeName = message.attributeDictionaryData; + + $scope.saveAttributeName = function(attributeDictionaryData) { + var finalData = extend(attributeDictionaryData, $scope.attributeDatas[0]); + var uuu = papUrl + "/ecomp/attribute_dictionary/save_attribute.htm"; + var postData={attributeDictionaryData: attributeDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.attributeDictionaryDatas=data.attributeDictionaryDatas;}); + if($scope.attributeDictionaryDatas == "Duplicate"){ + Notification.error("Attribute Dictionary exists with Same Attribute Name.") + }else{ + console.log($scope.attributeDictionaryDatas); + $modalInstance.close({attributeDictionaryDatas:$scope.attributeDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + function extend(obj, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) obj[key] = src[key]; + } + return obj; + } + + $scope.attributeDatas = [{"userDataTypeValues" : $scope.attributes}]; + $scope.addNewChoice = function() { + var newItemNo = $scope.attributes.length+1; + $scope.attributes.push({'id':'choice'+newItemNo}); + }; + $scope.removeChoice = function() { + var lastItem = $scope.attributes.length-1; + $scope.attributes.splice(lastItem); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/ecompNameEditorController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/ecompNameEditorController.js new file mode 100644 index 000000000..5dd19a7fc --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryController/ecompNameEditorController.js @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +var editEcompNameController = function ($scope, $modalInstance, message, PapUrlService, UserInfoService, Notification){ + if(message.ecompNameDictionaryData==null) + $scope.label='Add New Ecomp Name' + else{ + $scope.label='Edit Ecomp Name' + $scope.disableCd=true; + } + $scope.editEcompName = message.ecompNameDictionaryData; + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + }); + + /*getting user info from session*/ + var loginId = null; + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + loginId = response.userid; + }); + + $scope.saveEcompName = function(ecompNameDictionaryData) { + var uuu = papUrl + "/ecomp/ecomp_dictionary/save_ecompName.htm"; + var postData={ecompNameDictionaryData: ecompNameDictionaryData, loginId: loginId}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.ecompNameDictionaryDatas=data.ecompNameDictionaryDatas;}); + if($scope.ecompNameDictionaryDatas == "Duplicate"){ + Notification.error("EcompName Dictionary exists with Same Ecomp Name.") + }else{ + console.log($scope.ecompNameDictionaryDatas); + $modalInstance.close({ecompNameDictionaryDatas:$scope.ecompNameDictionaryDatas}); + } + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js new file mode 100644 index 000000000..642fca248 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.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('brmsParamDictGridController', function ($scope, DictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + DictionaryService.getBRMSParamDictionaryData(papUrl).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"); + }); + + }); + + $scope.brmsParamDictionaryGrid = { + data : 'brmsParamDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'BRMSParamDictionary.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewBRMSParamWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteBRMSParam(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'ruleName', displayName : 'Rule Name'}, + { field: 'description'}, + {field: 'userCreatedBy.userName', displayName : 'Created By'}, + {field: 'createdDate',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; + }, + 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) { + modalService.popupConfirmWin("Confirm","You are about to delete the BRMS Param Name "+data.ruleName+". \n Do you want to continue?", + function(){ + var uuu = papUrl + "/ecomp/brms_dictionary/remove_brmsParam.htm"; + 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); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js new file mode 100644 index 000000000..5600ed16b --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.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========================================================= + */ + +/** + */ +app.controller('pepOptionsDictGridController', function ($scope, PapUrlService, CLDictionaryService,modalService, $modal){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + CLDictionaryService.getPepOptionsDictionaryData(papUrl).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"); + }); + + }); + + $scope.pepOptionsDictionaryGrid = { + data : 'pepOptionsDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'PEPOptions.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewPEPOptionsWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPEPOptionsWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePEPOptions(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'pepName', displayName : 'PEP Name'}, + { 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\'' } + ], + 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.htm"; + 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 = papUrl + "/ecomp/cl_dictionary/remove_pepOptions.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js new file mode 100644 index 000000000..8f5893da9 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js @@ -0,0 +1,161 @@ +/*- + * ============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, PapUrlService, CLDictionaryService,modalService, $modal){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + CLDictionaryService.getServiceDictionaryData(papUrl).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"); + }); + + }); + + $scope.serviceDictionaryGrid = { + data : 'closedLoopServiceDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewServiceDictWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editServiceDictWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteServiceDict(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'serviceName', displayName : 'Service Name'}, + { 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.htm"; + 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 = papUrl + "/ecomp/cl_dictionary/remove_Service.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js new file mode 100644 index 000000000..0a0e72a7f --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js @@ -0,0 +1,161 @@ +/*- + * ============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, PapUrlService, CLDictionaryService,modalService, $modal){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + CLDictionaryService.getSiteDictionaryData(papUrl).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"); + }); + + }); + + $scope.siteDictionaryGrid = { + data : 'closedLoopSiteDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewSiteDictWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editSiteDictWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteSiteDict(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'siteName', displayName : 'Site Name'}, + { 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.htm"; + 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 = papUrl + "/ecomp/cl_dictionary/remove_site.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js new file mode 100644 index 000000000..87ccac953 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js @@ -0,0 +1,184 @@ +/*- + * ============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, PapUrlService, CLDictionaryService,modalService, $modal){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + CLDictionaryService.getVarbindDictionaryData(papUrl).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"); + }); + + }); + + $scope.varbindDictionaryGrid = { + data : 'varbindDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'VarbindDictionary.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewVarbindDictWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editVarbindDictWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteVarbindDictionary(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'varbindName', displayName : 'Varbind Name'}, + { 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\'' } + ], + 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.htm"; + 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 = papUrl + "/ecomp/cl_dictionary/remove_varbindDict.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js new file mode 100644 index 000000000..4e5f27ca4 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js @@ -0,0 +1,181 @@ +/*- + * ============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, PapUrlService, CLDictionaryService,modalService, $modal){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + CLDictionaryService.getVnfTypeDictionaryData(papUrl).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"); + }); + + }); + + $scope.vnfTypeDictionaryGrid = { + data : 'vnfTypeDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'VNFType.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewVnfTypeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editVnfTypeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteVnfType(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'vnftype', displayName : 'VNF Type'}, + { 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; + }, + 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.htm"; + 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 = papUrl + "/ecomp/cl_dictionary/remove_vnfType.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js new file mode 100644 index 000000000..1ff52f203 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.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========================================================= + */ + +/** + */ +app.controller('vsclActionDictGridController', function ($scope, PapUrlService, CLDictionaryService,modalService, $modal){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + CLDictionaryService.getVSCLActionDictionaryData(papUrl).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"); + }); + + }); + + $scope.vsclActionDictionaryGrid = { + data : 'vsclActionDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'VSCLAction.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createvsclActionWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editvsclActionWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletevsclAction(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'vsclaction', displayName : 'VSCL Action'}, + { 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; + }, + 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.htm"; + 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 = papUrl + "/ecomp/cl_dictionary/remove_VsclAction.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js new file mode 100644 index 000000000..8a81853a6 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.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('decisionSettingsDictGridController', function ($scope, DictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + DictionaryService.getDecisionSettingsDictionaryData(papUrl).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"); + }); + + }); + + $scope.decisionSettingsDictionaryGrid = { + data : 'settingsDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'Settings.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewSettingsDictWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editSettingsDictWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteSettingsDict(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'xacmlId', displayName : 'Settings ID'}, + { 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\'' } + ], + 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 = papUrl + "/ecomp/settings_dictionary/remove_settings.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js new file mode 100644 index 000000000..b35a28de2 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.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('descriptiveDictGridController', function ($scope, DictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + DictionaryService.getDescriptiveDictionaryData(papUrl).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"); + }); + + }); + + $scope.descriptiveDictionaryGrid = { + data : 'descriptiveScopeDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'SearchCriteria.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewDescriptiveScopeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editDescriptiveScopeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteDescriptiveScope(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'scopeName', displayName : 'Descriptive Scope Name'}, + { 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\'' } + ], + 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 = papUrl + "/ecomp/descriptive_dictionary/remove_descriptiveScope.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/EnforcerTypeDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/EnforcerTypeDictGridController.js new file mode 100644 index 000000000..d5fceb8d6 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/EnforcerTypeDictGridController.js @@ -0,0 +1,126 @@ +/*- + * ============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, DictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + + DictionaryService.getEnforcerDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.enforcerDictionaryDatas = JSON.parse($scope.data.enforcerDictionaryDatas); + console.log($scope.enforcerDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + }); + + $scope.enforcerDictionaryGrid = { + data : 'enforcerDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewEnforcerTypeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editEnforcerTypeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteEnforcerType(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'enforcingType', displayName : 'Enforcing Type'}, + { 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 = papUrl + "/ecomp/enforcer_dictionary/remove_enforcer.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWActionListDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWActionListDictGridController.js new file mode 100644 index 000000000..6f8c0aad5 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWActionListDictGridController.js @@ -0,0 +1,145 @@ +/*- + * ============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, FWDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getActionListDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.actionListDictionaryDatas = JSON.parse($scope.data.actionListDictionaryDatas); + console.log($scope.actionListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + }); + + $scope.actionListDictionaryGrid = { + data : 'actionListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'ActionList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWActionListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWActionListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWActionList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'actionName', displayName : 'Action Name'}, + { field: 'description' } + ], + 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 = papUrl + "/ecomp/fw_dictionary/remove_ActionList.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWAddressGroupDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWAddressGroupDictGridController.js new file mode 100644 index 000000000..4220a7c6d --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWAddressGroupDictGridController.js @@ -0,0 +1,146 @@ +/*- + * ============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, FWDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getAddressGroupDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.addressGroupDictionaryDatas = JSON.parse($scope.data.addressGroupDictionaryDatas); + console.log($scope.addressGroupDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + $scope.addressGroupDictionaryGrid = { + data : 'addressGroupDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'AddressGroup.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWAddressGroupWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWAddressGroupWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWAddressGroup(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'groupName', displayName : 'Group Name'}, + { field: 'prefixList', displayName : 'Prefix List' }, + { field: 'description' } + ], + 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 = papUrl + "/ecomp/fw_dictionary/remove_AddressGroup.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js new file mode 100644 index 000000000..a4fc959f6 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js @@ -0,0 +1,149 @@ +/*- + * ============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, FWDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getParentListDictionaryData(papUrl).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"); + }); + }); + + + + $scope.parentDictionaryGrid = { + data : 'fwDictListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'ParentList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWParentListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWParentListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWParentList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'parentItemName', displayName : 'Parent Name'}, + { field: 'description', displayName : 'Description' }, + { field: 'addressList', displayName : 'Address List' }, + { field: 'serviceList', displayName : 'Service List' } + ], + 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 = papUrl + "/ecomp/fw_dictionary/remove_FWDictionaryList.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPortListDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPortListDictGridController.js new file mode 100644 index 000000000..647b97a80 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPortListDictGridController.js @@ -0,0 +1,132 @@ +/*- + * ============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, FWDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getPortListDictionaryData(papUrl).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"); + }); + + FWDictionaryService.getPortListDictionaryData(papUrl).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"); + }); + }); + + $scope.portListDictionaryGrid = { + data : 'portListDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWPortListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWPortListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWPortList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'portName', displayName : 'Port Name'}, + { 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 = papUrl + "/ecomp/fw_dictionary/remove_PortList.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPrefixListDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPrefixListDictGridController.js new file mode 100644 index 000000000..09f3f3eb4 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWPrefixListDictGridController.js @@ -0,0 +1,148 @@ +/*- + * ============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, FWDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getPrefixListDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.prefixListDictionaryDatas = JSON.parse($scope.data.prefixListDictionaryDatas); + console.log($scope.prefixListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + }); + + $scope.prefixListDictionaryGrid = { + data : 'prefixListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'PrefixList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWPrefixListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWPrefixListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWPrefixList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'prefixListName', displayName : 'PrefixList Name'}, + { field: 'description' }, + {field: 'prefixListValue', displayName : 'PrefixList Value' } + ], + 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 = papUrl + "/ecomp/fw_dictionary/remove_PrefixList.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWProtocolListDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWProtocolListDictGridController.js new file mode 100644 index 000000000..e31d0757b --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWProtocolListDictGridController.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('protocolListDictGridController', function ($scope, FWDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getProtocolListDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.protocolListDictionaryDatas = JSON.parse($scope.data.protocolListDictionaryDatas); + console.log($scope.protocolListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getProtocolListDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.protocolListDictionaryDatas = JSON.parse($scope.data.protocolListDictionaryDatas); + console.log($scope.protocolListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + }); + + $scope.protocolListDictionaryGrid = { + data : 'protocolListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'ProtocolList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWProtocolListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWProtocolListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWProtocolList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'protocolName', displayName : 'Protocol Name'}, + { field: 'description' } + ], + 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 = papUrl + "/ecomp/fw_dictionary/remove_protocol.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWSecurityZoneDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWSecurityZoneDictGridController.js new file mode 100644 index 000000000..7f1367924 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWSecurityZoneDictGridController.js @@ -0,0 +1,147 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +app.controller('securityZoneDictGridController', function ($scope, FWDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getSecurityZoneDictionaryData(papUrl).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"); + }); + + }); + + + $scope.securityZoneDictionaryGrid = { + data : 'securityZoneDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'SecurityZone.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWSecurityZoneWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWSecurityZoneWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWSecurityZone(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'zoneName', displayName : 'Zone Name'}, + { field: 'zoneValue', displayName : 'Zone Value' } + ], + 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 = papUrl + "/ecomp/fw_dictionary/remove_securityZone.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceGroupDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceGroupDictGridController.js new file mode 100644 index 000000000..fd6bba456 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceGroupDictGridController.js @@ -0,0 +1,147 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + */ +app.controller('serviceGroupDictGridController', function ($scope, FWDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getServiceGroupDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.serviceGroupDictionaryDatas = JSON.parse($scope.data.serviceGroupDictionaryDatas); + console.log($scope.serviceGroupDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + + + $scope.serviceGroupDictionaryGrid = { + data : 'serviceGroupDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'ServiceGroup.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWServiceGroupWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWServiceGroupWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWServiceGroup(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'groupName', displayName : 'Group Name'}, + { field: 'serviceList', displayName : 'Service List' } + ], + 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 = papUrl + "/ecomp/fw_dictionary/remove_serviceGroup.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceListDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceListDictGridController.js new file mode 100644 index 000000000..1b56240fd --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWServiceListDictGridController.js @@ -0,0 +1,162 @@ +/*- + * ============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, FWDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getServiceListDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.serviceListDictionaryDatas = JSON.parse($scope.data.serviceListDictionaryDatas); + console.log($scope.serviceListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + FWDictionaryService.getProtocolListDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.protocolListDictionaryDatas = JSON.parse($scope.data.protocolListDictionaryDatas); + console.log($scope.protocolListDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + }); + + + + $scope.serviceListDictionaryGrid = { + data : 'serviceListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'ServiceList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWServiceListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWServiceListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWServiceList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'serviceName', displayName : 'Service Name'}, + { field: 'serviceDescription' , displayName : 'Description'}, + {field: 'serviceType', displayName : 'Service Type' }, + {field: 'serviceTransProtocol', displayName : 'Transport Protocol'}, + {field: 'serviceAppProtocol',displayName : 'APP Protocol' }, + {field: 'servicePorts',displayName : 'Ports' } + ], + 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 = papUrl + "/ecomp/fw_dictionary/remove_serviceList.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js new file mode 100644 index 000000000..3ba588da9 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js @@ -0,0 +1,159 @@ +/*- + * ============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, FWDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getTermListDictionaryData(papUrl).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"); + }); + + + }); + + $scope.termListDictionaryGrid = { + data : 'termListDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'TermList.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWTermListWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWTermListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWTermList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'termName', displayName : 'Term-Name'}, + { 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\'' } + ], + 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 = papUrl + "/ecomp/fw_dictionary/remove_termList.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWZoneDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWZoneDictGridController.js new file mode 100644 index 000000000..bbdd03c14 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWZoneDictGridController.js @@ -0,0 +1,148 @@ +/*- + * ============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, FWDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + FWDictionaryService.getZoneDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.zoneDictionaryDatas = JSON.parse($scope.data.zoneDictionaryDatas); + console.log($scope.zoneDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + }); + + + $scope.zoneDictionaryGrid = { + data : 'zoneDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'Zone.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewFWZoneWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWZoneWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWZone(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'zoneName', displayName : 'Zone Name'}, + { field: 'zoneValue', displayName : 'Zone Value' } + ], + 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 = papUrl + "/ecomp/fw_dictionary/remove_zone.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js new file mode 100644 index 000000000..15a296799 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js @@ -0,0 +1,124 @@ +/*- + * ============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, MSDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + MSDictionaryService.getMSConfigNameDictionaryData(papUrl).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"); + }); + + }); + + + $scope.msConfigNameDictionaryGrid = { + data : 'microServiceCongigNameDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewMSConfigNameWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editMSConfigNameWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSConfigName(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Name'}, + { 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 = papUrl + "/ecomp/ms_dictionary/remove_msConfigName.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSDcaeUUIDDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSDcaeUUIDDictGridController.js new file mode 100644 index 000000000..731731ff3 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSDcaeUUIDDictGridController.js @@ -0,0 +1,124 @@ +/*- + * ============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, MSDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + MSDictionaryService.getDCAEUUIDDictionaryData(papUrl).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"); + }); + + }); + + $scope.dcaeUUIDDictionaryGrid = { + data : 'dcaeUUIDDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewMSDCAEUUIDWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editMSDCAEUUIDWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSDCAEUUID(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Name'}, + { 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 = papUrl + "/ecomp/ms_dictionary/remove_dcaeuuid.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSLocationDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSLocationDictGridController.js new file mode 100644 index 000000000..e3d7b1ab7 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSLocationDictGridController.js @@ -0,0 +1,124 @@ +/*- + * ============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, MSDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + MSDictionaryService.getMSLocationDictionaryData(papUrl).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"); + }); + + }); + + $scope.msLocationDictionaryGrid = { + data : 'microServiceLocationDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewMSLocationWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editMSLocationWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSLocation(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Name'}, + { 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 = papUrl + "/ecomp/ms_dictionary/remove_msLocation.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js new file mode 100644 index 000000000..4556a8296 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js @@ -0,0 +1,124 @@ +/*- + * ============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, MSDictionaryService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + MSDictionaryService.getMSModelDictionaryData(papUrl).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"); + }); + + }); + + $scope.msModelsDictionaryGrid = { + data : 'microServiceModelsDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewMSModelsWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSModels(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'modelName', displayName : 'Micro Service Model'}, + { 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 = papUrl + "/ecomp/ms_dictionary/remove_msModel.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSClosedLoopDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSClosedLoopDictGridController.js new file mode 100644 index 000000000..ba64bc8e1 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSClosedLoopDictGridController.js @@ -0,0 +1,123 @@ +/*- + * ============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, PolicyScopeService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + PolicyScopeService.getPSClosedLoopDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psClosedLoopDictionaryDatas = JSON.parse($scope.data.psClosedLoopDictionaryDatas); + console.log($scope.psClosedLoopDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + }); + + $scope.psClosedLoopDictionaryGrid = { + data : 'psClosedLoopDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewPSClosedLoopWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPSClosedLoopWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePSClosedLoop(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Closed Loop Name'}, + { 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 = papUrl + "/ecomp/ps_dictionary/remove_PSClosedLoop.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSGroupPolicyScopeDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSGroupPolicyScopeDictGridController.js new file mode 100644 index 000000000..756be7661 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSGroupPolicyScopeDictGridController.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('psGroupPolicyScopeDictGridController', function ($scope, PolicyScopeService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + PolicyScopeService.getPSGroupPolicyScopeDictionaryData(papUrl).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"); + }); + + }); + + $scope.psGroupPolicyScopeDictionaryGrid = { + data : 'groupPolicyScopeListDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewGroupPolicyScopeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editGroupPolicyScopeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteGroupPolicyScope(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'groupName', displayName : 'Policy Scope Group Name'}, + { 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 = papUrl + "/ecomp/ps_dictionary/remove_GroupPolicyScope.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSResourceDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSResourceDictGridController.js new file mode 100644 index 000000000..e4ad05263 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSResourceDictGridController.js @@ -0,0 +1,123 @@ +/*- + * ============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, PolicyScopeService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + PolicyScopeService.getPSResourceDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psResourceDictionaryDatas = JSON.parse($scope.data.psResourceDictionaryDatas); + console.log($scope.psResourceDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + }); + + $scope.psResourceDictionaryGrid = { + data : 'psResourceDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewPSResourceWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPSResourceWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePSResource(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Resource Name'}, + { 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 = papUrl + "/ecomp/ps_dictionary/remove_PSResource.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSServiceDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSServiceDictGridController.js new file mode 100644 index 000000000..ac16a3eb2 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSServiceDictGridController.js @@ -0,0 +1,122 @@ +/*- + * ============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, PolicyScopeService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + PolicyScopeService.getPSServiceDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psServiceDictionaryDatas = JSON.parse($scope.data.psServiceDictionaryDatas); + console.log($scope.psServiceDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + $scope.psServiceDictionaryGrid = { + data : 'psServiceDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewPSServiceWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPSServiceWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePSService(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Service Name'}, + { 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 = papUrl + "/ecomp/ps_dictionary/remove_PSService.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSTypeDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSTypeDictGridController.js new file mode 100644 index 000000000..e66b58931 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/PSTypeDictGridController.js @@ -0,0 +1,122 @@ +/*- + * ============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, PolicyScopeService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + PolicyScopeService.getPSTypeDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.psTypeDictionaryDatas = JSON.parse($scope.data.psTypeDictionaryDatas); + console.log($scope.psTypeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + $scope.psTypeDictionaryGrid = { + data : 'psTypeDictionaryDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createPSTypeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPSTypeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePSType(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Type Name'}, + { 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 = papUrl + "/ecomp/ps_dictionary/remove_PSType.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js new file mode 100644 index 000000000..d22a1ce48 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.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('riskTypeDictGridController', function ($scope, SafePolicyService,modalService,PapUrlService, $modal, uiGridConstants,Grid){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + SafePolicyService.getRiskTypeDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas); + console.log($scope.riskTypeDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + }); + + $scope.riskTypeDictionaryGrid = { + data : 'riskTypeDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'RiskType.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewRiskType()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editRiskTypeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteRiskType(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'riskName', displayName : 'Risk Type Name' }, + { 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 = papUrl + "/ecomp/sp_dictionary/remove_riskType.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/SafePolicyWarningDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/SafePolicyWarningDictGridController.js new file mode 100644 index 000000000..303ae5704 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/SafePolicyWarningDictGridController.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('safePolicyWarningDictGridController', function ($scope, SafePolicyService,modalService, $modal, PapUrlService){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + SafePolicyService.getSafePolicyWarningDictionaryData(papUrl).then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.safePolicyWarningDatas = JSON.parse($scope.data.safePolicyWarningDatas); + console.log($scope.safePolicyWarningDatas); + }, function (error) { + console.log("failed"); + }); + + }); + + $scope.safePolicyWarningDictionaryGrid = { + data : 'safePolicyWarningDatas', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewSafePolicyWarningWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editSafePolicyWarningWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteSafePolicyWarning(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'name', displayName : 'Safe Policy Warning Name'}, + { 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 = papUrl + "/ecomp/sp_dictionary/remove_SafePolicyWarning.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js new file mode 100644 index 000000000..223aec6cf --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js @@ -0,0 +1,161 @@ +/*- + * ============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, DictionaryService,modalService, $modal, uiGridConstants,Grid, PapUrlService){ + $( "#dialog" ).hide(); + $scope.type = Actiontype; + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + DictionaryService.getActionPolicyDictionaryData(papUrl).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"); + }); + + }); + + $scope.actionPolicyDictionaryGrid = { + enableFiltering: true, + data: 'actionPolicyDictionaryDatas', + exporterCsvFilename: 'ActionPolicyDictionary.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', + enableFiltering: false, + headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewActionPolicyDictWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editActionPolicyDictWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteActionPolicyDict(row.entity)" ><i class="fa fa-trash-o"></i></button> ', + width: '8%' + }, + {field: 'attributeName', displayName: 'Attribute Name'}, + {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\''} + ], + 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 = papUrl + "/ecomp/action_dictionary/remove_actionPolicyDict.htm"; + 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/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js new file mode 100644 index 000000000..5405bb0d7 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js @@ -0,0 +1,159 @@ +/*- + * ============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, DictionaryService, PapUrlService, modalService, $modal){ + $( "#dialog" ).hide(); + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + DictionaryService.getAttributeDictionaryData(papUrl).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"); + }; + + $scope.attributeDictionaryGrid = { + data : 'attributeDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'Attribute.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id' , enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewAttributeWindow()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editAttributeWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteAttribute(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + },{ field: 'xacmlId', displayName : 'Attribute ID'}, + { 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\'' } + ], + 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) { + modalService.popupConfirmWin("Confirm","You are about to delete the Attribute Dictionary : "+data.xacmlId+". \n "+searchString+" \n Do you want to continue?", + function(){ + var uuu = papUrl + "/ecomp/attribute_dictionary/remove_attribute.htm"; + 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); + } + }); + + }) + }; + + +});
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js new file mode 100644 index 000000000..3ae3ee21d --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.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('ecompNameDictGridController', function ($scope, DictionaryService,modalService,PapUrlService, $modal, uiGridConstants,Grid){ + $( "#dialog" ).hide(); + + var papUrl; + PapUrlService.getPapUrl().then(function(data) { + var config = data; + papUrl = config.PAP_URL; + console.log(papUrl); + + DictionaryService.getEcompDictionaryData(papUrl).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"); + }); + }); + + $scope.ecompNameDictionaryGrid = { + data : 'ecompNameDictionaryDatas', + enableFiltering: true, + exporterCsvFilename: 'EcompName.csv', + enableGridMenu: true, + enableSelectAll: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewEcompName()" class="btn btn-success">' + 'Create</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editEcompNameWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteEcompName(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%' + }, + { field: 'ecompName', displayName : 'Ecomp Name' }, + { 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.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 = papUrl + "/ecomp/ecomp_dictionary/remove_ecomp.htm"; + var postData={data: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.ecompNameDictionaryDatas=data.ecompNameDictionaryDatas;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + +});
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/editorTabController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/editorTabController.js new file mode 100644 index 000000000..d9a6bbcc1 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/editorTabController.js @@ -0,0 +1,211 @@ +/*- + * ============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========================================================= + */ + +/* +/!** + *!/ +(function(window, angular, $) { + 'use strict'; + app.controller('policyeditorTabController', [ + '$scope', '$translate', '$cookies', 'fileManagerConfig', 'item', 'fileNavigator', 'fileUploader', + function($scope, $translate, $cookies, fileManagerConfig, Item, FileNavigator, FileUploader) { + +/!*app.controller('policyeditorTabController', function ($scope, $translate, $cookies, fileManagerConfig, Item, FileNavigator, FileUploader){*!/ + $( "#dialog" ).hide(); + $scope.config = fileManagerConfig; + $scope.reverse = false; + $scope.predicate = ['model.type', 'model.name']; + $scope.order = function(predicate) { + $scope.reverse = ($scope.predicate[1] === predicate) ? !$scope.reverse : false; + $scope.predicate[1] = predicate; + }; + + $scope.query = ''; + $scope.temp = new Item(); + $scope.fileNavigator = new FileNavigator(); + $scope.fileUploader = FileUploader; + $scope.uploadFileList = []; + $scope.viewTemplate = $cookies.viewTemplate || 'main-table.html'; + + $scope.setTemplate = function(name) { + $scope.viewTemplate = $cookies.viewTemplate = name; + }; + + $scope.changeLanguage = function (locale) { + if (locale) { + return $translate.use($cookies.language = locale); + } + $translate.use($cookies.language || fileManagerConfig.defaultLang); + }; + + $scope.touch = function(item) { + item = item instanceof Item ? item : new Item(); + item.revert(); + $scope.temp = item; + }; + + $scope.smartClick = function(item) { + if (item.isFolder()) { + return $scope.fileNavigator.folderClick(item); + } + if (item.isImage()) { + return $scope.openImagePreview(item); + } + if (item.isEditable()) { + return $scope.openEditItem(item); + } + }; + + $scope.openImagePreview = function(item) { + item.inprocess = true; + $scope.modal('imagepreview') + .find('#imagepreview-target') + .attr('src', item.getUrl(true)) + .unbind('load error') + .on('load error', function() { + item.inprocess = false; + $scope.$apply(); + }); + return $scope.touch(item); + }; + + $scope.openEditItem = function(item) { + item.getContent(); + $scope.modal('edit'); + return $scope.touch(item); + }; + + $scope.modal = function(id, hide) { + return $('#' + id).modal(hide ? 'hide' : 'show'); + }; + + $scope.isInThisPath = function(path) { + var currentPath = $scope.fileNavigator.currentPath.join('/'); + return currentPath.indexOf(path) !== -1; + }; + + $scope.edit = function(item) { + item.edit().then(function() { + $scope.modal('edit', true); + }); + }; + + $scope.changePermissions = function(item) { + item.changePermissions().then(function() { + $scope.modal('changepermissions', true); + }); + }; + + $scope.copy = function(item) { + var samePath = item.tempModel.path.join() === item.model.path.join(); + if (samePath && $scope.fileNavigator.fileNameExists(item.tempModel.name)) { + item.error = $translate.instant('error_invalid_filename'); + return false; + } + item.copy().then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('copy', true); + }); + }; + + $scope.compress = function(item) { + item.compress().then(function() { + $scope.fileNavigator.refresh(); + if (! $scope.config.compressAsync) { + return $scope.modal('compress', true); + } + item.asyncSuccess = true; + }, function() { + item.asyncSuccess = false; + }); + }; + + $scope.extract = function(item) { + item.extract().then(function() { + $scope.fileNavigator.refresh(); + if (! $scope.config.extractAsync) { + return $scope.modal('extract', true); + } + item.asyncSuccess = true; + }, function() { + item.asyncSuccess = false; + }); + }; + + $scope.remove = function(item) { + item.remove().then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('delete', true); + }); + }; + + $scope.rename = function(item) { + var samePath = item.tempModel.path.join() === item.model.path.join(); + if (samePath && $scope.fileNavigator.fileNameExists(item.tempModel.name)) { + item.error = $translate.instant('error_invalid_filename'); + return false; + } + item.rename().then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('rename', true); + }); + }; + + $scope.createFolder = function(item) { + var name = item.tempModel.name && item.tempModel.name.trim(); + item.tempModel.type = 'dir'; + item.tempModel.path = $scope.fileNavigator.currentPath; + if (name && !$scope.fileNavigator.fileNameExists(name)) { + item.createFolder().then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('newfolder', true); + }); + } else { + item.error = $translate.instant('error_invalid_filename'); + return false; + } + }; + + $scope.uploadFiles = function() { + $scope.fileUploader.upload($scope.uploadFileList, $scope.fileNavigator.currentPath).then(function() { + $scope.fileNavigator.refresh(); + $scope.modal('uploadfile', true); + }, function(data) { + var errorMsg = data.result && data.result.error || $translate.instant('error_uploading_files'); + $scope.temp.error = errorMsg; + }); + }; + + $scope.getQueryParam = function(param) { + var found; + window.location.search.substr(1).split('&').forEach(function(item) { + if (param === item.split('=')[0]) { + found = item.split('=')[1]; + return false; + } + }); + return found; + }; + + $scope.changeLanguage($scope.getQueryParam('lang')); + $scope.isWindows = $scope.getQueryParam('server') === 'Windows'; + $scope.fileNavigator.refresh(); + }]); +})(window, angular, jQuery);*/ diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/pdpController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/pdpController.js new file mode 100644 index 000000000..368375cda --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/pdpController.js @@ -0,0 +1,178 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +app.controller('pdpTabController', function ($scope,PDPService,modalService, $modal, AdminTabService){ + $( "#dialog" ).hide(); + + $scope.isDisabled = true; + $scope.createPdpGroupId = false; + $scope.deletePdpGroupId = false; + $scope.editPdpGroupId = false; + $scope.pdpdatas = []; + AdminTabService.getData().then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.isDisabled = true; + }else{ + $scope.isDisabled = false; + } + console.log($scope.data); + + AdminTabService.getRolesData().then(function(data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.userRolesDatas = JSON.parse($scope.data.userRolesDatas); + console.log($scope.userRolesDatas); + if($scope.isDisabled == false){ + if($scope.userRolesDatas[0] == 'super-admin' || $scope.userRolesDatas[0] == 'admin'){ + $scope.createPdpGroupId = true; + $scope.deletePdpGroupId = true; + $scope.editPdpGroupId = true; + }else if($scope.userRolesDatas[0] == 'super-editor' || $scope.userRolesDatas[0] == 'editor'){ + $scope.editPdpGroupId = true; + }else if($scope.userRolesDatas[0] == 'super-guest' || $scope.userRolesDatas[0] == 'guest'){ + $scope.editPdpGroupId = true; + } + } + + PDPService.getPDPGroupEntityData().then(function(data){ + var j = data; + $scope.pdpdatas = JSON.parse(j.data); + console.log($scope.pdpdatas); + },function(error){ + console.log("failed"); + }); + },function (error) { + console.log("failed"); + }); + },function(error){ + console.log("failed"); + }); + + + $scope.addNewPDPGroupFunctionPopup = function() { + $scope.editPDPGroup = null; + $( "#dialog" ).dialog({ + modal: true + }); + }; + + $scope.editPDPGroup = null; + var dialog = null; + $scope.editPDPGroupFunctionPopup = function(pdpGroupData) { + $scope.editPDPGroup = pdpGroupData; + $( "#dialog" ).dialog({ + modal: true + }); + }; + + $scope.editPDPGroupFunctionModalPopup = function(pdpGroupData) { + $scope.editPDPGroup = pdpGroupData; + if($scope.userRolesDatas[0] == 'super-guest' || $scope.userRolesDatas[0] == 'guest'){ + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'show_policies_pdp_group_popup.html', + controller: 'editPDPGrouppopupController', + resolve: { + message: function () { + var message = { + pdpGroupData : $scope.editPDPGroup + }; + return message; + } + } + }); + }else{ + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'edit_pdp_group_popup.html', + controller: 'editPDPGrouppopupController', + resolve: { + message: function () { + var message = { + pdpGroupData : $scope.editPDPGroup + }; + return message; + } + } + }); + } + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.pdpdatas=response.data; + }); + }; + + $scope.addNewPDPGroupPopUpWindow = function(editPDPGroup) { + $scope.editPDPGroup = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'add_pdp_group_popup.html', + controller: 'editPDPGrouppopupController', + resolve: { + message: function () { + var message = { + data: $scope.editPDPGroup + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.pdpdatas=JSON.parse(response.data); + }); + }; + + $scope.addNewPDPGroupFunctionPopup = function() { + $scope.editPDPGroup = null; + $( "#dialog" ).dialog({ + modal: true + }); + }; + + $scope.removePDPGroup = function(pdpGroupData) { + modalService.popupConfirmWin("Confirm","You are about to delete the PDP Group "+pdpGroupData.name+". Do you want to continue?", + function(){ + var uuu = "pdp_Group/remove_pdp_group.htm"; + var postData={pdpGroupData: pdpGroupData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.pdpdata=data.data;}); + $scope.pdpdatas=JSON.parse(data.data); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + + }; +}); diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js new file mode 100644 index 000000000..31a094e5f --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js @@ -0,0 +1,179 @@ +/*- + * ============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 editPDPGrouppopupController = function ($scope, $modalInstance, message, modalService, $modal, Notification){ + if(message.pdpGroupData==null) + $scope.label='Add New PDP Group' + else{ + $scope.label='Edit PDP Group' + $scope.disableCd=true; + $scope.policies = message.pdpGroupData.policies; + $scope.pdps = message.pdpGroupData.pdps; + $scope.selectedPdp = message.pdpGroupData; + } + $scope.editPDPGroup = message.pdpGroupData; + + $scope.policiesGrid = { + data : 'policies', + enableFiltering: true, + columnDefs: [ + { field: 'root', displayName : 'Root', width : '10%'}, + { field: 'name', displayName : 'Name' }, + { field: 'version' , width : '10%'}, + { field: 'id' } + ] + }; + + $scope.pdpsGrid = { + data : 'pdps', + enableFiltering: true, + columnDefs: [{ + field: 'id', enableFiltering: false, headerCellTemplate: '' + + '<button id=\'New\' ng-click="grid.appScope.createNewPDPInGroup()" class="btn btn-success">' + 'Create PDP</button>', + cellTemplate: + '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPDPInGroup(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' + + '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePDPFromGroup(row.entity)" ><i class="fa fa-trash-o"></i></button> '+ + '<button type="button" class="btn btn-success" ng-click="grid.appScope.statusOfPDP(row.entity.status)" >Status</button>', width: '15%' + }, + { field: 'id', displayName : 'PDP URL'}, + { field: 'jmxPort', displayName : 'JMX Port' , width : '10%' }, + { field: 'name' , displayName : 'PDP Name'}, + { field: 'description' } + ] + }; + + $scope.createNewPDPInGroup = function(pdpInGroup) { + $scope.pdpInGroup = null; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl : 'create_newPDP_InGroup.html', + controller: 'pdpInGroupController', + resolve: { + message: function () { + var message = { + data: $scope.pdpInGroup, + activePDP : $scope.selectedPdp + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.data=response.data; + }); + }; + + $scope.editPDPInGroup = function(pdpInGroup) { + $scope.editPDPInGroupData = pdpInGroup; + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'create_newPDP_InGroup.html', + controller: 'pdpInGroupController', + resolve: { + message: function () { + var message = { + pdpInGroup : $scope.editPDPInGroupData, + activePDP : $scope.selectedPdp + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.data=response.data; + }); + }; + + $scope.deletePDPFromGroup = function(data){ + modalService.popupConfirmWin("Confirm","You are about to delete the PDP Group : "+data.name+". Do you want to continue?", + function(){ + var uuu = "pdp_Group/remove_pdpFromGroup.htm"; + var postData={data: data, + activePDP : $scope.selectedPdp}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.data=data.data;}); + Notification.success("PDP Group Deleted Successfully"); + }, + error : function(data){ + console.log(data); + Notification.error("Error Occured While Deleting a PDP Group") + //modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + }; + + $scope.statusOfPDP = function(status){ + $scope.pdpStatus = status; + console.log($scope.pdpStatus); + var modalInstance = $modal.open({ + backdrop: 'static', keyboard: false, + templateUrl: 'pdpGroupStatusWindow.html', + controller: 'pdpGroupStatusController', + resolve: { + message: function () { + var message = { + status : $scope.pdpStatus, + policies : $scope.policies + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.data=response.data; + }); + }; + + $scope.savePDPGroup = function(pdpGroupData) { + var uuu = "pdp_Group/save_pdp_group.htm"; + var postData={pdpGroupData: pdpGroupData}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.data=data.data;}); + console.log($scope.data); + $modalInstance.close({data:$scope.data}); + }, + error : function(data){ + alert("Error while saving."); + } + }); + }; + + $scope.close = function() { + $modalInstance.close(); + }; +}
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/policyAdminTabController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/policyAdminTabController.js new file mode 100644 index 000000000..698b7e807 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/policyAdminTabController.js @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + * + */ +app.controller("policyAdminController", function($scope, AdminTabService, modalService, $modal, Notification){ + $( "#dialog" ).hide(); + + $scope.isDisabled = true; + AdminTabService.getData().then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.lockdowndata = JSON.parse($scope.data.lockdowndata); + if($scope.lockdowndata[0].lockdown == true){ + $scope.isDisabled = true; + }else{ + $scope.isDisabled = false; + } + console.log($scope.data); + },function(error){ + console.log("failed"); + }); + + $scope.saveLockDownValue = function(lockdownValue){ + console.log(lockdownValue); + if(lockdownValue == true){ + Notification.success("Policy Application has been Locked Successfully"); + $scope.isDisabled = true; + }else{ + Notification.success("Policy Application has been UnLocked Successfully"); + $scope.isDisabled = false; + } + var uuu = "adminTabController/save_LockDownValue.htm"; + var postData={lockdowndata: {lockdown : lockdownValue}}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.data=data.data; + }); + console.log($scope.data); + }, + error : function(data){ + alert("Error Occured while saving Lockdown Value."); + } + }); + }; +});
\ No newline at end of file diff --git a/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/policyController.js b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/policyController.js new file mode 100644 index 000000000..c5822a7e7 --- /dev/null +++ b/ecomp-sdk-app/src/main/webapp/app/policyApp/controller/policyController.js @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + * + */ +angular.module('abs').requires.push('ui.grid','ui.grid.pagination','ui.grid.selection', 'ui.grid.exporter', 'ui.grid.edit', 'ui.grid.autoResize', + 'ui.grid.resizeColumns','ngRoute', 'pascalprecht.translate', 'ngCookies', 'ui-notification', 'ui.grid.treeView'); +app.config(function($routeProvider) { + $routeProvider + .when('/Editor', { + templateUrl:'app/policyApp/policy-models/Editor/src/templates/main.html', + controller : "FileManagerCtrl" + }) + .when('/Dictionary', { + templateUrl: 'app/policyApp/policy-models/policy_Dictionary.html', + controller : "dictionaryTabController" + }) + .when('/Pdp', { + templateUrl: 'app/policyApp/policy-models/policy_PDPManagement.html', + controller : "pdpTabController" + }) + .when('/Push', { + templateUrl: 'app/policyApp/policy-models/policy_AutoPush.html', + controller : "policyPushController" + }) + .when('/Admin', { + templateUrl: 'app/policyApp/policy-models/policy_AdminTab.html', + controller : "policyAdminController" + }) + .when('/Roles', { + templateUrl: 'app/policyApp/policy-models/policy_Roles.html', + controller : "policyRolesController" + }) + .when('/Dashboard', { + templateUrl: 'app/policyApp/policy-models/policy_DashboardLogging.html', + controller : "policyDashboardController" + }) + .when('/Dashboard_Health', { + templateUrl: 'app/policyApp/policy-models/policy_DashboardHealth.html', + controller : "policyDashboardHealthController" + }) + .otherwise({ + templateUrl:'app/policyApp/policy-models/Editor/src/templates/main.html', + controller : "FileManagerCtrl" + }); + +});
\ No newline at end of file |