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 app.controller('exportPolicyController', function ($scope, $window, PolicyAppService, modalService, $modal, Notification){
22 $( "#dialog" ).hide();
23 $scope.linkEnable = true;
24 $scope.gridOptions = {
26 onRegisterApi: function(gridApi) {
27 $scope.gridPolicyApi = gridApi;
30 enableFiltering: true,
31 showTreeExpandNoChildren: true,
32 paginationPageSizes: [10, 20, 50, 100],
33 paginationPageSize: 20,
34 columnDefs: [{name: 'policyName', displayName : 'Policy Name', sort: { direction: 'asc', priority: 0 }},
35 {name: 'activeVersion', displayName : 'Version'},
36 {name: 'modifiedDate', displayName : 'Last Modified',type: 'date', cellFilter: 'date:\'yyyy-MM-dd HH:MM:ss a\'' }]
40 PolicyAppService.getData('get_AutoPushPoliciesContainerData').then(function (data) {
41 $scope.loading = false;
43 $scope.data = JSON.parse(j.data);
44 console.log($scope.data);
45 $scope.policydatas =JSON.parse($scope.data.policydatas);
46 console.log($scope.policydatas);
48 console.log("failed");
52 $scope.download = function(){
53 var policySelection = $scope.gridPolicyApi.selection.getSelectedRows();
54 console.log(policySelection);
56 "policyDatas": policySelection
58 console.log(finalData);
59 var uuu = "policy_download/exportPolicy.htm";
60 var postData={exportData: finalData};
65 contentType: 'application/json',
66 data: JSON.stringify(postData),
67 success : function(data){
68 $scope.$apply(function(){
69 $scope.data=data.data;
70 var url = '../' + $scope.data;
71 window.location = url;
72 Notification.success("Policies Exported Successfully");
74 console.log($scope.data);
76 error : function(data){
77 Notification.error("Error Occured while Exporting Policy.");
83 $scope.close = function() {
84 $modalInstance.close();