2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 var editPDPGrouppopupController = function ($scope, $modalInstance, message, modalService, $modal, Notification){
22 if(message.pdpGroupData==null)
23 $scope.label='Add New PDP Group'
25 $scope.label='Edit PDP Group'
26 $scope.disableCd=true;
27 $scope.policies = message.pdpGroupData.policies;
28 $scope.pdps = message.pdpGroupData.pdps;
29 $scope.selectedPdp = message.pdpGroupData;
31 $scope.editPDPGroup = message.pdpGroupData;
33 $scope.policiesGrid = {
35 enableFiltering: true,
37 { field: 'root', displayName : 'Root', width : '10%'},
38 { field: 'name', displayName : 'Name' },
39 { field: 'version' , width : '10%'},
46 enableFiltering: true,
48 field: 'id', enableFiltering: false, headerCellTemplate: '' +
49 '<button id=\'New\' ng-click="grid.appScope.createNewPDPInGroup()" class="btn btn-success">' + 'Create PDP</button>',
51 '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPDPInGroup(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' +
52 '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePDPFromGroup(row.entity)" ><i class="fa fa-trash-o"></i></button> '+
53 '<button type="button" class="btn btn-success" ng-click="grid.appScope.statusOfPDP(row.entity.status)" >Status</button>', width: '15%'
55 { field: 'id', displayName : 'PDP URL'},
56 { field: 'jmxPort', displayName : 'JMX Port' , width : '10%' },
57 { field: 'name' , displayName : 'PDP Name'},
58 { field: 'description' }
62 $scope.createNewPDPInGroup = function(pdpInGroup) {
63 $scope.pdpInGroup = null;
64 var modalInstance = $modal.open({
65 backdrop: 'static', keyboard: false,
66 templateUrl : 'create_newPDP_InGroup.html',
67 controller: 'pdpInGroupController',
69 message: function () {
71 data: $scope.pdpInGroup,
72 activePDP : $scope.selectedPdp
78 modalInstance.result.then(function(response){
79 console.log('response', response);
80 $scope.data=response.data;
84 $scope.editPDPInGroup = function(pdpInGroup) {
85 $scope.editPDPInGroupData = pdpInGroup;
86 var modalInstance = $modal.open({
87 backdrop: 'static', keyboard: false,
88 templateUrl: 'create_newPDP_InGroup.html',
89 controller: 'pdpInGroupController',
91 message: function () {
93 pdpInGroup : $scope.editPDPInGroupData,
94 activePDP : $scope.selectedPdp
100 modalInstance.result.then(function(response){
101 console.log('response', response);
102 $scope.data=response.data;
106 $scope.deletePDPFromGroup = function(data){
107 modalService.popupConfirmWin("Confirm","You are about to delete the PDP Group : "+data.name+". Do you want to continue?",
109 var uuu = "pdp_Group/remove_pdpFromGroup.htm";
110 var postData={data: data,
111 activePDP : $scope.selectedPdp};
116 contentType: 'application/json',
117 data: JSON.stringify(postData),
118 success : function(data){
119 $scope.$apply(function(){$scope.data=data.data;});
120 Notification.success("PDP Group Deleted Successfully");
122 error : function(data){
124 Notification.error("Error Occured While Deleting a PDP Group")
125 //modalService.showFailure("Fail","Error while deleting: "+ data.responseText);
132 $scope.statusOfPDP = function(status){
133 $scope.pdpStatus = status;
134 console.log($scope.pdpStatus);
135 var modalInstance = $modal.open({
136 backdrop: 'static', keyboard: false,
137 templateUrl: 'pdpGroupStatusWindow.html',
138 controller: 'pdpGroupStatusController',
140 message: function () {
142 status : $scope.pdpStatus,
143 policies : $scope.policies
149 modalInstance.result.then(function(response){
150 console.log('response', response);
151 $scope.data=response.data;
155 $scope.savePDPGroup = function(pdpGroupData) {
156 var uuu = "pdp_Group/save_pdp_group.htm";
157 var postData={pdpGroupData: pdpGroupData};
162 contentType: 'application/json',
163 data: JSON.stringify(postData),
164 success : function(data){
165 $scope.$apply(function(){
166 $scope.data=data.data;});
167 console.log($scope.data);
168 $modalInstance.close({data:$scope.data});
170 error : function(data){
171 alert("Error while saving.");
176 $scope.close = function() {
177 $modalInstance.close();