diff options
Diffstat (limited to 'POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController')
3 files changed, 152 insertions, 221 deletions
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js index c89fe9bdd..98a237ae2 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js @@ -142,77 +142,54 @@ app.controller('editFWTermListController' , function ($scope, $modalInstance, me PolicyAppService.getData('getDictionary/get_PrefixListDataByName').then(function (data) { var j = data; $scope.data = JSON.parse(j.data); - console.log($scope.data); $scope.prefixListDictionaryDatas = JSON.parse($scope.data.prefixListDictionaryDatas); - console.log($scope.prefixListDictionaryDatas); for(i = 0; i < $scope.prefixListDictionaryDatas.length; i++){ var key = $scope.prefixListDictionaryDatas[i]; $scope.groupAddresses.push(key); } - }, function (error) { - console.log("failed"); }); PolicyAppService.getData('getDictionary/get_ZoneDictionaryDataByName').then(function (data) { var j = data; $scope.data = JSON.parse(j.data); - console.log($scope.data); $scope.zoneDictionaryDatas = JSON.parse($scope.data.zoneDictionaryDatas); - console.log($scope.zoneDictionaryDatas); - }, function (error) { - console.log("failed"); }); PolicyAppService.getData('getDictionary/get_AddressGroupDictionaryDataByName').then(function (data) { var j = data; $scope.data = JSON.parse(j.data); - console.log($scope.data); $scope.addressGroupDictionaryDatas = JSON.parse($scope.data.addressGroupDictionaryDatas); - console.log($scope.addressGroupDictionaryDatas); for(i = 0; i < $scope.addressGroupDictionaryDatas.length; i++){ var key = $scope.addressGroupDictionaryDatas[i]; $scope.groupAddresses.push(key); } - }, function (error) { - console.log("failed"); }); PolicyAppService.getData('getDictionary/get_ServiceListDictionaryDataByName').then(function (data) { var j = data; $scope.data = JSON.parse(j.data); - console.log($scope.data); $scope.serviceListDictionaryDatas = JSON.parse($scope.data.serviceListDictionaryDatas); - console.log($scope.serviceListDictionaryDatas); for(i = 0; i < $scope.serviceListDictionaryDatas.length; i++){ var key = $scope.serviceListDictionaryDatas[i]; $scope.groupServices.push(key); } - }, function (error) { - console.log("failed"); }); PolicyAppService.getData('getDictionary/get_ServiceGroupDictionaryDataByName').then(function (data) { var j = data; $scope.data = JSON.parse(j.data); - console.log($scope.data); $scope.serviceGroupDictionaryDatas = JSON.parse($scope.data.serviceGroupDictionaryDatas); - console.log($scope.serviceGroupDictionaryDatas); for(i = 0; i < $scope.serviceGroupDictionaryDatas.length; i++){ var key = $scope.serviceGroupDictionaryDatas[i]; $scope.groupServices.push(key); } }, function (error) { - console.log("failed"); }); PolicyAppService.getData('getDictionary/get_ActionListDictionaryDataByName').then(function (data) { var j = data; $scope.data = JSON.parse(j.data); - console.log($scope.data); $scope.actionListDictionaryDatas = JSON.parse($scope.data.actionListDictionaryDatas); - console.log($scope.actionListDictionaryDatas); - }, function (error) { - console.log("failed"); }); @@ -251,7 +228,6 @@ app.controller('editFWTermListController' , function ($scope, $modalInstance, me if($scope.termListDictionaryDatas == "Duplicate"){ Notification.error("FW TermList Dictionary exists with Same Term Name.") }else{ - console.log($scope.termListDictionaryDatas); $modalInstance.close({termListDictionaryDatas:$scope.termListDictionaryDatas}); } }, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSHeaderDefaultValuesDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSHeaderDefaultValuesDictController.js index 8492a96d3..ce84afd84 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSHeaderDefaultValuesDictController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSHeaderDefaultValuesDictController.js @@ -17,118 +17,91 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -app.controller('editMSHeaderDefaultValuesController' , function ($scope, $modalInstance, message, PolicyAppService, UserInfoServiceDS2, Notification){ - if(message.modelAttributeDictionaryData==null) - $scope.label='Set Header Default Values' - else{ - $scope.label='Edit Header Default Values' - $scope.disableCd=true; - } +app.controller('editMSHeaderDefaultValuesController' , + function ($scope, $modalInstance, message, PolicyAppService, UserInfoServiceDS2, Notification){ + if(message.modelAttributeDictionaryData==null) + $scope.label='Set Header Default Values' + else{ + $scope.label='Edit Header Default Values' + $scope.disableCd=true; + } - PolicyAppService.getData('getDictionary/get_MicroServiceHeaderDefaultsData').then(function (data) { - var j = data; - $scope.data = JSON.parse(j.data); - console.log($scope.data); - $scope.microServiceHeaderDefaultDatas = JSON.parse($scope.data.microServiceHeaderDefaultDatas); - console.log("microServiceHeaderDefaultDatas:" + $scope.microServiceHeaderDefaultDatas); - }, function (error) { - console.log("failed"); - }); + PolicyAppService.getData('getDictionary/get_MicroServiceHeaderDefaultsData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + $scope.microServiceHeaderDefaultDatas = JSON.parse($scope.data.microServiceHeaderDefaultDatas); + }); - PolicyAppService.getData('getDictionary/get_MicroServiceModelsDataServiceVersion').then(function (data) { - var j = data; - $scope.data = JSON.parse(j.data); - console.log($scope.data); - $scope.microServiceModelsDictionaryDatas = JSON.parse($scope.data.microServiceModelsDictionaryDatas); - console.log($scope.microServiceModelsDictionaryDatas); - }, function (error) { - console.log("failed"); - }); - - PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) { - var j = data; - $scope.data = JSON.parse(j.data); - console.log("riskTypeDictionaryDatas = " + $scope.data); - $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas); - console.log($scope.riskTypeDictionaryDatas); - }, function (error) { - console.log("failed"); - }); + PolicyAppService.getData('getDictionary/get_MicroServiceModelsDataServiceVersion').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + $scope.microServiceModelsDictionaryDatas = JSON.parse($scope.data.microServiceModelsDictionaryDatas); + }); + + PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas); + }); - PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) { - var j = data; - $scope.data = JSON.parse(j.data); - console.log("riskTypeDictionaryDatas: " + $scope.data); - $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas); - console.log($scope.riskTypeDictionaryDatas); - }, function (error) { - console.log("failed"); - }); - - PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function (data) { - var j = data; - $scope.data = JSON.parse(j.data); - console.log($scope.data); - $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas); - console.log($scope.onapNameDictionaryDatas); - }, function (error) { - console.log("failed"); - }); + PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas); + }); + + PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas); + }); - PolicyAppService.getData('get_DCAEPriorityValues').then(function (data) { - var j = data; - $scope.data = JSON.parse(j.data); - console.log($scope.data); - $scope.priorityDatas = JSON.parse($scope.data.priorityDatas); - console.log($scope.priorityDatas); - }, function (error) { - console.log("failed"); - }); - - /*getting user info from session*/ - var userid = null; - UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() - .then(function (response) { - userid = response.userid; - }); - - $scope.editHeaderDefaults = message.modelAttributeDictionaryData; - $scope.editModelAttribute1 = {microservice: []}; - if($scope.edit){ - if(message.modelAttributeDictionaryData.groupList != null){ - var splitValue = message.modelAttributeDictionaryData.groupList.split(","); - console.log(splitValue); - } - } - $scope.saveHeaderDefaults = function(editHeaderDefaultsData) { - console.log("editHeaderDefaultsData :" + editHeaderDefaultsData); - var uuu = "saveDictionary/ms_dictionary/save_headerDefaults"; - var postData={modelAttributeDictionaryData: editHeaderDefaultsData, userid: userid}; - $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){ - $scope.microServiceHeaderDefaultDatas=data.microServiceHeaderDefaultDatas;}); - console.log("microServiceHeaderDefaultDatas returned after saved: " + $scope.microServiceHeaderDefaultDatas); - if($scope.microServiceAttributeDictionaryDatas == "Duplicate"){ - Notification.error("Model Attribute Dictionary exists with Same Attribute Name.") - }else{ - console.log($scope.microServiceHeaderDefaultDatas); - $modalInstance.close({microServiceHeaderDefaultDatas:$scope.microServiceHeaderDefaultDatas}); - } - }, - error : function(data){ - Notification.error("Error while saving."); - } - }); - - }; + PolicyAppService.getData('get_DCAEPriorityValues').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + $scope.priorityDatas = JSON.parse($scope.data.priorityDatas); + }); + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); + + $scope.editHeaderDefaults = message.modelAttributeDictionaryData; + $scope.editModelAttribute1 = {microservice: []}; + if($scope.edit){ + if(message.modelAttributeDictionaryData.groupList != null){ + var splitValue = message.modelAttributeDictionaryData.groupList.split(","); + } + } + $scope.saveHeaderDefaults = function(editHeaderDefaultsData) { + var uuu = "saveDictionary/ms_dictionary/save_headerDefaults"; + var postData={modelAttributeDictionaryData: editHeaderDefaultsData, userid: userid}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.microServiceHeaderDefaultDatas=data.microServiceHeaderDefaultDatas;}); + if($scope.microServiceAttributeDictionaryDatas == "Duplicate"){ + Notification.error("Model Attribute Dictionary exists with Same Attribute Name.") + }else{ + $modalInstance.close({microServiceHeaderDefaultDatas:$scope.microServiceHeaderDefaultDatas}); + } + }, + error : function(data){ + Notification.error("Error while saving."); + } + }); + + }; - $scope.close = function() { - $modalInstance.close(); - }; - });
\ No newline at end of file + $scope.close = function() { + $modalInstance.close(); + }; + });
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js index b456c57a0..6b65a5938 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/PSGroupPolicyScopeDictController.js @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 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. @@ -17,8 +17,9 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -app.controller('editPSGroupPolicyScopeController' , function ($scope, $modalInstance, message, PolicyAppService, UserInfoServiceDS2, Notification){ - $scope.edit = false; +app.controller('editPSGroupPolicyScopeController' , + function ($scope, $modalInstance, message, PolicyAppService, UserInfoServiceDS2, Notification){ + $scope.edit = false; if(message.groupPolicyScopeListData==null) $scope.label='Add New Group Policy Scope' else{ @@ -26,108 +27,89 @@ app.controller('editPSGroupPolicyScopeController' , function ($scope, $modalIns $scope.disableCd=true; $scope.edit = true; } - + PolicyAppService.getData('getDictionary/get_PSServiceDataByName').then(function (data) { - var j = data; - $scope.data = JSON.parse(j.data); - console.log($scope.data); - $scope.psServiceDictionaryDatas = JSON.parse($scope.data.psServiceDictionaryDatas); - console.log($scope.psServiceDictionaryDatas); - }, function (error) { - console.log("failed"); + var j = data; + $scope.data = JSON.parse(j.data); + $scope.psServiceDictionaryDatas = JSON.parse($scope.data.psServiceDictionaryDatas); }); PolicyAppService.getData('getDictionary/get_PSTypeDataByName').then(function (data) { - var j = data; - $scope.data = JSON.parse(j.data); - console.log($scope.data); - $scope.psTypeDictionaryDatas = JSON.parse($scope.data.psTypeDictionaryDatas); - console.log($scope.psTypeDictionaryDatas); - }, function (error) { - console.log("failed"); + var j = data; + $scope.data = JSON.parse(j.data); + $scope.psTypeDictionaryDatas = JSON.parse($scope.data.psTypeDictionaryDatas); }); PolicyAppService.getData('getDictionary/get_PSResourceDataByName').then(function (data) { - var j = data; - $scope.data = JSON.parse(j.data); - console.log($scope.data); - $scope.psResourceDictionaryDatas = JSON.parse($scope.data.psResourceDictionaryDatas); - console.log($scope.psResourceDictionaryDatas); - }, function (error) { - console.log("failed"); + var j = data; + $scope.data = JSON.parse(j.data); + $scope.psResourceDictionaryDatas = JSON.parse($scope.data.psResourceDictionaryDatas); }); PolicyAppService.getData('getDictionary/get_PSClosedLoopDataByName').then(function (data) { - var j = data; - $scope.data = JSON.parse(j.data); - console.log($scope.data); - $scope.psClosedLoopDictionaryDatas = JSON.parse($scope.data.psClosedLoopDictionaryDatas); - console.log($scope.psClosedLoopDictionaryDatas); - }, function (error) { - console.log("failed"); + var j = data; + $scope.data = JSON.parse(j.data); + $scope.psClosedLoopDictionaryDatas = JSON.parse($scope.data.psClosedLoopDictionaryDatas); }); - - /*getting user info from session*/ - var userid = null; - UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() - .then(function (response) { - userid = response.userid; - }); + + /*getting user info from session*/ + var userid = null; + UserInfoServiceDS2.getFunctionalMenuStaticDetailSession() + .then(function (response) { + userid = response.userid; + }); $scope.editPSGroupPolicyScope = message.groupPolicyScopeListData; $scope.editPSGroupPolicyScope1 = {resource: [], type:[], service: [], closedloop: []}; if($scope.edit){ - if(message.groupPolicyScopeListData.groupList != null){ - var splitValue = message.groupPolicyScopeListData.groupList.split(","); - console.log(splitValue); - $scope.splittedGroupListValues = []; - var splitResource = splitValue[0].split("="); - $scope.editPSGroupPolicyScope1.resource.push(splitResource[1]); - var splitType = splitValue[1].split("="); - $scope.editPSGroupPolicyScope1.type.push(splitType[1]); - var splitService = splitValue[2].split("="); - $scope.editPSGroupPolicyScope1.service.push(splitService[1]); - var splitCloop = splitValue[3].split("="); - $scope.editPSGroupPolicyScope1.closedloop.push(splitCloop[1]); - } + if(message.groupPolicyScopeListData.groupList != null){ + var splitValue = message.groupPolicyScopeListData.groupList.split(","); + $scope.splittedGroupListValues = []; + var splitResource = splitValue[0].split("="); + $scope.editPSGroupPolicyScope1.resource.push(splitResource[1]); + var splitType = splitValue[1].split("="); + $scope.editPSGroupPolicyScope1.type.push(splitType[1]); + var splitService = splitValue[2].split("="); + $scope.editPSGroupPolicyScope1.service.push(splitService[1]); + var splitCloop = splitValue[3].split("="); + $scope.editPSGroupPolicyScope1.closedloop.push(splitCloop[1]); + } } $scope.savePSGroupPolicyScope = function(groupPolicyScopeListData, groupPolicyScopeListData1) { - var regex = new RegExp("^[a-zA-Z0-9_]*$"); - if(!regex.test(groupPolicyScopeListData.groupName)) { - Notification.error("Enter Valid Policy Scope Group Name without spaces or special characters"); - }else{ - console.log(groupPolicyScopeListData1); - if(groupPolicyScopeListData1.resource[0] != undefined && groupPolicyScopeListData1.type[0] != undefined && groupPolicyScopeListData1.service[0] != undefined && groupPolicyScopeListData1.closedloop[0] != undefined){ - var uuu = "saveDictionary/ps_dictionary/save_psGroupPolicyScope"; - var postData={groupPolicyScopeListData: groupPolicyScopeListData, - groupPolicyScopeListData1: groupPolicyScopeListData1, userid: userid}; - $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){ - $scope.groupPolicyScopeListDatas=data.groupPolicyScopeListDatas;}); - if($scope.groupPolicyScopeListDatas == "Duplicate"){ - Notification.error("GroupPolicyScope Dictionary exists with Same Group Name.") - }else if($scope.groupPolicyScopeListDatas == "DuplicateGroup"){ - Notification.error("GroupPolicyScope Dictionary exists with Same Group List.") - }else{ - console.log($scope.groupPolicyScopeListDatas); - $modalInstance.close({groupPolicyScopeListDatas:$scope.groupPolicyScopeListDatas}); - } - }, - error : function(data){ - Notification.error("Error while saving."); - } - }); - }else{ - Notification.error("Please Select all the required fields to Save"); - } - } + var regex = new RegExp("^[a-zA-Z0-9_]*$"); + if(!regex.test(groupPolicyScopeListData.groupName)) { + Notification.error("Enter Valid Policy Scope Group Name without spaces or special characters"); + }else{ + if(groupPolicyScopeListData1.resource[0] != undefined && groupPolicyScopeListData1.type[0] != undefined && groupPolicyScopeListData1.service[0] != undefined && groupPolicyScopeListData1.closedloop[0] != undefined){ + var uuu = "saveDictionary/ps_dictionary/save_psGroupPolicyScope"; + var postData={groupPolicyScopeListData: groupPolicyScopeListData, + groupPolicyScopeListData1: groupPolicyScopeListData1, userid: userid}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.groupPolicyScopeListDatas=data.groupPolicyScopeListDatas;}); + if($scope.groupPolicyScopeListDatas == "Duplicate"){ + Notification.error("GroupPolicyScope Dictionary exists with Same Group Name.") + }else if($scope.groupPolicyScopeListDatas == "DuplicateGroup"){ + Notification.error("GroupPolicyScope Dictionary exists with Same Group List.") + }else{ + $modalInstance.close({groupPolicyScopeListDatas:$scope.groupPolicyScopeListDatas}); + } + }, + error : function(data){ + Notification.error("Error while saving."); + } + }); + }else{ + Notification.error("Please Select all the required fields to Save"); + } + } }; $scope.close = function() { |