diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports')
5 files changed, 516 insertions, 20 deletions
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 new file mode 100644 index 00000000..806b1bc2 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-chart-controller.js @@ -0,0 +1,382 @@ +appDS2.controller('reportChartController', function ($scope, $rootScope, $timeout, $window, $http, $routeParams,modalService) { + //$scope.test="1223"; + //alert($scope.chartType.value); + console.log("reportChartController called"); + $scope.commonOptionOpen = false; + $scope.additionalOptionOpen = false; + + $scope.selectedChartType = {value:""}; + $scope.chartTypeOptions = [ + {value: 'barChart', text: 'Bar Chart'}, + {value: 'timeSeries', text: 'Time Series/Area Chart'}, + {value: 'pieChart', text: 'Pie Chart'}, + {value: 'annotationChart', text: 'Annotation Chart'}, + {value: 'flexibleTimeChart', text: 'Flexible Time Chart'} + ]; + + $scope.animateSelected = {value:false}; + + $scope.populateChrtWzdFields = function() { + $scope.reportRunJson = {}; + $http.get("raptor.htm?action=chart.json&c_master="+$routeParams.reportId).then(function (response) { + $scope.reportRunJson = response.data; + //Set chart type + if ($scope.reportRunJson.chartTypeJSON) { + var chrtTypeValue = $scope.reportRunJson.chartTypeJSON.value; + for(var i = 0; i < $scope.chartTypes.length; i++) { + var obj = $scope.chartTypes[i]; + //console.log(obj.id); + if ($scope.chartTypes[i].value==chrtTypeValue) { + $scope.reportRunJson.chartTypeJSON.index=$scope.chartTypes[i].index; + $scope.reportRunJson.chartTypeJSON.title=$scope.chartTypes[i].title; + } + + } + } + + //Set Domain Axis + if ($scope.reportRunJson.domainAxisJSON) { + var domaninAxisValue = $scope.reportRunJson.domainAxisJSON.value; + for(var i = 0; i < $scope.reportRunJson.chartColumnJSONList.length; i++) { + if ($scope.reportRunJson.chartColumnJSONList[i].value==domaninAxisValue) { + $scope.reportRunJson.domainAxisJSON.index=$scope.reportRunJson.chartColumnJSONList[i].index; + $scope.reportRunJson.domainAxisJSON.title=$scope.reportRunJson.chartColumnJSONList[i].title; + } + + } + } + + //Set Category + if ($scope.reportRunJson.categoryAxisJSON) { + var categoryAxisValue = $scope.reportRunJson.categoryAxisJSON.value; + for(var i = 0; i < $scope.reportRunJson.chartColumnJSONList.length; i++) { + if ($scope.reportRunJson.chartColumnJSONList[i].value==categoryAxisValue) { + $scope.reportRunJson.categoryAxisJSON.index=$scope.reportRunJson.chartColumnJSONList[i].index; + $scope.reportRunJson.categoryAxisJSON.title=$scope.reportRunJson.chartColumnJSONList[i].title; + } + } + } + + //Set range axis label + if ($scope.reportRunJson.rangeAxisList) { + for(var j = 0; j < $scope.reportRunJson.rangeAxisList.length; j++) { + + if ($scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON) { + var rangeAxisLabelValue = $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.value; + for(var i = 0; i < $scope.reportRunJson.chartColumnJSONList.length; i++) { + if ($scope.reportRunJson.chartColumnJSONList[i].value==rangeAxisLabelValue) { + $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.index=$scope.reportRunJson.chartColumnJSONList[i].index; + $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.title=$scope.reportRunJson.chartColumnJSONList[i].title; + } + } + } + } + } + + + //set range linetype + if ($scope.reportRunJson.rangeAxisList) { + for(var j = 0; j < $scope.reportRunJson.rangeAxisList.length; j++) { + if ($scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON != null && $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.value != "" + && $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.value != null) { + var lineTypeValue = $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.value; + for(var i = 0; i < $scope.lineTypes.length; i++) { + if ($scope.lineTypes[i].value==lineTypeValue) { + $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.index=$scope.lineTypes[i].index; + $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.title=$scope.lineTypes[i].title; + } + } + } else { + $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON = null; + } + } + } + //set range color + if ($scope.reportRunJson.rangeAxisList) { + for(var j = 0; j < $scope.reportRunJson.rangeAxisList.length; j++) { + if ($scope.reportRunJson.rangeAxisList[j].rangeColorJSON != null && $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.value != "" + && $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.value != null) { + var colorValue = $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.value; + for(var i = 0; i < $scope.rangeColors.length; i++) { + if ($scope.rangeColors[i].value==colorValue) { + $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.index=$scope.rangeColors[i].index; + $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.title=$scope.rangeColors[i].title; + } + } + }else { + $scope.reportRunJson.rangeAxisList[j].rangeColorJSON = null; + } + } + } + }); + + $scope.legend = "true"; + } + + $scope.saveChartData = function() { + //Converting string variables to numbers + $scope.reportRunJson.commonChartOptions.rightMargin = Number($scope.reportRunJson.commonChartOptions.rightMargin); + $scope.reportRunJson.commonChartOptions.topMargin = Number($scope.reportRunJson.commonChartOptions.topMargin); + $scope.reportRunJson.commonChartOptions.bottomMargin = Number($scope.reportRunJson.commonChartOptions.bottomMargin); + $scope.reportRunJson.commonChartOptions.leftMargin = Number($scope.reportRunJson.commonChartOptions.leftMargin); + + if ($scope.reportRunJson.categoryAxisJSON == "") { + console.log('Inside categoryAxisJSON value'); + $scope.reportRunJson.categoryAxisJSON = {}; + $scope.reportRunJson.categoryAxisJSON.value = -1; + console.log('$scope.reportRunJson.categoryAxisJSON',$scope.reportRunJson.categoryAxisJSON); + } + + console.log($scope.reportRunJson); + $http.post("save_chart", JSON.stringify($scope.reportRunJson)).success(function(data, status) { + $scope.successSubmit=true; + }) + } + + + $scope.addRangeAxisRow = function (rangeaxisitem) { + $scope.reportRunJson.rangeAxisList.push({ + }); + }; + + $scope.removeRangeAxisRow = function (index) { + $scope.reportRunJson.rangeAxisList.splice(index, 1); + }; + + + $scope.init = function () { + if ($scope) { + $scope.populateChrtWzdFields(); + } + }; + + + + $scope.domainItems = [{title:"Domain Axis1", content:"Test1", open: false},{title:"Domain Axis2", content:"Test2", open: false}]; + + $scope.chartTypes = [ + {index: 0, value: 'BarChart3D', title: 'Bar Chart'}, + {index: 1, value: 'TimeSeriesChart', title: 'Time Series/Area Chart'}, + {index: 2, value: 'PieChart', title: 'Pie Chart'}, + {index: 3, value: 'AnnotationChart', title: 'Annotation Chart'}, + {index: 4, value: 'FlexTimeChart', title: 'Flexible Time Chart'} + ]; + + $scope.categories = [ + {index: 0, value: 'scenario_name', title: 'scenario_name'}, + {index: 1, value: 'total_traffic_in_PB', title: 'Total Traffic in PB'}, + {index: 2, value: 'Avg Utilization Day', title: 'Avg Utilization Day'} + ]; + + $scope.rangeColors = [ + {index: 0, value: "#1f77b4",title: "Dodger Blue"}, + {index: 1, value: "#ff7f0e",title: "Vivid orange"}, + {index: 2, value: "#2ca02c",title: "Forest Green"}, + {index: 3, value: "#8c864b",title: "Greenish Red"}, + {index: 4, value: "#9467bd",title: "Desaturated violet"}, + {index: 5, value: "#8c564b",title: "Dark moderate red"}, + {index: 6, value: "#e377c2",title: "Soft pink"}, + {index: 7, value: "#7f7f7f",title: "Dark gray"}, + {index: 8, value: "#bcbd22",title: "Strong yellow"}, + {index: 9, value: "#17becf",title: "Strong cyan"}, + {index: 10, value: "#dc143c",title: "Vivid red"}, + {index: 11, value: "#800080",title: "Dark magenta"}, + {index: 12, value: "#0000FF",title: "Blue"}, + {index: 13, value: "#008000",title: "Dark lime green"}, + {index: 14, value: "#D2691E",title: "Reddish Orange"}, + {index: 15, value: "#FF0000",title: "Red"}, + {index: 16, value: "#000000",title: "Black"}, + {index: 17, value: "#DB7093",title: "Pink"}, + {index: 18, value: "#FF00FF",title: "Pure Magenta"}, + {index: 19, value: "#7B68EE",title: "Soft blue"}, + {index: 20, value: "#1f77b6",title: "Strong blue"}, + {index: 21, value: "#9edae5",title: "Very soft cyan"}, + {index: 22, value: "#393b79",title: "Dark Blue"}, + {index: 23, value: "#5254a3",title: "Dark moderate Blue"}, + {index: 24, value: "#6b6ecf",title: "Slightly desaturated blue"}, + {index: 25, value: "#9c9ede",title: "Very soft blue"}, + {index: 26, value: "#637939",title: "Dark Green"}, + {index: 27, value: "#8ca252",title: "Dark moderate green"}, + {index: 28, value: "#b5cf6b",title: "Slightly desaturated green"}, + {index: 29, value: "#cedb9c",title: "Desaturated Green"}, + + /* Old Colors */ + {index: 30, value: "#00FFFF",title: "Aqua"}, + {index: 31, value: "#000000",title: "Black"}, + {index: 32, value: "#0000FF",title: "Blue"}, + {index: 33, value: "#FF00FF",title: "Fuchsia"}, + {index: 34, value: "#808080",title: "Gray"}, + {index: 35, value: "#008000",title: "Green"}, + {index: 36, value: "#00FF00",title: "Lime"}, + {index: 37, value: "#800000",title: "Maroon"}, + {index: 38, value: "#000080",title: "Navy"}, + {index: 39, value: "#808000",title: "Olive"}, + {index: 40, value: "#FF9900",title: "Orange"}, + {index: 41, value: "#800080",title: "Purple"}, + {index: 42, value: "#FF0000",title: "Red"}, + {index: 43, value: "#C0C0C0",title: "Silver"}, + {index: 44, value: "#008080",title: "Teal"}, + {index: 45, value: "#FFFFFF",title: "White"}, + {index: 46, value: "#FFFF00",title: "Yellow"} + ]; + + + $scope.lineTypes = [ + {index: 0, value: 'default', title: 'Default'}, + {index: 1, value: 'dotted_lines', title: 'Dotted Lines'}, + {index: 2, value: 'dashed_lines', title: 'Dashed Lines'} + ]; + + $scope.hardCodeReport= { + "reportID":"3356", + "reportName":"Test: Line Chart", + "reportDescr":"", + "reportTitle":"", + "reportSubTitle":"", + "formFieldList":[ + ], + "chartColumnJSONList":[ + { + "index":0, + "value":"tr0", + "title":"traffic_date", + "$$hashKey":"056" + }, + { + "index":1, + "value":"ut1", + "title":"util_perc", + "$$hashKey":"057" + } + ], + "formfield_comments":null, + "totalRows":0, + "chartSqlWhole":"SELECT traffic_date tr0, traffic_date tr0_1,util_perc ut1, 1 FROM portal.demo_util_chart ORDER BY 1", + "chartAvailable":true, + "chartType":{"index": "", "value": "Bar Chart", "title": ""}, + "width":"700", + "height":"420", + "animation":false, + "rotateLabels":"90", + "staggerLabels":false, + "showTitle":"false", + "domainAxis":{ + "index":0, + "value":"tr0", + "title":"traffic_date", + "$$hashKey":"11H" + }, + + "categoryAxis":{ + "index":1, + "value":"ut1", + "title":"util_perc", + "$$hashKey":"11I" + }, + + "hasCategoryAxis":false, + "rangeAxisList":[ + { + + "rangeColor":{ + "index":"", + "value":"#bcbd22", + "title":"" + }, + + "rangeLineType":{ + "index":"", + "value":"dotted_lines", + "title":"" + }, + "rangeAxisLabel":{ + "index":0, + "value":"tr0", + "title":"traffic_date", + "$$hashKey":"056" + }, + "YAxis":"10", + "chartTitle":"test" + }, + { + "rangeColor":{ + "index":"", + "value":"#2ca02c", + "title":"" + }, + + "rangeLineType":{ + "index":"", + "value":"dashed_lines", + "title":"" + + + }, + + "rangeAxisLabel":{ + "index":0, + "value":"tr0", + "title":"traffic_date", + "$$hashKey":"056" + }, + "YAxis":"10", + "chartTitle":"test" + } + + + ], + + "primaryAxisLabel":"testlabel", + "secondaryAxisLabel":"testseclabel", + "minRange":"10", + "maxRange":"20", + "topMargin":"6", + "bottomMargin":"5", + "leftMargin":"4", + "rightMargin":"3" + }; + + var colorValue = $scope.hardCodeReport.rangeAxisList[0].rangeColor.value; + + $timeout(function() { + $rootScope.isViewRendering = false; + }); + + +}); + +app.directive('onlyDigits', function () { + + return { + restrict: 'A', + require: '?ngModel', + link: function (scope, element, attrs, ngModel) { + if (!ngModel) return; + ngModel.$parsers.unshift(function (inputValue) { + var digits = inputValue.split('').filter(function (s) { return (!isNaN(s) && s != ' '); }).join(''); + ngModel.$viewValue = digits; + ngModel.$render(); + return digits; + }); + } + }; +}); + +app.directive('onlyCharacters', function () { + return { + restrict: 'A', + require: '?ngModel', + link: function (scope, element, attrs, ngModel) { + if (!ngModel) return; + ngModel.$parsers.unshift(function (inputValue) { + var digits = inputValue.split('').filter(function (s) { return (isNaN(s) && s != ' '); }).join(''); + ngModel.$viewValue = digits; + ngModel.$render(); + return digits; + }); + } + }; +}); + + + diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-router.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-router.js index db3422ed..1e22cca3 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-router.js +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-router.js @@ -17,6 +17,10 @@ appDS2.config(['$routeProvider', templateUrl: 'static/fusion/raptor/ebz/report_chart_wizard.html', controller: 'ChartController' }). + when('/report_chart/:reportId', { + templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/report-chart-wizard.html', + controller: 'reportChartController' + }). when("/report_wizard", { templateUrl : "app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/report-step.html", controller: "reportStepController" 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 02f58985..760ff6d3 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 @@ -10,7 +10,9 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' $scope.reportData.allowEdit = false; $scope.formFieldSelectedValues = {}; $scope.showFormFieldIds = false; - + $scope.showFormFieldId = { + value: false + }; $scope.isInProgress = true; if($routeParams.reportUrlParams.indexOf("parent___params===")>-1) { @@ -20,7 +22,7 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' } else { $scope.currentReportUrlParams = $routeParams.reportUrlParams; } - console.log($routeParams.reportUrlParams); + // console.log($routeParams.reportUrlParams); var parseQueryString = function( queryString ) { var params = {}, queries, temp, i, l; // Split into key/value pairs @@ -60,10 +62,10 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' $http.get('raptor.htm?action=report.run.container&'+$scope.currentReportUrlParams).then( function(response){ - console.log(response); + // console.log(response); $scope.isInProgress = false; $scope.reportData = response.data; - console.log('reportData report run container response',$scope.reportData); + // console.log('reportData report run container response',$scope.reportData); if ($scope.reportData.reportTitle) { $scope.reportData.reportHeading = $scope.reportData.reportTitle; if ($scope.reportData.reportSubTitle) { @@ -73,7 +75,7 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' 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)); + // 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; @@ -120,7 +122,7 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' else $scope.reportData.reportHeading = $scope.reportData.reportName;*/ - console.log("pagination"); + // console.log("pagination"); if(!pagination) { //console.log("refreshed ..."); $scope.gridOptions.pageNumber = 1; @@ -141,7 +143,7 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' } $scope.currentReportUrlParams = 'c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'&display_content=Y&r_page='+(paginationOptions.pageNumber-1); - 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)); + // 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.reportData = response.data; @@ -163,12 +165,12 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' } if(!pagination) { if(!$scope.urlParams.hideChart && $scope.reportData.chartAvailable && $scope.reportData.totalRows>1){ - console.log('raptor.htm?action=chart.run&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'display_content=Y&r_page='+(paginationOptions.pageNumber-1)); + // console.log('raptor.htm?action=chart.run&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'display_content=Y&r_page='+(paginationOptions.pageNumber-1)); $http.get('raptor.htm?action=chart.run&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'display_content=Y&r_page='+(paginationOptions.pageNumber-1)).then( function(response) { - console.log(response.data); + // console.log(response.data); $scope.showChart = true; - console.log('response.data',response.data); + // console.log('response.data',response.data); document.getElementById('chartiframe').contentWindow.document.write(response.data); document.getElementById('chartiframe').contentWindow.document.close(); }); @@ -313,7 +315,7 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams',' }); $scope.triggerOtherFormFields = function(){ - console.log("report_run"); + // console.log("report_run"); var formFieldsUrl = $scope.getFormFieldSelectedValuesAsURL(); $http.get('raptor.htm?action=report.formfields.run.container&c_master='+$scope.reportData.reportID+'&'+formFieldsUrl).then( function(response){ diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-search-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-search-controller.js index 1e01a297..3fe5bde3 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-search-controller.js +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-search-controller.js @@ -45,6 +45,7 @@ appDS2.controller("reportSearchController", ['$scope','$rootScope','$http','$tim paginationPageSize: 5, paginationTemplate: correctTotalPaginationTemplate, columnDefs: [], + enableColumnResizing: true, data: [], enableGridMenu: true, enableSelectAll: true, diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js index 6133fe64..f1e82fa5 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js @@ -1,5 +1,7 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $routeParams, $q, $modal,$log,$window, raptorReportFactory, stepFormFactory, DOMHelper) { + + $scope.showLoader = true; // tabs for report wizard steps: $scope.activeTabsId = 'Definition'; @@ -10,8 +12,10 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout raptorReportFactory.getDefinitionByReportId(id).then(function(data){ $scope.loadDefinition(data); $scope.definitionData = data; + $scope.showLoader = false; },function(error){ $log.error("raptorReportFactory: getSearchData failed."); + $scope.showLoader = false; }); } @@ -20,6 +24,7 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout raptorReportFactory.createNewDefinition().then(function(data){ $scope.loadDefinition(data); $scope.definitionData = data; + $scope.showLoader = false; },function(error){ $log.error("raptorReportFactory: getSearchData failed."); }); @@ -41,6 +46,7 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout raptorReportFactory.getSqlInSession().then(function(data){ $scope.sqlInSessionJSON = data; $scope.sqlScript = data.query; + $scope.showLoader = false; },function(error){ $log.error("raptorReportFactory: getSearchData failed."); }); @@ -133,6 +139,7 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout $scope.hideExcelSelected = {"value":definitionData.displayOptions[3].selected}; $scope.hidePdfSelected = {"value":definitionData.displayOptions[4].selected}; $scope.runtimeColSortDisabled = {"value":definitionData.runtimeColSortDisabled}; + $scope.showLoader = false; } @@ -349,11 +356,21 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout $scope.drilldownURL = data.drilldownURL; $scope.drilldownParams = data.drilldownParams; $scope.drilldownType = data.drilldownType; + $scope.selectedDrillDownReport = {"value":""}; + + },function(error){ $log.error("raptorReportFactory: getColumnEditInfoById failed."); }); var init = function() { + + raptorReportFactory.getDrillDownReportList().then(function(data2){ + $scope.drilldownReports = data2; + },function(error){ + $log.error("raptorReportFactory: getDrillDownReportList failed."); + }); + /* $scope.colTableRowData = colData;*/ $scope.displayAlignmentOptions = [ {value:"null", text:""}, @@ -373,8 +390,15 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout } init(); + $scope.$watch('selectedDrillDownReport.value',function(){ + if ($scope.selectedDrillDownReport) { + $scope.$emit('openDrillDownpage',$scope.selectedDrillDownReport.value); + } + }); $scope.save = function() { + var drilldownURL = "";//raptorReportFactory.drillDownPopupOptions + //raptorReportFactory.drillDownPopupOptions.radioGroup var colInfo = { "tabId" : "ColEdit", "tabName" : "Column Edit", @@ -384,7 +408,7 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout "displayHeaderAlignment" : ($scope.selectedDisplayHeaderAlignment.value=="null")?null:$scope.selectedDisplayHeaderAlignment.value, "sortable" : ($scope.sortable.value=="true"), "visible" : ($scope.visible.value=="true"), - "drilldownURL" : "", + "drilldownURL" : drilldownURL, "drilldownParams" : "", "drilldownType" : "" } @@ -576,9 +600,77 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout }); }; - + $scope.openDrillDownReportPopup = function (reportId) { + var modalInstance = $modal.open({ + scope: $scope, + animation: $scope.animationsEnabled, + templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-wizard-drilldown-edit.html', + sizeClass: 'modal-large', + controller: ['$scope', '$modalInstance', '$http', '$log','raptorReportFactory','reportId', function ($scope, $modalInstance, $http, $log, raptorReportFactory, reportId) { + $scope.selectedvalueradioGroup = {"name":""}; + $scope.selectedChildReportFormField = {"value":""}; + $scope.selectedChildReportColumn = {"value":""}; + $scope.fixedValue = {"value":""}; + $scope.suppressValues = {"value":""}; + + raptorReportFactory.getChildReportFormField(reportId).then(function(data){ + $scope.childReportFF =data; + },function(error){ + $log.error("raptorReportFactory: getChildReportFormField failed."); + }); + + raptorReportFactory.getChildReportColumn(reportId).then(function(data){ + $scope.childReportCol =data; + },function(error){ + $log.error("raptorReportFactory: getChildReportFormField failed."); + }); + + raptorReportFactory.setDrillDownPopupOptions(null); + + $scope.complete = function() { +// if ($scope.selectedvalueradioGroup.name=="radiovalue1") { +// console.log("radio 1 selected"); +// } else if ($scope.selectedvalueradioGroup.name=="radiovalue2") { +// console.log("radio 2 selected"); +// } else if ($scope.selectedvalueradioGroup.name=="radiovalue3") { +// console.log("radio 3 selected"); +// } else if ($scope.selectedvalueradioGroup.name=="radiovalue4") { +// console.log("radio 4 selected"); +// } else if ($scope.selectedvalueradioGroup.name=="radiovalue5") { +// console.log("radio 5 selected"); +// } else { +// console.log("None selected"); +// } + + var drillDownPopupOptions= { + radioGroup : $scope.selectedvalueradioGroup.name, + reportFF: $scope.selectedChildReportFormField.value, + reportCol: $scope.selectedChildReportColumn.value, + fixedValue: $scope.fixedValue.value, + suppressValues: $scope.suppressValues.value + } + raptorReportFactory.setDrillDownPopupOptions(drillDownPopupOptions); + console.log(raptorReportFactory.drillDownPopupOptions); + + $modalInstance.close(); + }; + }], + resolve:{ + reportId: function(){ + return reportId; + } + } + }); + + modalInstance.result.then(function () { +/* $scope.$emit('RefreshFormField');*/ + }, function () { + }); +}; + $scope.$watch('activeTabsId', function (newVal, oldVal) { if(newVal !== oldVal) { + $scope.showLoader = true; var selectedTab; for (selectedTab = 0; selectedTab < $scope.gTabs.length; selectedTab++) { if ($scope.gTabs[selectedTab].id === newVal) { @@ -587,28 +679,36 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout $scope.isColumnStep = false; $scope.isFormFieldStep = false; $scope.renderStep(selectedTab+1); - if ($scope.stepNum == 2) { + if ($scope.stepNum == 1) { + $scope.showLoader = false; + } + else if ($scope.stepNum == 2) { loadSqlInSession(); } else if ($scope.stepNum == 3) { $scope.isColumnStep = true; - raptorReportFactory.getColumnList().then(function(data){ $scope.colTableRowData = data; + $scope.showLoader = false; },function(error){ - $log.error("raptorReportFactory: get column list failed."); }); - + $log.error("raptorReportFactory: get column list failed."); + $scope.showLoader = false;}); + } else if ($scope.stepNum == 4) { $scope.isFormFieldStep = true; // put within then function: raptorReportFactory.getFormFieldList().then(function(data){ $scope.formFieldData = data; + $scope.showLoader = false; },function(error){ - $log.error("raptorReportFactory: get formfields failed."); }); + $log.error("raptorReportFactory: get formfields failed."); + $scope.showLoader = false;}); } else if ($scope.stepNum == 5) { raptorReportFactory.getDefinitionInSession().then(function(data){ $scope.reportId = data.reportId; + $scope.showLoader = false; },function(error){ - $log.error("raptorReportFactory: getDefinitionInSession failed."); }); + $log.error("raptorReportFactory: getDefinitionInSession failed."); + $scope.showLoader = false;}); } if ($scope.stepNum>1){ @@ -869,6 +969,13 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout $scope.getDefinitionById(-1); }); + $scope.$on('openDrillDownpage', function(event, reportId) { + if (reportId!="") { + $scope.openDrillDownReportPopup(reportId); + } + }); + + $scope.$on('RefreshFormField', function(event) { raptorReportFactory.getFormFieldList().then(function(data){ $scope.formFieldData = data; @@ -897,4 +1004,4 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout // getAllProjects(); -});
\ No newline at end of file +}); |