NonRT-RIC A1 Northbound API
[nonrtric.git] / sdnc-a1-controller / oam / SdncReports / SdncReportsApi / src / main / webapp / js / sdnc-services / sdnc-viewReport-service.js
1 /*
2 * ============LICENSE_START=======================================================
3 * ONAP : SDNC-FEATURES
4 * ================================================================================
5 * Copyright 2018 TechMahindra
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
21 myApp.service('viewReportService', ['$http', function($http) {
22     this.getData = function(startDate, endDate, deviceName) {
23
24         var data = {};
25         if (startDate != null && endDate != null && deviceName != null) {
26
27             data.startdate = startDate;
28             data.enddate = endDate;
29             data.devicename = deviceName;
30
31         }
32         var config = {
33             params: '',
34             headers: {
35                 'Accept': 'application/json'
36             }
37         };
38
39         var sdate = new Date(startDate);
40         var edate = new Date(endDate);
41         
42         var objTestList = {};
43         
44         return $http.get('/findReportByDeviceIP/'+sdate+'/'+edate+'/'+deviceName,config)
45             .then(function(result) {
46                 console.log("--viewReportService::getdata::TestResponse--", JSON.stringify(result));
47                 objTestList = result.data;
48                 console.log("--viewReportService::getdata::TestResponse--", +JSON.stringify(objTestList));
49                 return result;
50             });
51     };
52
53 }]);