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('policyDashboardController', function ($scope, PolicyAppService, modalService, $modal, uiGridConstants,Grid){
21 $( "#dialog" ).hide();
23 $scope.loading = true;
24 PolicyAppService.getData('get_DashboardLoggingData').then(function(data){
25 $scope.loading = false;
27 $scope.data = JSON.parse(j.data);
28 console.log($scope.data);
29 $scope.availableLoggingDatas =JSON.parse($scope.data.availableLoggingDatas);
30 console.log($scope.availableLoggingDatas);
32 console.log("failed");
36 $scope.availableGridLoggingDatas = {
37 data : 'availableLoggingDatas',
38 enableFiltering: true,
39 columnDefs: [{ field: 'id'},
43 {field : 'date' ,type: 'date', cellFilter: 'date:\'yyyy-MM-dd HH:MM:ss a\'' },
44 {field : 'description'}
47 enableSelectAll: true,
48 exporterCsvFilename: 'DashboardLogging.csv',
49 exporterMenuPdf: false,
50 exporterPdfDefaultStyle: {fontSize: 9},
51 exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
52 exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
53 exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
54 exporterPdfFooter: function ( currentPage, pageCount ) {
55 return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
57 exporterPdfCustomFormatter: function ( docDefinition ) {
58 docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
59 docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
62 exporterFieldCallback: function(grid, row, col, input) {
63 if( col.name == 'date') {
64 var date = new Date(input);
65 return date.toString("yyyy-MM-dd HH:MM:ss a");
70 exporterPdfOrientation: 'portrait',
71 exporterPdfPageSize: 'LETTER',
72 exporterPdfMaxGridWidth: 500,
73 exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
74 onRegisterApi: function(gridApi){
75 $scope.gridApi = gridApi;