| | |
| | | 'app', 'angular' |
| | | ], |
| | | function (app, angular) { |
| | | app.controller('apiMonitorController', ['$scope', '$rootScope', '$log', '$resourceProvider','SweetAlert', '$timeout', '$filter', |
| | | function ($scope, $rootScope, $log, $resourceProvider, SweetAlert, $timeout, $filter) { |
| | | app.controller('apiMonitorController', ['$scope', '$rootScope', '$log', '$resourceProvider','SweetAlert', '$timeout', '$filter', 'Api', |
| | | function ($scope, $rootScope, $log, $resourceProvider, SweetAlert, $timeout, $filter, Api) { |
| | | |
| | | $scope.fn = { |
| | | |
| | | drawChart : drawChart, |
| | | changeSearchPeriod : changeSearchPeriod |
| | | }; |
| | | |
| | | $scope.vm = { |
| | | form : { |
| | | |
| | | search : { |
| | | searchPeriod : "LAST_SEVEN_DAYS" |
| | | }, |
| | | apiMonitorVos : [], |
| | | issueTypeVos : [], |
| | | chartData : { |
| | | rows: [], |
| | | columns: [], |
| | | options: { |
| | | chart: { |
| | | title: '일감 유형별 API 사용 현황', |
| | | subtitle: '최근 15일' |
| | | }, |
| | | width: 900, |
| | | height: 500 |
| | | } |
| | | } |
| | | }; |
| | | |
| | | function changeSearchPeriod() { |
| | | drawChart(); |
| | | } |
| | | |
| | | $scope.fn.drawChart(); |
| | | |
| | | function drawChart() { |
| | | |
| | | var content = { |
| | | searchPeriod : $scope.vm.search.searchPeriod, |
| | | searchStartDate : "", |
| | | searchEndDate : "" |
| | | }; |
| | | |
| | | Api.findHistory($resourceProvider.getContent(content, |
| | | $resourceProvider.getPageContent(0, 0))).then(function (result) { |
| | | |
| | | if (result.data.message.status === "success") { |
| | | if ( result.data.data != null) { |
| | | $scope.vm.chartData.columns = []; |
| | | // $scope.vm.chartData.columns.push({id:'number', name:"날짜"}); |
| | | // $scope.vm.chartData.columns.push({id:'number', name:"홈페이지 변조 탐지"}); |
| | | // $scope.vm.chartData.columns.push({id:'number', name:"경유지 탐지"}); |
| | | // $scope.vm.chartData.columns.push({id:'number', name:"일감 조회"}); |
| | | |
| | | $scope.vm.chartData.rows = []; |
| | | // $scope.vm.chartData.rows.push([1, 37.8, 80.8, 41.8]); |
| | | // $scope.vm.chartData.rows.push([2, 30.9, 69.5, 32.4]); |
| | | // $scope.vm.chartData.rows.push([3, 25.4, 57, 25.7]); |
| | | // $scope.vm.chartData.rows.push([4, 11.7, 18.8, 10.5, 1.0]); |
| | | |
| | | let apiMonitorVos = result.data.data.apiMonitorVos; |
| | | let issueTypeVos = result.data.data.issueTypeVos; |
| | | |
| | | $scope.vm.apiMonitorVos = apiMonitorVos; |
| | | $scope.vm.issuTypeVos = issueTypeVos; |
| | | |
| | | $scope.vm.chartData.columns.push({id: 'number', name: "날짜"}); |
| | | issueTypeVos.forEach(function (issueTypeVo) { |
| | | $scope.vm.chartData.columns.push({id: 'number', name: issueTypeVo.name}); |
| | | }); |
| | | |
| | | var index = 1; |
| | | apiMonitorVos.forEach(function (apiMonitorVo) { |
| | | var row = []; |
| | | row.push(index); |
| | | if (apiMonitorVo.issueTypeCountList != null) { |
| | | apiMonitorVo.issueTypeCountList.forEach(function (count) { |
| | | row.push(count); |
| | | }); |
| | | } |
| | | $scope.vm.chartData.rows.push(row); |
| | | index++; |
| | | }); |
| | | |
| | | $scope.$broadcast("drawChart"); |
| | | } |
| | | } |
| | | else { |
| | | SweetAlert.swal($filter("translate")("api.failedToApiMonitor"), result.data.message.message, "error"); // "API 기록 조회 실패" |
| | | } |
| | | }); |
| | | |
| | | // data.addColumn('number', '날짜'); |
| | | // data.addColumn('number', '홈페이지 변조 탐지'); |
| | | // data.addColumn('number', '경유지 탐지'); |
| | | // data.addColumn('number', '일감 조회'); |
| | | // $scope.vm.chartData.columns.push({id:'number', name:"날짜"}); |
| | | // $scope.vm.chartData.columns.push({id:'number', name:"홈페이지 변조 탐지"}); |
| | | // $scope.vm.chartData.columns.push({id:'number', name:"경유지 탐지"}); |
| | | // $scope.vm.chartData.columns.push({id:'number', name:"일감 조회"}); |
| | | // $scope.vm.chartData.columns.push({id:'number', name:"일감 조회ㅁ"}); |
| | | // |
| | | // $scope.vm.chartData.rows.push([1, 37.8, 80.8, 41.8]); |
| | | // $scope.vm.chartData.rows.push([2, 30.9, 69.5, 32.4]); |
| | | // $scope.vm.chartData.rows.push([3, 25.4, 57, 25.7]); |
| | | // $scope.vm.chartData.rows.push([4, 11.7, 18.8, 10.5, 1.0]); |
| | | |
| | | // data.addRows([ |
| | | // [1, 37.8, 80.8, 41.8, 0], |
| | | // [2, 30.9, 69.5, 32.4, 0], |
| | | // [3, 25.4, 57, 25.7, 0], |
| | | // [4, 11.7, 18.8, 10.5, 0], |
| | | // [5, 11.9, 17.6, 10.4, 0], |
| | | // [6, 8.8, 13.6, 7.7, 0], |
| | | // [7, 7.6, 12.3, 9.6, 0], |
| | | // [8, 12.3, 29.2, 10.6, 0], |
| | | // [9, 16.9, 42.9, 14.8, 0], |
| | | // [10, 12.8, 30.9, 11.6, 0], |
| | | // [11, 5.3, 7.9, 4.7, 0], |
| | | // [12, 6.6, 8.4, 5.2, 0], |
| | | // [13, 4.8, 6.3, 3.6, 0], |
| | | // [14, 4.2, 6.2, 3.4, 0] |
| | | // ]); |
| | | } |
| | | }]); |
| | | }); |