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=========================================================
20 app.controller('editPDPGrouppopupController' , function ($scope, $modalInstance, message, modalService, $modal, Notification){
21 if(message.pdpGroupData==null)
22 $scope.label='Add New PDP Group'
24 $scope.label='Edit PDP Group'
25 $scope.disableCd=true;
26 $scope.policies = message.pdpGroupData.policies;
27 $scope.pdps = message.pdpGroupData.pdps;
28 $scope.selectedPdp = message.pdpGroupData;
30 $scope.editPDPGroup = message.pdpGroupData;
32 $scope.policiesGrid = {
34 enableFiltering: true,
36 { field: 'root', displayName : 'Root', width : '10%'},
37 { field: 'name', displayName : 'Name' },
38 { field: 'version' , width : '10%'},
45 enableFiltering: true,
47 field: 'id', enableFiltering: false, headerCellTemplate: '' +
48 '<button id=\'New\' ng-click="grid.appScope.createNewPDPInGroup()" class="btn btn-success">' + 'Create PDP</button>',
50 '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editPDPInGroup(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' +
51 '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deletePDPFromGroup(row.entity)" ><i class="fa fa-trash-o"></i></button> '+
52 '<button type="button" class="btn btn-success" ng-click="grid.appScope.statusOfPDP(row.entity.status)" >Status</button>', width: '25%'
54 { field: 'id', displayName : 'PDP URL'},
55 { field: 'jmxPort', displayName : 'JMX Port' , width : '10%' },
56 { field: 'name' , displayName : 'PDP Name'},
57 { field: 'description' }
61 $scope.createNewPDPInGroup = function(pdpInGroup) {
62 $scope.pdpInGroup = null;
63 var modalInstance = $modal.open({
64 backdrop: 'static', keyboard: false,
65 templateUrl : 'create_newPDP_InGroup.html',
66 controller: 'pdpInGroupController',
68 message: function () {
70 data: $scope.pdpInGroup,
71 activePDP : $scope.selectedPdp
77 modalInstance.result.then(function(response){
78 console.log('response', response);
79 $scope.data=response.data;
83 $scope.editPDPInGroup = function(pdpInGroup) {
84 $scope.editPDPInGroupData = pdpInGroup;
85 var modalInstance = $modal.open({
86 backdrop: 'static', keyboard: false,
87 templateUrl: 'create_newPDP_InGroup.html',
88 controller: 'pdpInGroupController',
90 message: function () {
92 pdpInGroup : $scope.editPDPInGroupData,
93 activePDP : $scope.selectedPdp
99 modalInstance.result.then(function(response){
100 console.log('response', response);
101 $scope.data=response.data;
105 $scope.deletePDPFromGroup = function(data){
106 modalService.popupConfirmWin("Confirm","You are about to delete the PDP Group : "+data.name+". Do you want to continue?",
108 var uuu = "pdp_Group/remove_pdpFromGroup.htm";
109 var postData={data: data,
110 activePDP : $scope.selectedPdp};
115 contentType: 'application/json',
116 data: JSON.stringify(postData),
117 success : function(data){
118 $scope.$apply(function(){$scope.data=data.data;});
119 Notification.success("PDP Group Deleted Successfully");
121 error : function(data){
123 Notification.error("Error Occured While Deleting a PDP Group")
124 //modalService.showFailure("Fail","Error while deleting: "+ data.responseText);
131 $scope.statusOfPDP = function(status){
132 $scope.pdpStatus = status;
133 console.log($scope.pdpStatus);
134 var modalInstance = $modal.open({
135 backdrop: 'static', keyboard: false,
136 templateUrl: 'pdpGroupStatusWindow.html',
137 controller: 'pdpGroupStatusController',
139 message: function () {
141 status : $scope.pdpStatus,
142 policies : $scope.policies
148 modalInstance.result.then(function(response){
149 console.log('response', response);
150 $scope.data=response.data;
154 $scope.savePDPGroup = function(pdpGroupData) {
155 var uuu = "pdp_Group/save_pdp_group.htm";
156 var postData={pdpGroupData: pdpGroupData};
161 contentType: 'application/json',
162 data: JSON.stringify(postData),
163 success : function(data){
164 $scope.$apply(function(){
165 $scope.data=data.data;});
166 console.log($scope.data);
167 $modalInstance.close({data:$scope.data});
169 error : function(data){
170 alert("Error while saving.");
175 $scope.close = function() {
176 $modalInstance.close();