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('removeGroupPoliciesController' , function ($scope, $modalInstance, message, Notification){
21 if(message.selectedPdpGroupData !=null){
22 $scope.label='Remove PDP Group Policies'
23 $scope.disableCd=true;
25 $scope.policies = message.selectedPdpGroupData.policies;
26 $scope.pdpGroupData = message.selectedPdpGroupData;
28 $scope.removePoliciesGrid = {
30 enableFiltering: true,
32 { field: 'root', displayName : 'Root', width : '10%'},
33 { field: 'name', displayName : 'Name' },
34 { field: 'version' , width : '10%'},
39 $scope.removePoliciesGrid.onRegisterApi = function(gridApi){
40 //set gridApi on scope
41 $scope.gridApi = gridApi;
42 gridApi.selection.on.rowSelectionChanged($scope,function(row){
43 var msg = 'row selected ' + row.isSelected;
46 gridApi.selection.on.rowSelectionChangedBatch($scope,function(rows){
47 var msg = 'rows changed ' + rows.length;
51 $scope.removePolicies = function() {
52 $scope.removeGroupData = [];
53 angular.forEach($scope.gridApi.selection.getSelectedRows(), function (data, index) {
54 $scope.removeGroupData.push(data);
56 if($scope.removeGroupData.length > 0){
57 var uuu = "auto_Push/remove_GroupPolicies.htm";
58 var postData={data: $scope.removeGroupData,
59 activePdpGroup : $scope.pdpGroupData};
64 contentType: 'application/json',
65 data: JSON.stringify(postData),
66 success : function(data){
67 $scope.$apply(function(){
68 $scope.data=data.data;});
69 console.log($scope.data);
70 $modalInstance.close({data:$scope.data});
71 Notification.success("Policy Removed Successfully");
73 error : function(data){
74 Notification.error("Error Occured while removing Policy");
78 Notification.error("Please select atleast one Policy to remove");
82 $scope.close = function() {
83 $modalInstance.close();