Update css file name in conf.py
[policy/engine.git] / POLICY-SDK-APP / src / main / webapp / app / policyApp / policy-models / Editor / PolicyTemplateController / ExportPolicyController.js
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP Policy Engine
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20 var app = appDS2;
21 app.controller('exportPolicyController', function ($scope, $window, PolicyAppService, modalService, $modal, Notification){
22     $( "#dialog" ).hide();
23     $scope.policydatas = [];
24      $scope.linkEnable = true;  
25      $scope.gridExportOptions = {
26                  data : 'policydatas',
27                  onRegisterApi: function(gridApi) {
28                          $scope.gridPolicyApi = gridApi;
29                  },
30                  enableSorting: true,
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\'' }]
38      };
39     
40     $scope.files;
41     PolicyAppService.getData('get_AutoPushPoliciesContainerData').then(function (data) {
42         $scope.loading = false;
43         var j = data;
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);
48     }, function (error) {
49         console.log("failed");
50     });
51     
52     $scope.urlLink;
53     $scope.download = function(){
54          var policySelection = $scope.gridPolicyApi.selection.getSelectedRows();
55          console.log(policySelection);
56         var finalData = {
57             "policyDatas": policySelection
58         };
59         console.log(finalData);
60         var uuu = "policy_download/exportPolicy.htm";
61         var postData={exportData: finalData};
62         $.ajax({
63             type : 'POST',
64             url : uuu,
65             dataType: 'json',
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");
74                 });
75                 console.log($scope.data);
76             },
77             error : function(data){             
78                 Notification.error("Error Occured while Exporting Policy.");
79             }
80         });
81
82     };
83     
84     $scope.close = function() {
85         $modalInstance.close();
86     }; 
87
88 });