[POLICY-73] replace openecomp for policy-engine
[policy/engine.git] / POLICY-SDK-APP / src / main / webapp / app / policyApp / controller / dashboardController.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 app.controller('policyDashboardHealthController', function ($scope, PolicyAppService, modalService, $modal){
21         $( "#dialog" ).hide();
22     $scope.pdpTableDatas = [];
23     $scope.papTableDatas = [];
24     $scope.policyActivityTableDatas = [];
25     
26     PolicyAppService.getData('get_DashboardSystemAlertData').then(function(data){
27                 var j = data;
28                 $scope.data = JSON.parse(j.data);
29                 console.log($scope.data);
30                 $scope.systemAlertsTableDatas =JSON.parse($scope.data.systemAlertsTableDatas);
31         },function(error){
32                 console.log("failed");
33         });
34
35     PolicyAppService.getData('get_DashboardPAPStatusData').then(function(data){
36                 var j = data;
37                 $scope.data = JSON.parse(j.data);
38                 console.log($scope.data);
39                 $scope.papTableMapDatas =JSON.parse($scope.data.papTableDatas);
40         if($scope.papTableMapDatas != null){
41             for(i = 0; i < $scope.papTableMapDatas.length; i++){
42                 $scope.papTableDatas.push($scope.papTableMapDatas[i].map);
43             }
44         }
45         },function(error){
46                 console.log("failed");
47         });
48
49     PolicyAppService.getData('get_DashboardPDPStatusData').then(function(data){
50                 var j = data;
51                 $scope.data = JSON.parse(j.data);
52                 console.log($scope.data);
53         $scope.pdpTableMapDatas =JSON.parse($scope.data.pdpTableDatas);
54         if($scope.pdpTableMapDatas != null) {
55             for (i = 0; i < $scope.pdpTableMapDatas.length; i++) {
56                 $scope.pdpTableDatas.push($scope.pdpTableMapDatas[i].map);
57             }
58         }
59         },function(error){
60                 console.log("failed");
61         });
62
63     PolicyAppService.getData('get_DashboardPolicyActivityData').then(function(data){
64                 var j = data;
65                 $scope.data = JSON.parse(j.data);
66                 console.log($scope.data);
67                 $scope.policyActivityTableMapDatas =JSON.parse($scope.data.policyActivityTableDatas);
68         if($scope.policyActivityTableMapDatas != null) {
69             for (i = 0; i < $scope.policyActivityTableMapDatas.length; i++) {
70                 $scope.policyActivityTableDatas.push($scope.policyActivityTableMapDatas[i].map);
71             }
72         }
73         },function(error){
74                 console.log("failed");
75         });
76         
77         $scope.availableGridHealthDatas = {
78                         data : 'systemAlertsTableDatas',
79                             enableFiltering: true,
80                             columnDefs: [{ field: 'id'},
81                               { field: 'type'},
82                               { field: 'system'},
83                               {field: 'logtype'},
84                               {field : 'date' ,type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' },
85                               {field : 'description'}
86                           ],      
87         };
88
89         $scope.papStatusDatas = {
90                 data : 'papTableDatas',
91                 enableFiltering: true,
92                 columnDefs: [{ field: 'system'},
93                         { field: 'status'},
94                         { field: 'noOfPolicy'},
95                         {field: 'noOfConnectedTrap'}
96                 ],
97         };
98
99         $scope.pdpStatusDatas = {
100                 data : 'pdpTableDatas',
101                 enableFiltering: true,
102                 columnDefs: [{ field: 'id'},
103                         { field: 'name'},
104                         { field: 'groupname'},
105                         {field: 'status'},
106                         {field : 'description' },
107                         {field : 'permitCount'},
108                         {field : 'denyCount'},
109                         {field : 'naCount'}
110                 ],
111         };
112
113         $scope.policyActivityDatas = {
114                 data : 'policyActivityTableDatas',
115                 enableFiltering: true,
116                 columnDefs: [{ field: 'policyId'},
117                         { field: 'fireCount'},
118                         { field: 'system'}
119                 ],
120         };
121 });