From f51a3e2b128f0b96bc9ed67dfc3081f4b41d1303 Mon Sep 17 00:00:00 2001 From: "Kishore Reddy, Gujja (kg811t)" Date: Fri, 8 Jun 2018 16:40:16 -0400 Subject: Junit Test Cases & Raptors Issue-ID: PORTAL-273. PORTAL-301 Covered JUNITS for sdk modules and RAPTOR reports fixes Change-Id: Ifaf3bf06f0ec123051a791cc8e7f10662f97a525 Signed-off-by: Kishore Reddy, Gujja (kg811t) --- .../ds2-reports/report-run-controller.js | 99 ++++++++++++++++------ 1 file changed, 71 insertions(+), 28 deletions(-) (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-run-controller.js') diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-run-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-run-controller.js index 6eb0afe6..daa47900 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-run-controller.js +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-run-controller.js @@ -1,5 +1,5 @@ -appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams','$http','dateFilter', '$window', '$timeout', 'rowSorter', - function ($scope,$rootScope,$routeParams,$http,dateFilter,$window,$timeout,rowSorter) { +appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams','$http','dateFilter', '$window', '$timeout', 'rowSorter','$modal', + function ($scope,$rootScope,$routeParams,$http,dateFilter,$window,$timeout,rowSorter,$modal) { $scope.dateformat = "MM/dd/yyyy"; $scope.datetimeformat = "MM/dd/yyyy hh:mm a"; $scope.showFormFields = false; @@ -14,7 +14,7 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' value: false }; $scope.isInProgress = true; - + $scope.showLoader=false; if($routeParams.reportUrlParams.indexOf("parent___params===")>-1) { $scope.showBackButton = true; $scope.parentReportUrlParams = $routeParams.reportUrlParams.substring($routeParams.reportUrlParams.indexOf("parent___params===")+18); @@ -67,36 +67,41 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' function(response){ // console.log(response); $scope.isInProgress = false; - $scope.reportData = response.data; - // console.log('reportData report run container response',$scope.reportData); - if ($scope.reportData.reportTitle) { - $scope.reportData.reportHeading = $scope.reportData.reportTitle; - if ($scope.reportData.reportSubTitle) { - $scope.reportData.reportSubTitle = $scope.reportData.reportSubTitle; + if(response.data.errormessage!=null && response.data.errormessage!=''){ + $scope.errorPopUp(response.data.errormessage); + }else{ + $scope.reportData = response.data; + // console.log('reportData report run container response',$scope.reportData); + if ($scope.reportData.reportTitle) { + $scope.reportData.reportHeading = $scope.reportData.reportTitle; + if ($scope.reportData.reportSubTitle) { + $scope.reportData.reportSubTitle = $scope.reportData.reportSubTitle; + } } + else + $scope.reportData.reportHeading = $scope.reportData.reportName; + if(!$scope.urlParams.hideChart && $scope.reportData.chartAvailable && $scope.reportData.totalRows>1){ + // console.log('raptor.htm?action=chart.run&'+convertQueryString($scope.urlParams)); + $http.get('raptor.htm?action=chart.run&'+convertQueryString($scope.urlParams)).then( + function(response){ + $scope.showChart = true; + document.getElementById('chartiframe').contentWindow.document.write(response.data); + document.getElementById('chartiframe').contentWindow.document.close(); + }); + } + + if($scope.reportData.displayForm && $scope.reportData.formFieldList && $scope.reportData.formFieldList.length>0 && !$scope.urlParams.hideFormFields){ + $scope.showFormFields = true; + } } - else - $scope.reportData.reportHeading = $scope.reportData.reportName; - if(!$scope.urlParams.hideChart && $scope.reportData.chartAvailable && $scope.reportData.totalRows>1){ - // console.log('raptor.htm?action=chart.run&'+convertQueryString($scope.urlParams)); - $http.get('raptor.htm?action=chart.run&'+convertQueryString($scope.urlParams)).then( - function(response){ - $scope.showChart = true; - document.getElementById('chartiframe').contentWindow.document.write(response.data); - document.getElementById('chartiframe').contentWindow.document.close(); - }); - } - - if($scope.reportData.displayForm && $scope.reportData.formFieldList && $scope.reportData.formFieldList.length>0 && !$scope.urlParams.hideFormFields){ - $scope.showFormFields = true; - } + }); $scope.getFormFieldSelectedValuesAsURL = function(){ var formFieldsUrl = ''; $scope.reportData.formFieldList.forEach(function(formField) { if(formField.fieldType==='LIST_BOX') { - if($scope.formFieldSelectedValues && $scope.formFieldSelectedValues[formField.fieldId] && $scope.formFieldSelectedValues[formField.fieldId].value != '') { - formFieldsUrl = formFieldsUrl+formField.fieldId+'='+$scope.formFieldSelectedValues[formField.fieldId].value+'&'; + if($scope.formFieldSelectedValues && $scope.formFieldSelectedValues[formField.fieldId] ) { + formFieldsUrl = formFieldsUrl+formField.fieldId+'='+$scope.formFieldSelectedValues[formField.fieldId]+'&'; } } else if(formField.fieldType==='LIST_MULTI_SELECT') { if($scope.formFieldSelectedValues[formField.fieldId].length >0) { @@ -114,11 +119,13 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' formFieldsUrl = formFieldsUrl+formField.fieldId+'='+$scope.formFieldSelectedValues[formField.fieldId]+'&'; } }); + //formFieldsUrl = str.slice(0, -1); return formFieldsUrl; } $scope.runReport = function(pagination){ + $scope.showLoader=true; var formFieldsUrl = $scope.getFormFieldSelectedValuesAsURL(); /*if ($scope.reportData.reportTitle) $scope.reportData.reportHeading = $scope.reportData.reportTitle; @@ -149,6 +156,7 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' // console.log('raptor.htm?action=report.run.container&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'refresh=Y&display_content=Y&r_page='+(paginationOptions.pageNumber-1)); $http.get('raptor.htm?action=report.run.container&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'refresh=Y&display_content=Y&r_page='+(paginationOptions.pageNumber-1)).then( function(response){ + $scope.showLoader=false; $scope.reportData = response.data; if ($scope.reportData.reportTitle) { $scope.reportData.reportHeading = $scope.reportData.reportTitle; @@ -207,6 +215,7 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' paginationTemplate: correctTotalPaginationTemplate, columnDefs: [], data: [], + enableSorting: true, enableGridMenu: true, enableSelectAll: true, gridMenuCustomItems : [ @@ -218,10 +227,10 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' action : function($event) { $window.open($scope.reportEditURL,'_self'); }, order : 211 }, - { title : 'Export All data as Excel 2007', + /*{ title : 'Export All data as Excel 2007', action : function($event) { $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.excel2007.session','_self'); - }, order : 212 }, + }, order : 212 },*/ { title : 'Export All data as Excel', action : function($event) { $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.excel.session','_self'); @@ -323,9 +332,43 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' $http.get('raptor.htm?action=report.formfields.run.container&c_master='+$scope.reportData.reportID+'&'+formFieldsUrl).then( function(response){ $scope.reportData = response.data; + if($scope.reportData.reportHeading==null || $scope.reportData.reportHeading=='') + $scope.reportData.reportHeading = ($scope.reportData.reportTitle=='')?$scope.reportData.reportName:$scope.reportData.reportTitle; }); }; $timeout(function() { $rootScope.isViewRendering = false; }); + $scope.successPopUp = function (msg) { + var modalInstance = $modal.open({ + templateUrl: 'app/fusion/scripts/DS2-modal/success_modal.html', + controller: ModalInstanceCtrl, + sizeClass: 'modal-small', + resolve: { + msg: function () { + var message = { + title: '', + text: msg + }; + return message; + } + } + }); + }; + + $scope.errorPopUp = function (msg) { + var modalInstance = $modal.open({ + templateUrl: 'app/fusion/scripts/DS2-modal/error_modal.html', + controller: ModalInstanceCtrl, + sizeClass: 'modal-small', + resolve: { + msg: function () { + return msg; + } + } + }); + }; + var ModalInstanceCtrl = function ($scope, $modalInstance, msg,$rootScope) { + $scope.msg=msg; + } }]); -- cgit 1.2.3-korg