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.policydatas = [];
24 $scope.linkEnable = true;
25 $scope.gridExportOptions = {
27 onRegisterApi: function(gridApi) {
28 $scope.gridPolicyApi = gridApi;
31 enableFiltering: true,
32 showTreeExpandNoChildren: true,
33 paginationPageSizes: [10, 20, 50, 100],
34 paginationPageSize: 20,
35 columnDefs: [{name: 'policyName', displayName : 'Policy Name', sort: { direction: 'asc', priority: 0 }},
36 {name: 'activeVersion', displayName : 'Version'},
37 {name: 'modifiedDate', displayName : 'Last Modified',type: 'date', cellFilter: 'date:\'yyyy-MM-dd HH:MM:ss a\'' }]
41 PolicyAppService.getData('get_AutoPushPoliciesContainerData').then(function (data) {
42 $scope.loading = false;
44 $scope.data = JSON.parse(j.data);
45 console.log($scope.data);
46 $scope.policydatas =JSON.parse($scope.data.policydatas);
47 console.log($scope.policydatas);
49 console.log("failed");
53 $scope.download = function(){
54 var policySelection = $scope.gridPolicyApi.selection.getSelectedRows();
55 console.log(policySelection);
57 "policyDatas": policySelection
59 console.log(finalData);
60 var uuu = "policy_download/exportPolicy.htm";
61 var postData={exportData: finalData};
66 contentType: 'application/json',
67 data: JSON.stringify(postData),
68 success : function(data){
69 $scope.$apply(function(){
70 $scope.data=data.data;
71 var url = '../' + $scope.data;
72 window.location = url;
73 Notification.success("Policies Exported Successfully");
75 console.log($scope.data);
77 error : function(data){
78 Notification.error("Error Occured while Exporting Policy.");
84 $scope.close = function() {
85 $modalInstance.close();