diff options
Diffstat (limited to 'POLICY-SDK-APP/src/main/webapp/app/policyApp/controller')
6 files changed, 299 insertions, 421 deletions
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/AutoPushController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/AutoPushController.js index 4832da109..264ff567e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/AutoPushController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/AutoPushController.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,7 +17,8 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -app.controller('policyPushController', function ($scope, PolicyAppService, modalService, $modal, Notification,$filter){ +app.controller('policyPushController', + function ($scope, PolicyAppService, modalService, $modal, Notification,$filter){ $( "#dialog" ).hide(); $scope.isDisabled = true; @@ -32,30 +33,24 @@ app.controller('policyPushController', function ($scope, PolicyAppService, modal }else{ $scope.isDisabled = false; } - console.log($scope.data); - },function(error){ - console.log("failed"); }); $scope.pdpdata; PolicyAppService.getData('get_PDPGroupData').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.pushTabPDPGrid.data = $scope.pdpdata; }; $scope.filterPdpGroup; $scope.filterPDPGroupData = function() { $scope.pushTabPDPGrid.data = $filter('filter')($scope.pdpdata, $scope.filterPdpGroup, undefined); }; - $scope.pushTabPDPGrid = { + $scope.pushTabPDPGrid = { onRegisterApi: function(gridApi) { $scope.gridApi = gridApi; }, @@ -78,7 +73,7 @@ app.controller('policyPushController', function ($scope, PolicyAppService, modal Notification.error("Policy Application has been LockDown."); }else{ var modalInstance = $modal.open({ - backdrop: 'static', keyboard: false, + backdrop: 'static', keyboard: false, templateUrl: 'remove_PDPGroupPolicies_popup.html', controller: 'removeGroupPoliciesController', resolve: { @@ -91,7 +86,6 @@ app.controller('policyPushController', function ($scope, PolicyAppService, modal } }); modalInstance.result.then(function (response) { - console.log('response', response); $scope.pdpdata = JSON.parse(response.data); $scope.pushTabPDPGrid.data = $scope.pdpdata; }); @@ -99,75 +93,66 @@ app.controller('policyPushController', function ($scope, PolicyAppService, modal }; $scope.gridOptions = { - data : 'policydatas', - onRegisterApi: function(gridApi) { - $scope.gridPolicyApi = gridApi; - }, - enableSorting: true, - enableFiltering: true, - showTreeExpandNoChildren: true, - paginationPageSizes: [10, 20, 50, 100], - paginationPageSize: 20, - columnDefs: [{name: 'policyName', displayName : 'Policy Name', sort: { direction: 'asc', priority: 0 }}, - {name: 'activeVersion', displayName : 'Version'}, - {name: 'modifiedDate', displayName : 'Last Modified',type: 'date', cellFilter: 'date:\'yyyy-MM-dd HH:MM:ss a\'' }] + data : 'policydatas', + onRegisterApi: function(gridApi) { + $scope.gridPolicyApi = gridApi; + }, + enableSorting: true, + enableFiltering: true, + showTreeExpandNoChildren: true, + paginationPageSizes: [10, 20, 50, 100], + paginationPageSize: 20, + columnDefs: [{name: 'policyName', displayName : 'Policy Name', sort: { direction: 'asc', priority: 0 }}, + {name: 'activeVersion', displayName : 'Version'}, + {name: 'modifiedDate', displayName : 'Last Modified',type: 'date', cellFilter: 'date:\'yyyy-MM-dd HH:MM:ss a\'' }] }; PolicyAppService.getData('get_AutoPushPoliciesContainerData').then(function (data) { - $scope.loading = false; - var j = data; - $scope.data = JSON.parse(j.data); - console.log($scope.data); - $scope.policydatas =JSON.parse($scope.data.policydatas); - console.log($scope.policydatas); - }, function (error) { - console.log("failed"); - }); + $scope.loading = false; + var j = data; + $scope.data = JSON.parse(j.data); + $scope.policydatas =JSON.parse($scope.data.policydatas); + }); $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."); - } - }); + var policySelection = $scope.gridPolicyApi.selection.getSelectedRows(); + 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 + }; + 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"); + }); + }, + error : function(data){ + Notification.error("Error Occured while Pushing Policy."); + } + }); - } + } }; - - }); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardCRUDController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardCRUDController.js index ce1af6b1a..d3f093697 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardCRUDController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardCRUDController.js @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018, 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. @@ -19,20 +19,18 @@ */ app.controller('policyDashboardCRUDDataController', function ($scope, PolicyAppService, modalService, $modal){ - console.log("policyDashboardCRUDDataController called"); - - $('#dashBoardAdvanceSearch').hide(); - + + $('#dashBoardAdvanceSearch').hide(); + $scope.papCRUDTableDatasTemp = []; $scope.dashboardAdsearch = { isDelected: 'both', stage: 'both', scope: "", ttlDate_after: "", ttlDate_before: ""}; PolicyAppService.getData('get_DashboardPolicyCRUDData').then(function(data){ - var j = data; - $scope.data = JSON.parse(j.data); - console.log($scope.data); - $scope.papStatusCRUDDatas =JSON.parse($scope.data.papStatusCRUDData); + var j = data; + $scope.data = JSON.parse(j.data); + $scope.papStatusCRUDDatas =JSON.parse($scope.data.papStatusCRUDData); if($scope.papStatusCRUDDatas != null){ for(i = 0; i < $scope.papStatusCRUDDatas.length; i++){ $scope.papCRUDTableDatasTemp.push($scope.papStatusCRUDDatas[i].map); @@ -40,117 +38,106 @@ app.controller('policyDashboardCRUDDataController', function ($scope, PolicyAppS $scope.papCRUDTableDatas = $scope.papCRUDTableDatasTemp; } - - },function(error){ - console.log("failed"); - }); + + }); - $scope.papCRUDStatusDatas = { - data : 'papCRUDTableDatas', - enableFiltering: true, - columnDefs: [{ field: 'id', displayName :'id'}, - {field: 'scope', displayName :'Scope'}, - {field: 'policyName', displayName :'Policy Name'}, - {field: 'version', displayName :'Version'}, - {field: 'stage', displayName :'Stage'}, - {field: 'createdBy', displayName :'Created By'}, - {field: 'deleted', displayName :'Deleted'}, - {field: 'deleteReasonCode', displayName :'Deleted Reason'}, - {field: 'deletedBy' , displayName :'Deleted By'}, - {field: 'modifiedBy' , displayName :'Modified By'}, - {field: 'createdDate', displayName :'Created Date'}, - {field: 'modifiedDate', displayName :'Modified Date'} - ], + $scope.papCRUDStatusDatas = { + data : 'papCRUDTableDatas', + enableFiltering: true, + columnDefs: [{ field: 'id', displayName :'id'}, + {field: 'scope', displayName :'Scope'}, + {field: 'policyName', displayName :'Policy Name'}, + {field: 'version', displayName :'Version'}, + {field: 'stage', displayName :'Stage'}, + {field: 'createdBy', displayName :'Created By'}, + {field: 'deleted', displayName :'Deleted'}, + {field: 'deleteReasonCode', displayName :'Deleted Reason'}, + {field: 'deletedBy' , displayName :'Deleted By'}, + {field: 'modifiedBy' , displayName :'Modified By'}, + {field: 'createdDate', displayName :'Created Date'}, + {field: 'modifiedDate', displayName :'Modified Date'} + ], onRegisterApi: function(gridApi){ - $scope.gridApi = gridApi; + $scope.gridApi = gridApi; } - }; - + }; + $('#ttlDate_after').datepicker({ - dateFormat: 'yy-mm-dd', - changeMonth: true, - changeYear: true, - onSelect: function(date) { - angular.element($('#ttlDate_after')).triggerHandler('input'); - } + dateFormat: 'yy-mm-dd', + changeMonth: true, + changeYear: true, + onSelect: function(date) { + angular.element($('#ttlDate_after')).triggerHandler('input'); + } }); $('#ttlDate_before').datepicker({ - dateFormat: 'yy-mm-dd', - changeMonth: true, - changeYear: true, - onSelect: function(date) { - angular.element($('#ttlDate_before')).triggerHandler('input'); - } + dateFormat: 'yy-mm-dd', + changeMonth: true, + changeYear: true, + onSelect: function(date) { + angular.element($('#ttlDate_before')).triggerHandler('input'); + } }); $scope.refresh = function(){ - $scope.modal('advancedSearch', true); - $scope.temp.policy = ""; + $scope.modal('advancedSearch', true); + $scope.temp.policy = ""; }; - $scope.advancedSearch = function(){ + $scope.advancedSearch = function(){ - $('#dashBoardAdvanceSearch').toggle(); - if($('#advancedSearchArrow').hasClass('arrowdown')){ - $('#advancedSearchArrow').removeClass("arrowdown"); - $('#advancedSearchArrow').addClass("arrowup"); - - }else{ - $('#advancedSearchArrow').removeClass("arrowup"); - $('#advancedSearchArrow').addClass("arrowdown"); - } - } - + $('#dashBoardAdvanceSearch').toggle(); + if($('#advancedSearchArrow').hasClass('arrowdown')){ + $('#advancedSearchArrow').removeClass("arrowdown"); + $('#advancedSearchArrow').addClass("arrowup"); + + }else{ + $('#advancedSearchArrow').removeClass("arrowup"); + $('#advancedSearchArrow').addClass("arrowdown"); + } + } + $scope.startAdvancedSearch = function(data){ - - console.log("startAdvancedSearch called"); - console.log(data.isDelected); - console.log(data.stage); - console.log(data.scope); - console.log(data.ttlDate_after); - console.log(data.ttlDate_before); - - if(data.scope == null){ - return; - } - + + + if(data.scope == null){ + return; + } + var uuu = "dashboardController/dashboardAdvancedSearch.htm"; var postData={policyData: data}; - $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - console.log("dashboardAdvancedSearch data returned: " + data); - + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ - - var j = data; - $scope.data = JSON.parse(j.data); - console.log($scope.data); - $scope.papStatusCRUDDatas =JSON.parse($scope.data.policyStatusCRUDData); - - $scope.papCRUDTableDatasTemp = []; - - for(i = 0; i < $scope.papStatusCRUDDatas.length; i++){ - $scope.papCRUDTableDatasTemp.push($scope.papStatusCRUDDatas[i].map); - } - - $scope.papCRUDTableDatas = $scope.papCRUDTableDatasTemp; - - $scope.gridApi.grid.refresh(); + + var j = data; + $scope.data = JSON.parse(j.data); + $scope.papStatusCRUDDatas =JSON.parse($scope.data.policyStatusCRUDData); + + $scope.papCRUDTableDatasTemp = []; + + for(i = 0; i < $scope.papStatusCRUDDatas.length; i++){ + $scope.papCRUDTableDatasTemp.push($scope.papStatusCRUDDatas[i].map); + } + + $scope.papCRUDTableDatas = $scope.papCRUDTableDatasTemp; + + $scope.gridApi.grid.refresh(); }); - }, - error : function(data){ - console.log("dashboardAdvancedSearch Failed: data returned as " + data); - } - }); + }, + error : function(data){ + } + }); }; });
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWTermListDictController.js 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() { diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSHeaderDefaultValuesDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSHeaderDefaultValuesDictGridController.js index 4e6b9696b..e12db92c7 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSHeaderDefaultValuesDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSHeaderDefaultValuesDictGridController.js @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018, 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. @@ -23,51 +23,31 @@ app.controller('msHeaderDefaultValuesDictGridController', function ($scope, Poli 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_MicroServiceModelsDataByName').then(function (data) { var j = data; $scope.data = JSON.parse(j.data); - console.log($scope.data); $scope.microServiceModelsDictionaryDatas = JSON.parse($scope.data.microServiceModelsDictionaryDatas); - console.log($scope.microServiceModelsDictionaryDatas); - }, function (error) { - console.log("failed"); }); PolicyAppService.getData('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('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"); }); PolicyAppService.getData('get_LockDownData').then(function(data){ @@ -81,8 +61,6 @@ app.controller('msHeaderDefaultValuesDictGridController', function ($scope, Poli $scope.msHeaderDefaultValuesDictionaryGrid.columnDefs[0].visible = true; $scope.gridApi.grid.refresh(); } - },function(error){ - console.log("failed"); }); $scope.msHeaderDefaultValuesDictionaryGrid = { @@ -116,7 +94,6 @@ app.controller('msHeaderDefaultValuesDictGridController', function ($scope, Poli } }); modalInstance.result.then(function(response){ - console.log('response', response); $scope.microServiceHeaderDefaultDatas=response.microServiceHeaderDefaultDatas; }); }; @@ -137,7 +114,6 @@ app.controller('msHeaderDefaultValuesDictGridController', function ($scope, Poli } }); modalInstance.result.then(function(response){ - console.log('response', response); $scope.modelAttributeDictionaryDataa = response.modelAttributeDictionaryDatas; }); }; @@ -157,7 +133,6 @@ app.controller('msHeaderDefaultValuesDictGridController', function ($scope, Poli $scope.$apply(function(){$scope.microServiceHeaderDefaultDatas=data.microServiceHeaderDefaultDatas;}); }, error : function(data){ - console.log(data); modalService.showFailure("Fail","Error while deleting: "+ data.responseText); } }); |