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-chart-controller.js | 56 ++++++++++++++++++---- 1 file changed, 48 insertions(+), 8 deletions(-) (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-chart-controller.js') diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-chart-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-chart-controller.js index 8fa14643..b15205fc 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-chart-controller.js +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-chart-controller.js @@ -1,4 +1,4 @@ -appDS2.controller('reportChartController', function ($scope, $rootScope, $timeout, $window, $http, $routeParams,modalService) { +appDS2.controller('reportChartController', function ($scope, $rootScope, $timeout, $window, $modal, $http, $routeParams,modalService) { $scope.showLoader = true; $scope.commonOptionOpen = false; $scope.additionalOptionOpen = false; @@ -15,11 +15,16 @@ appDS2.controller('reportChartController', function ($scope, $rootScope, $timeou $scope.populateChrtWzdFields = function() { $scope.reportRunJson = {}; + $scope.showLoader=true; $http.get("raptor.htm?action=chart.json&c_master="+$routeParams.reportId).then(function (response) { + $scope.showLoader=false; $scope.reportRunJson = response.data; //Set chart type - $scope.reportRunJson.commonChartOptions.animateAnimatedChart = $scope.reportRunJson.commonChartOptions.animateAnimatedChart+""; - $scope.reportRunJson.commonChartOptions.hideLegend = $scope.reportRunJson.commonChartOptions.hideLegend + ""; + if($scope.reportRunJson.commonChartOptions!=null){ + $scope.reportRunJson.commonChartOptions.animateAnimatedChart = $scope.reportRunJson.commonChartOptions.animateAnimatedChart+""; + $scope.reportRunJson.commonChartOptions.hideLegend = $scope.reportRunJson.commonChartOptions.hideLegend + ""; + } + $scope.reportRunJson.showTitle = $scope.reportRunJson.showTitle + ""; // if barChartOptions is not null @@ -126,9 +131,11 @@ appDS2.controller('reportChartController', function ($scope, $rootScope, $timeou $scope.saveChartData = function() { $scope.showLoader = true; - - $scope.reportRunJson.commonChartOptions.animateAnimatedChart = ($scope.reportRunJson.commonChartOptions.animateAnimatedChart=="true") - $scope.reportRunJson.commonChartOptions.hideLegend = ($scope.reportRunJson.commonChartOptions.hideLegend=="true"); + if($scope.reportRunJson.commonChartOptions){ + $scope.reportRunJson.commonChartOptions.animateAnimatedChart = ($scope.reportRunJson.commonChartOptions.animateAnimatedChart=="true") + $scope.reportRunJson.commonChartOptions.hideLegend = ($scope.reportRunJson.commonChartOptions.hideLegend=="true"); + } + $scope.reportRunJson.showTitle = ($scope.reportRunJson.showTitle=="true"); $scope.reportRunJson.chartTypeJSON = { @@ -190,12 +197,12 @@ appDS2.controller('reportChartController', function ($scope, $rootScope, $timeou //add the remove list to the json $scope.reportRunJson.rangeAxisRemoveList= $scope.rangeAxisRemoveList; $http.post("save_chart", JSON.stringify($scope.reportRunJson)).success(function(data, status) { - $scope.successSubmit=true; + $scope.successSubmit=true; $scope.showLoader = false; $scope.reportRunJson.commonChartOptions.animateAnimatedChart = $scope.reportRunJson.commonChartOptions.animateAnimatedChart+""; $scope.reportRunJson.commonChartOptions.hideLegend = $scope.reportRunJson.commonChartOptions.hideLegend + ""; $scope.reportRunJson.showTitle = $scope.reportRunJson.showTitle + ""; - if ($scope.reportRunJson.chartType == "BarChart3D") { + if ($scope.reportRunJson.chartType == "BarChart3D" && $scope.reportRunJson.barChartOptions) { $scope.reportRunJson.barChartOptions.displayBarControls = $scope.reportRunJson.barChartOptions.displayBarControls+""; $scope.reportRunJson.barChartOptions.minimizeXAxisTickers = $scope.reportRunJson.barChartOptions.minimizeXAxisTickers+""; $scope.reportRunJson.barChartOptions.stackedChart = $scope.reportRunJson.barChartOptions.stackedChart+""; @@ -203,6 +210,7 @@ appDS2.controller('reportChartController', function ($scope, $rootScope, $timeou $scope.reportRunJson.barChartOptions.verticalOrientation = $scope.reportRunJson.barChartOptions.verticalOrientation +""; $scope.reportRunJson.barChartOptions.xAxisDateType = $scope.reportRunJson.barChartOptions.xAxisDateType +""; } + $scope.successPopUp(); $scope.populateChrtWzdFields(); }) } @@ -419,6 +427,38 @@ appDS2.controller('reportChartController', function ($scope, $rootScope, $timeou $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