diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports')
6 files changed, 0 insertions, 1964 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 deleted file mode 100644 index b15205fc..00000000 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-chart-controller.js +++ /dev/null @@ -1,499 +0,0 @@ -appDS2.controller('reportChartController', function ($scope, $rootScope, $timeout, $window, $modal, $http, $routeParams,modalService) { - $scope.showLoader = true; - $scope.commonOptionOpen = false; - $scope.additionalOptionOpen = false; - $scope.barChartOptionOpen = false; - $scope.timeSeriesChartOptionOpen = false; - $scope.selectedChartType = {value:""}; - $scope.chartTypeOptions = [ - {value: 'BarChart3D', text: 'Bar Chart'}, - {value: 'TimeSeriesChart', text: 'Time Series/Area Chart'}, - {value: 'PieChart', text: 'Pie Chart'}, - {value: 'AnnotationChart', text: 'Annotation Chart'}, - {value: 'FlexTimeChart', text: 'Flexible Time Chart'} - ]; - - $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 - 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 - if ($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+""; - $scope.reportRunJson.barChartOptions.timeAxis =$scope.reportRunJson.barChartOptions.timeAxis+""; - $scope.reportRunJson.barChartOptions.verticalOrientation = $scope.reportRunJson.barChartOptions.verticalOrientation +""; - $scope.reportRunJson.barChartOptions.xAxisDateType = $scope.reportRunJson.barChartOptions.xAxisDateType +""; - } - - if ($scope.reportRunJson.chartTypeJSON) { - var chrtTypeValue = $scope.reportRunJson.chartType; - for(var i = 0; i < $scope.chartTypes.length; i++) { - if ($scope.chartTypes[i].value==chrtTypeValue) { - $scope.reportRunJson.chartTypeJSON.index=$scope.chartTypes[i].index; - $scope.reportRunJson.chartTypeJSON.value=$scope.chartTypes[i].value; - $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.showLoader = false; - }); - - $scope.legend = "true"; - } - - $scope.saveChartData = function() { - $scope.showLoader = 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 = { - 'index':0,'title':'','value':''}; - - - if (($scope.reportRunJson.chartType == "BarChart3D")&&($scope.reportRunJson.barChartOptions)) { - $scope.reportRunJson.barChartOptions.displayBarControls = ($scope.reportRunJson.barChartOptions.displayBarControls=="true") ; - $scope.reportRunJson.barChartOptions.minimizeXAxisTickers = ($scope.reportRunJson.barChartOptions.minimizeXAxisTickers=="true") ; - $scope.reportRunJson.barChartOptions.stackedChart = ($scope.reportRunJson.barChartOptions.stackedChart=="true") ; - $scope.reportRunJson.barChartOptions.timeAxis= ($scope.reportRunJson.barChartOptions.timeAxi=="true") ; - $scope.reportRunJson.barChartOptions.verticalOrientation = ($scope.reportRunJson.barChartOptions.verticalOrientation=="true") ; - $scope.reportRunJson.barChartOptions.xAxisDateType = ($scope.reportRunJson.barChartOptions.xAxisDateType=="true") ; - } - - for (var i=0;i<$scope.chartTypes.length;i++) { - if ($scope.reportRunJson.chartType==$scope.chartTypes[i].value) { - $scope.reportRunJson.chartTypeJSON = { - 'index':$scope.chartTypes[i].index, - 'title':$scope.chartTypes[i].title, - 'value':$scope.chartTypes[i].value - } - } - } - - $scope.reportRunJson.domainAxisJSON = { - "index":0,"value":$scope.reportRunJson.domainAxis,"title": $scope.reportRunJson.domainAxis - }; - $scope.reportRunJson.categoryAxisJSON = { - "index":0,"value":$scope.reportRunJson.categoryAxis,"title": $scope.reportRunJson.categoryAxis - }; - - // Specifically for DS2 for color - for (var i=0; i<$scope.reportRunJson.rangeAxisList.length; i ++) { - $scope.reportRunJson.rangeAxisList[i].rangeColorJSON = - {"index":0, "value": $scope.reportRunJson.rangeAxisList[i].rangeColor, "title": ""}; - - $scope.reportRunJson.rangeAxisList[i].rangeLineTypeJSON = - {"index":0, "value": "", "title": ""}; - for (var j=0;j<$scope.lineTypes.length;j++) { - if ($scope.reportRunJson.rangeAxisList[i].rangeLineType ==$scope.lineTypes[j].value) { - $scope.reportRunJson.rangeAxisList[i].rangeLineTypeJSON = - {"index":$scope.lineTypes[j].index, "value": $scope.lineTypes[j].value, "title": $scope.lineTypes[j].title}; - } - } - - } - - //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 == "") { - $scope.reportRunJson.categoryAxisJSON = {}; - $scope.reportRunJson.categoryAxisJSON.value = -1; - } - //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.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" && $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+""; - $scope.reportRunJson.barChartOptions.timeAxis =$scope.reportRunJson.barChartOptions.timeAxis+""; - $scope.reportRunJson.barChartOptions.verticalOrientation = $scope.reportRunJson.barChartOptions.verticalOrientation +""; - $scope.reportRunJson.barChartOptions.xAxisDateType = $scope.reportRunJson.barChartOptions.xAxisDateType +""; - } - $scope.successPopUp(); - $scope.populateChrtWzdFields(); - }) - } - - - $scope.addRangeAxisRow = function (rangeaxisitem) { - $scope.reportRunJson.rangeAxisList.push({ - }); - }; - - $scope.rangeAxisRemoveList= []; - $scope.removeRangeAxisRow = function (index) { - $scope.rangeAxisRemoveList.push($scope.reportRunJson.rangeAxisList[index]); - $scope.reportRunJson.rangeAxisList[index].removed="true"; - }; - - - $scope.init = function () { - if ($scope) { - $scope.populateChrtWzdFields(); - $scope.reportRunJson.rangeAxisRemoveList= []; - } - }; - - - - $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; - }); - - $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; - } - -}); - -appDS2.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; - }); - } - }; -}); - -appDS2.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-import-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-import-controller.js deleted file mode 100644 index a8f853fd..00000000 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-import-controller.js +++ /dev/null @@ -1,20 +0,0 @@ -appDS2.controller('reportImportController', function($scope,$http,$location, $routeParams, $q, $modal,$log,$window, raptorReportFactory, stepFormFactory, DOMHelper) { - $scope.importXML = function(){ - - var importXMLJSON = { - "tabId":"Import", - "tabName":"Import", - "reportXML":$scope.xmlContent - } - $scope.errorMessage = "" - raptorReportFactory.postImportXml(importXMLJSON).then(function(data){ - if (data.errormessage) { - $scope.errorMessage = data.errormessage; - } else { - $window.location.href = 'report#/report_wizard/-1'; - }; - },function(error){ - $log.error("raptorReportFactory: postImportXml failed."); - }); - } -});
\ No newline at end of file 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 deleted file mode 100644 index 58913a40..00000000 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-router.js +++ /dev/null @@ -1,41 +0,0 @@ -appDS2.config(['$routeProvider', - function($routeProvider) { - $routeProvider. - when('/', { - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/report-search.html', - controller: 'reportSearchController' - }). - when('/report_search', { - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/report-search.html', - controller: 'reportSearchController' - }). - when('/report_run/:reportUrlParams*', { - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/report-run.html', - controller: 'reportRunController' - }). - when('/report_chart_wizard/:reportId', { - 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/report-step.html", - controller: "reportStepController" - }). - when("/report_wizard/:reportId", { - templateUrl : "app/fusion/scripts/DS2-view-models/ds2-reports/report-step.html", - controller: "reportStepController" - }). - when("/report_wizard/:reportMode/:reportId", { - templateUrl : "app/fusion/scripts/DS2-view-models/ds2-reports/report-step.html", - controller: "reportStepController" - }). - when("/report_import", { - templateUrl : "app/fusion/scripts/DS2-view-models/ds2-reports/report-import.html", - controller: "reportImportController" - }) - ; -}]);
\ No newline at end of file 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 deleted file mode 100644 index f5ec623a..00000000 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-run-controller.js +++ /dev/null @@ -1,374 +0,0 @@ -appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams','$http','dateFilter', '$window', '$timeout', 'rowSorter','$modal','$sanitize', - function ($scope,$rootScope,$routeParams,$http,dateFilter,$window,$timeout,rowSorter,$modal,$sanitize) { - $scope.dateformat = "MM/dd/yyyy"; - $scope.datetimeformat = "MM/dd/yyyy hh:mm a"; - $scope.showFormFields = false; - $scope.showGrid = false; - $scope.showChart = false; - $scope.showBackButton = false; - $scope.reportData = {}; - $scope.reportData.allowEdit = false; - $scope.formFieldSelectedValues = {}; - $scope.showFormFieldIds = false; - $scope.showFormFieldId = { - 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); - $scope.currentReportUrlParams = $routeParams.reportUrlParams.substring(0,$routeParams.reportUrlParams.indexOf("parent___params===")); - } else { - $scope.currentReportUrlParams = $routeParams.reportUrlParams; - } - // console.log($routeParams.reportUrlParams); - var parseQueryString = function( queryString ) { - var params = {}, queries, temp, i, l; - // Split into key/value pairs - queries = queryString.split("&"); - // Convert the array of strings into an object - for ( i = 0, l = queries.length; i < l; i++ ) { - temp = queries[i].split('='); - //console.log(temp[0]); - //console.log(temp[0] != "refresh"); - if(temp[0] && temp[0] != "refresh") - params[temp[0]] = temp[1]; - } - return params; - }; - - var convertQueryString = function(queryString) { - var keys = ""; var str = ""; - keys = Object.keys(queryString); - //console.log(keys); - for ( i = 0, l = keys.length; i < l; i++ ) { - str += keys[i]+"="+queryString[keys[i]] + "&"; - - } - return str; - //queryString = - } - - - - $scope.backToParentReport = function (){ - $window.location.href = "report#/report_run/"+$scope.parentReportUrlParams - } - - $scope.urlParams = parseQueryString($scope.currentReportUrlParams); - - $scope.reportChartURL = 'report#/report_chart/'+$scope.urlParams.c_master; - - $scope.reportEditURL = 'report#/report_wizard/'+$scope.urlParams.c_master; - - - $http.get('raptor.htm?action=report.run.container&'+$scope.currentReportUrlParams).then( - function(response){ - // console.log(response); - $scope.isInProgress = false; - 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 === undefined || $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] ) { - formFieldsUrl = formFieldsUrl+formField.fieldId+'='+$scope.formFieldSelectedValues[formField.fieldId]+'&'; - } - } else if(formField.fieldType==='LIST_MULTI_SELECT') { - if($scope.formFieldSelectedValues[formField.fieldId].length >0) { - for (var i = 0; i < $scope.formFieldSelectedValues[formField.fieldId].length; i++) { - if($scope.formFieldSelectedValues[formField.fieldId][i].defaultValue){ - formFieldsUrl = formFieldsUrl+formField.fieldId+'='+$scope.formFieldSelectedValues[formField.fieldId][i].value+'&'; - } - } - } - } else if((formField.fieldType === 'text' || formField.fieldType === 'TEXT') && formField.validationType === 'DATE'){ - formFieldsUrl = formFieldsUrl+formField.fieldId+'='+dateFilter($scope.formFieldSelectedValues[formField.fieldId],$scope.dateformat)+'&'; - } else if((formField.fieldType === 'text' || formField.fieldType === 'TEXT') && formField.validationType === 'TIMESTAMP_MIN'){ - formFieldsUrl = formFieldsUrl+formField.fieldId+'='+dateFilter($scope.formFieldSelectedValues[formField.fieldId],$scope.datetimeformat)+'&'; - } else if((formField.fieldType === 'text' || formField.fieldType === 'TEXT') && $scope.formFieldSelectedValues[formField.fieldId] && $scope.formFieldSelectedValues[formField.fieldId] != ''){ - 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; - else - $scope.reportData.reportHeading = $scope.reportData.reportName;*/ - - // console.log("pagination"); - if(!pagination) { - //console.log("refreshed ..."); - $scope.gridOptions.pageNumber = 1; - paginationOptions.pageNumber = 1; - paginationOptions.pageSize = $scope.reportData.pageSize; - //console.log($scope.gridOptions); - $scope.gridOptions.paginationCurrentPage = 1; - $scope.gridOptions.paginationPageSizes= [$scope.reportData.pageSize]; - $scope.gridOptions.paginationPageSize= $scope.reportData.pageSize; - if($scope.reportData.totalRows<14){ - $scope.gridHeight = ($scope.reportData.totalRows+7)*30+'px'; - } else{ - $scope.gridHeight = '400px'; - } - $scope.gridOptions.totalItems = $scope.reportData.totalRows; - $scope.gridOptions.data= $scope.reportData.reportDataRows; - $scope.gridOptions.exporterPdfHeader.text= $scope.reportData.reportName; - - } - $scope.currentReportUrlParams = 'c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'&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; - if ($scope.reportData.reportSubTitle) { - $scope.reportData.reportSubTitle = $scope.reportData.reportSubTitle; - } - } - else - $scope.reportData.reportHeading = $scope.reportData.reportName; - - if($scope.reportData.errormessage) { - //console.log($scope.reportData); - var stacktraceFP = $scope.reportData.stacktrace.substring(0, $scope.reportData.stacktrace.indexOf(":")+1); - document.getElementById('errorDiv').innerHTML = $sanitize(+stacktraceFP + " " + $scope.reportData.errormessage); - //console.log(document.getElementById('errorDiv').innerHtml); - //console.log(stacktraceFP + " " + $scope.reportData.errormessage); - } - if(!pagination) { - if( ($scope.urlParams.hideChart === undefined || $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)); - $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); - $scope.showChart = true; - // console.log('response.data',response.data); - document.getElementById('chartiframe').contentWindow.document.write($sanitize(response.data)); - document.getElementById('chartiframe').contentWindow.document.close(); - }); - } else { - $scope.showChart = false; - } - } - if($scope.reportData.displayForm && $scope.reportData.formFieldList && $scope.reportData.formFieldList.length>0 && !$scope.urlParams.hideFormFields && !$scope.reportData.hideFormFieldsAfterRun){ - $scope.showFormFields = true; - } else { - $scope.showFormFields = false; - } - }); - }; - - var paginationOptions = { - pageNumber: 1, - pageSize: 5, - sort: null - }; - - var correctTotalPaginationTemplate = - //same as normal template, but fixed totals: {{(((grid.options.paginationCurrentPage-1)*grid.options.paginationPageSize)+1)}} {{(grid.options.paginationCurrentPage*grid.options.paginationPageSize>grid.options.totalItems?grid.options.totalItems:grid.options.paginationCurrentPage*grid.options.paginationPageSize)}} - "<div role=\"contentinfo\" class=\"ui-grid-pager-panel\" ui-grid-pager ng-show=\"grid.options.enablePaginationControls\"><div role=\"navigation\" class=\"ui-grid-pager-container\"><div role=\"menubar\" class=\"ui-grid-pager-control\"><button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-first\" ui-grid-one-bind-title=\"aria.pageToFirst\" ui-grid-one-bind-aria-label=\"aria.pageToFirst\" ng-click=\"pageFirstPageClick()\" ng-disabled=\"cantPageBackward()\"><div class=\"first-triangle\"><div class=\"first-bar\"></div></div></button> <button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-previous\" ui-grid-one-bind-title=\"aria.pageBack\" ui-grid-one-bind-aria-label=\"aria.pageBack\" ng-click=\"pagePreviousPageClick()\" ng-disabled=\"cantPageBackward()\"><div class=\"first-triangle prev-triangle\"></div></button> <input type=\"number\" ui-grid-one-bind-title=\"aria.pageSelected\" ui-grid-one-bind-aria-label=\"aria.pageSelected\" class=\"ui-grid-pager-control-input\" ng-model=\"grid.options.paginationCurrentPage\" min=\"1\" max=\"{{ paginationApi.getTotalPages() }}\" required> <span class=\"ui-grid-pager-max-pages-number\" ng-show=\"paginationApi.getTotalPages() > 0\"><abbr ui-grid-one-bind-title=\"paginationOf\">/</abbr> {{ paginationApi.getTotalPages() }}</span> <button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-next\" ui-grid-one-bind-title=\"aria.pageForward\" ui-grid-one-bind-aria-label=\"aria.pageForward\" ng-click=\"pageNextPageClick()\" ng-disabled=\"cantPageForward()\"><div class=\"last-triangle next-triangle\"></div></button> <button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-last\" ui-grid-one-bind-title=\"aria.pageToLast\" ui-grid-one-bind-aria-label=\"aria.pageToLast\" ng-click=\"pageLastPageClick()\" ng-disabled=\"cantPageToLast()\"><div class=\"last-triangle\"><div class=\"last-bar\"></div></div></button></div><div class=\"ui-grid-pager-row-count-picker\" ng-if=\"grid.options.paginationPageSizes.length > 1\"><select ui-grid-one-bind-aria-labelledby-grid=\"'items-per-page-label'\" ng-model=\"grid.options.paginationPageSize\" ng-options=\"o as o for o in grid.options.paginationPageSizes\"></select><span ui-grid-one-bind-id-grid=\"'items-per-page-label'\" class=\"ui-grid-pager-row-count-label\"> {{sizesLabel}}</span></div><span ng-if=\"grid.options.paginationPageSizes.length <= 1\" class=\"ui-grid-pager-row-count-label\">{{grid.options.paginationPageSize}} {{sizesLabel}}</span></div><div class=\"ui-grid-pager-count-container\"><div class=\"ui-grid-pager-count\"><span ng-show=\"grid.options.totalItems > 0\">{{(((grid.options.paginationCurrentPage-1)*grid.options.paginationPageSize)+1)}} <abbr ui-grid-one-bind-title=\"paginationThrough\">-</abbr> {{(grid.options.paginationCurrentPage*grid.options.paginationPageSize>grid.options.totalItems?grid.options.totalItems:grid.options.paginationCurrentPage*grid.options.paginationPageSize)}} {{paginationOf}} {{grid.options.totalItems}} {{totalItemsLabel}}</span></div></div></div>"; - - $scope.gridOptions = { - pageNumber: 1, - useExternalPagination: true, - sort : null, - paginationPageSizes: [5], - paginationPageSize: 5, - paginationTemplate: correctTotalPaginationTemplate, - columnDefs: [], - data: [], - enableSorting: true, - enableGridMenu: true, - enableSelectAll: true, - gridMenuCustomItems : [ - { title : 'All Reports', - action : function($event) { - $window.open('report.htm','_self'); - }, order : 210 }, - { title : 'Edit Report', - action : function($event) { - $window.open($scope.reportEditURL,'_self'); - }, order : 211 }, - /*{ 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 },*/ - { 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'); - }, order : 213 }, - { title : 'Export All data as CSV', - action : function($event) { - $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.csv.session','_self'); - }, order : 214 }, - { title : 'Export All data as PDF', - action : function($event) { - $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.pdf.session','_self'); - }, order : 215 } ], - exporterMenuPdf: false, - exporterMenuCsv: false, - exporterCsvFilename: 'myFile.csv', - exporterPdfDefaultStyle: {fontSize: 9}, - exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, - exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, - exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, - exporterPdfFooter: function ( currentPage, pageCount ) { - return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; - }, - exporterPdfCustomFormatter: function ( docDefinition ) { - docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; - docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; - return docDefinition; - }, - exporterPdfOrientation: 'portrait', - exporterPdfPageSize: 'LETTER', - exporterPdfMaxGridWidth: 500, - exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), - onRegisterApi: function(gridApi) { - $scope.gridApi = gridApi; - gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { - paginationOptions.pageNumber = newPage; - paginationOptions.pageSize = pageSize; - $scope.runReport(true); - }); - } - }; - - $scope.uiGridRefresh = function(){ - var columnDefsArray = []; - var columnFreezeEndColumn = $scope.reportData.colIdxTobeFreezed; - var doColumnNeedToFreeze = false; - if(columnFreezeEndColumn && columnFreezeEndColumn.length>0) { - doColumnNeedToFreeze = true; - } - $scope.reportData.reportDataColumns.forEach(function(entry) { - var tempColumnDef = { displayName: entry.columnTitle, field: entry.colId, enableSorting: entry.sortable, - sortingAlgorithm: function(a, b) { - return rowSorter.sortAlpha(a.displayValue, b.displayValue); - }, - cellTemplate: '<div class="ui-grid-cell-contents" style="text-align:{{COL_FIELD.alignment}};" title="TOOLTIP"> '+ - ' <div ng-if="!COL_FIELD.drillDownURL || COL_FIELD.drillDownURL==\'\'">{{COL_FIELD.displayValue}}</div>' + - ' <a ng-if="COL_FIELD.drillDownURL && COL_FIELD.drillDownURL!=\'\'" ng-href="{{COL_FIELD.drillDownURL}}&parent___params==={{grid.appScope.currentReportUrlParams}}" >{{COL_FIELD.displayValue}}</a>' + - '</div>'}; - if(entry.columnWidth && entry.columnWidth!='null' && entry.columnWidth!='pxpx' && entry.columnWidth!='nullpx' && entry.columnWidth!='nullpxpx'){ - tempColumnDef['minWidth'] = entry.columnWidth.substring(0, entry.columnWidth.length - 2); - } else { - tempColumnDef['minWidth'] = '100'; - } - if(doColumnNeedToFreeze) { - tempColumnDef['pinnedLeft']= true; - if(columnFreezeEndColumn === entry.colId){ - doColumnNeedToFreeze = false; - } - } - columnDefsArray.push(tempColumnDef); - }); - - $scope.gridOptions.paginationPageSizes= [$scope.reportData.pageSize]; - $scope.gridOptions.paginationPageSize= $scope.reportData.pageSize; - if($scope.reportData.totalRows<14){ - $scope.gridHeight = ($scope.reportData.totalRows+5)*30+'px'; - }else{ - $scope.gridHeight = '400px'; - } - $scope.gridOptions.totalItems = $scope.reportData.totalRows; - $scope.gridOptions.columnDefs= columnDefsArray; - $scope.gridOptions.data= $scope.reportData.reportDataRows; - $scope.gridOptions.exporterPdfHeader.text= $scope.reportData.reportName; - }; - - $scope.$watch("reportData",function(newValue,oldValue) { - if(!$scope.urlParams.hideGrid){ - if($scope.reportData){ - if($scope.reportData.displayData && $scope.reportData.reportDataColumns){ - $scope.showGrid = true; - $scope.uiGridRefresh(); - } - } - } - }); - - $scope.triggerOtherFormFields = function(){ - // 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){ - $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; - } -}]); 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 deleted file mode 100644 index 36a541ed..00000000 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-search-controller.js +++ /dev/null @@ -1,244 +0,0 @@ -appDS2.requires.push('ui.grid'); -appDS2.requires.push('ui.grid.pagination'); -appDS2.requires.push('ui.grid.resizeColumns'); -appDS2.controller("reportSearchController", ['$scope','$rootScope','$http','$timeout','uiGridConstants','$modal','$q','$log','raptorReportFactory',function ($scope,$rootScope,$http,$timeout,uiGridConstants,$modal,$q,$log,raptorReportFactory) { - $scope.showLoader=false; - $scope.getSearchData = function(){ - $scope.showLoader=true; - - raptorReportFactory.getSearchData().then(function(data){ - $scope.searchdData = data; - },function(error){ - $log.error("raptorReportFactory: getSearchData failed."); - }).finally(function() { - $scope.showLoader=false;// Always execute this on both error and success - });; - } - - $scope.getSearchData(); - - $scope.runReport = function(){ - var searchParams = ''; - if($scope.reportId && $scope.reportId!=''){ - searchParams = '&rep_id='+$scope.reportId+'&rep_id_options='+$scope.operatorRepId.index; - } - if($scope.reportName && $scope.reportName!=''){ - searchParams = searchParams+'&rep_name='+$scope.reportName+'&rep_name_options='+$scope.operatorRepName.index; - } - $scope.showLoader=true; - var pageSearchParameter = ($scope.paginationOptions.pageNumber-1)+searchParams - raptorReportFactory.getSearchDataAtPage(pageSearchParameter).then(function(data){ - $scope.searchdData = data - },function(error){ - $log.error("raptorReportFactory: getSearchDataAtPage failed."); - }).finally(function() { - $scope.showLoader=false;// Always execute this on both error and success - - }); - }; - - - $scope.paginationOptions = { - pageNumber: 1, - pageSize: 5, - sort: null - }; - - function convertValue(v){ - return parseInt(v.displayValue); - } - - $scope.getSortingAlgorithm= function (columnName) { - return function(a, b, rowA, rowB, direction) { - console.log("sorting by column " + columnName,a,b); - if(columnName=='rep_id'){ - if(a && b && a.displayValue && b.displayValue){ - if (convertValue(a) == convertValue(b)) return 0; - if (convertValue(a) < convertValue(b)) return -1; - if (convertValue(a) > convertValue(b)) return 1; - }else{ - return 0; - } - }else if(columnName=='rep_name'){ - if(a && b && a.displayValue && b.displayValue){ - if (a.displayValue == b.displayValue) return 0; - if (a.displayValue < b.displayValue) return -1; - if (a.displayValue > b.displayValue) return 1; - }else{ - return 0; - } - }else if(columnName=='descr'){ - if(a && b && a.displayValue && b.displayValue){ - if (a.displayValue == b.displayValue) return 0; - if (a.displayValue < b.displayValue) return -1; - if (a.displayValue > b.displayValue) return 1; - }else{ - return 0; - } - }else if(columnName=='owner'){ - if(a && b && a.displayValue && b.displayValue){ - if (a.displayValue == b.displayValue) return 0; - if (a.displayValue < b.displayValue) return -1; - if (a.displayValue > b.displayValue) return 1; - }else{ - return 0; - } - }else if(columnName=='create_date'){ - if(a && b && a.displayValue && b.displayValue){ - if (a.displayValue == b.displayValue) return 0; - if (a.displayValue < b.displayValue) return -1; - if (a.displayValue > b.displayValue) return 1; - }else{ - return 0; - } - } - } - }; - - var correctTotalPaginationTemplate = - //same as normal template, but fixed totals: {{(((grid.options.paginationCurrentPage-1)*grid.options.paginationPageSize)+1)}} {{(grid.options.paginationCurrentPage*grid.options.paginationPageSize>grid.options.totalItems?grid.options.totalItems:grid.options.paginationCurrentPage*grid.options.paginationPageSize)}} - "<div role=\"contentinfo\" class=\"ui-grid-pager-panel\" ui-grid-pager ng-show=\"grid.options.enablePaginationControls\"><div role=\"navigation\" class=\"ui-grid-pager-container\"><div role=\"menubar\" class=\"ui-grid-pager-control\"><button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-first\" ui-grid-one-bind-title=\"aria.pageToFirst\" ui-grid-one-bind-aria-label=\"aria.pageToFirst\" ng-click=\"pageFirstPageClick()\" ng-disabled=\"cantPageBackward()\"><div class=\"first-triangle\"><div class=\"first-bar\"></div></div></button> <button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-previous\" ui-grid-one-bind-title=\"aria.pageBack\" ui-grid-one-bind-aria-label=\"aria.pageBack\" ng-click=\"pagePreviousPageClick()\" ng-disabled=\"cantPageBackward()\"><div class=\"first-triangle prev-triangle\"></div></button> <input type=\"number\" ui-grid-one-bind-title=\"aria.pageSelected\" ui-grid-one-bind-aria-label=\"aria.pageSelected\" class=\"ui-grid-pager-control-input\" ng-model=\"grid.options.paginationCurrentPage\" min=\"1\" max=\"{{ paginationApi.getTotalPages() }}\" required> <span class=\"ui-grid-pager-max-pages-number\" ng-show=\"paginationApi.getTotalPages() > 0\"><abbr ui-grid-one-bind-title=\"paginationOf\">/</abbr> {{ paginationApi.getTotalPages() }}</span> <button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-next\" ui-grid-one-bind-title=\"aria.pageForward\" ui-grid-one-bind-aria-label=\"aria.pageForward\" ng-click=\"pageNextPageClick()\" ng-disabled=\"cantPageForward()\"><div class=\"last-triangle next-triangle\"></div></button> <button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-last\" ui-grid-one-bind-title=\"aria.pageToLast\" ui-grid-one-bind-aria-label=\"aria.pageToLast\" ng-click=\"pageLastPageClick()\" ng-disabled=\"cantPageToLast()\"><div class=\"last-triangle\"><div class=\"last-bar\"></div></div></button></div><div class=\"ui-grid-pager-row-count-picker\" ng-if=\"grid.options.paginationPageSizes.length > 1\"><select ui-grid-one-bind-aria-labelledby-grid=\"'items-per-page-label'\" ng-model=\"grid.options.paginationPageSize\" ng-options=\"o as o for o in grid.options.paginationPageSizes\"></select><span ui-grid-one-bind-id-grid=\"'items-per-page-label'\" class=\"ui-grid-pager-row-count-label\"> {{sizesLabel}}</span></div><span ng-if=\"grid.options.paginationPageSizes.length <= 1\" class=\"ui-grid-pager-row-count-label\">{{grid.options.paginationPageSize}} {{sizesLabel}}</span></div><div class=\"ui-grid-pager-count-container\"><div class=\"ui-grid-pager-count\"><span ng-show=\"grid.options.totalItems > 0\">{{(((grid.options.paginationCurrentPage-1)*grid.options.paginationPageSize)+1)}} <abbr ui-grid-one-bind-title=\"paginationThrough\">-</abbr> {{(grid.options.paginationCurrentPage*grid.options.paginationPageSize>grid.options.totalItems?grid.options.totalItems:grid.options.paginationCurrentPage*grid.options.paginationPageSize)}} {{paginationOf}} {{grid.options.totalItems}} {{totalItemsLabel}}</span></div></div></div>"; - - $scope.gridOptions = { - paginationPageSizes: [5], - paginationPageSize: 5, - paginationTemplate: correctTotalPaginationTemplate, - columnDefs: [], - enableColumnResizing: true, - data: [], - enableGridMenu: true, - enableSelectAll: true, - exporterMenuPdf: false, - exporterMenuCsv: false, - exporterCsvFilename: 'myFile.csv', - exporterPdfDefaultStyle: {fontSize: 9}, - exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, - exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, - exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, - exporterPdfFooter: function ( currentPage, pageCount ) { - return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; - }, - exporterPdfCustomFormatter: function ( docDefinition ) { - docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; - docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; - return docDefinition; - }, - exporterPdfOrientation: 'portrait', - exporterPdfPageSize: 'LETTER', - exporterPdfMaxGridWidth: 500, - exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), - onRegisterApi: function(gridApi) { - gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { - $scope.paginationOptions.pageNumber = newPage; - $scope.paginationOptions.pageSize = pageSize; - $scope.runReport(); - }); - } - }; - - - var getPage = function() { - $scope.gridOptions.columnDefs = []; - $scope.searchdData.columns[0].forEach(function(entry) { - if(entry.columnTitle=='Run'){ - $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId, enableSorting: false, - cellTemplate: '<div class="ui-grid-cell-contents"><a ng-href="#/report_run/{{COL_FIELD.drillDownLink.substr(39)}}" class="icon-controls-pointer" style="font-size:20px;"></a></div>' - }); - } else if(entry.columnTitle=='Edit'){ - $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId, enableSorting: false, - cellTemplate: '<div class="ui-grid-cell-contents"><a ng-href="{{COL_FIELD.drillDownLink}}" class="icon-misc-pen" style="font-size:20px;"></a></div>' - }); - } else if(entry.columnTitle=='Delete'){ - $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId, enableSorting: false, - cellTemplate: '<div class="ui-grid-cell-contents"><a ng-click="grid.appScope.removeReport(COL_FIELD.drillDownLink,row)" class="icon-misc-trash" style="font-size:20px;"></a></div>' - }); - } else if(entry.columnTitle=='Copy'){ - $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId, enableSorting: false, - cellTemplate: '<div class="ui-grid-cell-contents"><a ng-href="{{COL_FIELD.drillDownLink}}" class="icon-documents-copy" style="font-size:20px;"></a></div>' - }); - } else if(entry.columnTitle=='Schedule'){ - } else if(entry.columnTitle=='No'){ - } else { - $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId, - enableSorting: true, - sortingAlgorithm: $scope.getSortingAlgorithm(entry.columnId), - cellTemplate: '<div class="ui-grid-cell-contents" style="text-align:{{COL_FIELD.alignment}};" title="TOOLTIP"> <div>{{COL_FIELD.displayValue}}</div> </div>' - }); - } - }); - $scope.gridOptions.useExternalPagination=true; - $scope.gridOptions.paginationPageSizes= [$scope.searchdData.metaReport.pageSize]; - $scope.gridOptions.paginationPageSize= 50;//$scope.searchdData.metaReport.pageSize; - $scope.gridOptions.totalItems = $scope.searchdData.metaReport.totalSize; - $scope.gridOptions.data = []; - $scope.searchdData.rows[0].forEach(function(entry) { - var localData = {}; - entry.forEach(function(rowData){ - localData[rowData["columnId"]]= rowData["searchresultField"]; - }); - $scope.gridOptions.data.push(localData); - }); - }; - - $scope.$watch("searchdData",function(newValue,oldValue) { - if($scope.searchdData){ - getPage(); - } - }); - - $scope.operatorsRepId = [ - {index: 0, value: 'Equal To', text: 'Equal To', alias:'Equal To'}, - {index: 1, value: 'Less Than', text: 'Less Than', alias:'Less Than'}, - {index: 2, value: 'Greater Than', text: 'Greater Than', alias:'Greater Than'}]; - $scope.operatorRepId = {}; - $scope.operatorRepId.value = $scope.operatorsRepId[0].value; - $scope.operatorRepId.index = $scope.operatorsRepId[0].index; - - $scope.operatorsRepName = [ - {index: 0, value: 'Starts With', text: 'Starts With', alias:'Starts With'}, - {index:1, value: 'Ends With', text: 'Ends With', alias:'Ends With'}, - {index: 2, value: 'Contains', text: 'Contains', alias:'Contains'}]; - - $scope.operatorRepName = {}; - $scope.operatorRepName.value = $scope.operatorsRepName[0].value; - $scope.operatorRepName.index = $scope.operatorsRepName[0].index; - - $scope.removeReport = function(reportDeleteUrl,row) { - var modalInstance = $modal.open({ - animation: $scope.animationsEnabled, - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-del-confirm.html', - sizeClass: 'modal-small', - controller: ['$scope', '$modalInstance', '$http', '$log','raptorReportFactory', function ($scope, $modalInstance, $http, $log, raptorReportFactory) { - $scope.ok = function() { - raptorReportFactory.getReportDeleteStatus(reportDeleteUrl).then(function(data){ - if (!(data.deleted)) { - $log.error("raptorReportFactory: report removal failed.") - } - $modalInstance.close(); - },function(error){ - $log.error("report removal error.") - }); - }; - - $scope.cancel = function() { - $modalInstance.dismiss(); - }; - }] - }); - - modalInstance.result.then(function () { - $scope.$emit('RefreshGridOptions'); - }, function () { - }); - }; - - $scope.$on('RefreshGridOptions', function(event) { - $scope.getSearchData(); - }); - - $timeout(function() { - $rootScope.isViewRendering = false; - }); - - -}]); 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 deleted file mode 100644 index a23823e3..00000000 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js +++ /dev/null @@ -1,786 +0,0 @@ -appDS2.controller('reportStepController', function($scope,$http,$location, $routeParams, $q, $modal,$log,$window, raptorReportFactory, stepFormFactory) { - /*****************Init values*********************/ - $scope.reportIdURL = $routeParams.reportId; - $scope.isEdit = ($scope.reportIdURL==null||$scope.reportIdURL=='')?false:true; - $scope.isCopy = false; - $scope.isDefReady = $scope.isEdit; - $scope.activeTabsId = 'definition'; - $scope.pageMsg ='' - $scope.stepNum = 0; - $scope.stepTabs=[ - { - title: 'Definition', - id: 'definition', - uniqueId: 'uniqueStep1', - tabPanelId: 'definitionTab', - disabled: false - - }, { - title: 'SQL', - id: 'sql', - uniqueId: 'uniqueStep2', - tabPanelId: 'sqlTab', - disabled: (!$scope.isDefReady) - }, { - title: 'Columns', - id: 'columns', - uniqueId: 'uniqueTab3x', - tabPanelId: 'columnsTab', - disabled: (!$scope.isDefReady) - }, { - title: 'Form Fields', - id: 'formFields', - uniqueId: 'uniqueTab4x', - tabPanelId: 'formFieldsTab', - disabled: (!$scope.isDefReady) - }, { - title: 'Security', - id: 'security', - uniqueId: 'uniqueTab5x', - tabPanelId: 'securityTab', - disabled: (!$scope.isDefReady) - }, { - title: 'Log', - id: 'log', - uniqueId: 'uniqueTab6x', - tabPanelId: 'logTab', - disabled: (!$scope.isDefReady) - }, { - title: 'Run', - id: 'run', - uniqueId: 'uniqueTab7x', - tabPanelId: 'runTab', - disabled: (!$scope.isDefReady) - } - - ]; - $scope.$watch('activeTabsId', function (newVal, oldVal) { - if(newVal !== oldVal) { - $scope.init(); - } - }); - - $scope.renderStep = function(stepNum){ - var containerElement = angular.element(document.getElementById("stepView")); - containerElement.empty(); - $scope.stepNum = stepNum; - var jsonSrcName = getJsonSrcName(stepNum); - stepFormFactory.renderForm(jsonSrcName, containerElement, $scope); - } - $scope.next = function(){ - $scope.stepNum = $scope.stepNum +1; - $scope.activeTabsId = $scope.stepTabs[$scope.stepNum].id; - }; - - - $scope.previous = function(){ - $scope.stepNum = $scope.stepNum -1; - $scope.activeTabsId = $scope.stepTabs[$scope.stepNum].id; - } - - /*******************Step 1 Definitions****************/ - $scope.displayOptions={ - hideFormFields:false, - hideChart:false, - hideReportData:false, - hideExcel:false, - hidePdf:false - } - $scope.reportIdURL = $routeParams.reportId; - $scope.definitionData={}; - $scope.definitionData.displayOptions=[ - {name:'HideFormFields', selected:false}, - {name:'HideChart', selected:false}, - {name:'HideReportData', selected:false}, - {name:'HideExcel', selected:false}, - {name:'HidePdf', selected:false} - ] - -/* $scope.definitionData.dbSrcOptions=[ - {text:'local', value:'local', selected:true}, - {text:'e911dev_leto07', value:'e911dev_leto07', selected:false}, - ]*/ - - $scope.pageSizeValues=['10','25','50','100','500']; - $scope.pageSizeOptions =[]; - $scope.dbSrcOptions =[]; - $scope.maxRowValues = ['500','1000','2000','3000','4000','5000','10000','15000','20000','25000','30000','35000','40000','45000','50000','65000'] - $scope.maxRowOptions =[]; - $scope.frozenColValues = ['0','1','2','3','4']; - $scope.frozenColOptions =[]; - $scope.dataGridAlignValues = ['Left','Right','Center']; - $scope.dataGridAlignOptions =[]; - $scope.dataContainerValues = ['10','20','30','40','50','60','70','80','90','100','110','120','130','140','150','160','170','180','190','200']; - $scope.dataContainerOptions =[]; - $scope.runTimeFormNumValues = ['1','2','3','4']; - $scope.runTimeFormNumOptions =[]; - /******create*****/ - if(!$scope.isEdit){ - $scope.definitionData.reportType = 'Linear'; - //$scope.definitionData.dbInfo = 'Local'; - //$scope.definitionData.dbSrcOptions = ['Local']; - } - /****end create***/ - - /*functions*/ - $scope.getDefinitionById = function(id) { - $scope.showLoader=true; - raptorReportFactory.getDefinitionByReportId(id).then(function(data){ - $scope.showLoader=false; - $scope.definitionData = data; - $scope.definitionData.dbSrc=data.dbInfo; - $scope.definitionData.dbSrcOptions = data.dbInfoList; - console.log($scope.definitionData.dbSrcOptions[0].name); - - $scope.showLoader = false; - for(x in data.displayOptions){ - if(data.displayOptions[x].name=='HideFormFields') - $scope.displayOptions.hideFormFields = data.displayOptions[x].selected; - else if(data.displayOptions[x].name=='HideChart') - $scope.displayOptions.hideChart = data.displayOptions[x].selected; - else if(data.displayOptions[x].name=='HideReportData') - $scope.displayOptions.hideReportData = data.displayOptions[x].selected; - else if(data.displayOptions[x].name=='HideExcel') - $scope.displayOptions.hideExcel = data.displayOptions[x].selected; - else if(data.displayOptions[x].name=='HidePdf') - $scope.displayOptions.hidePdf = data.displayOptions[x].selected; - } - - $scope.definitionData.frozenColumns = $scope.definitionData.frozenColumns+''; - $scope.definitionData.numFormCols = $scope.definitionData.numFormCols+''; - $scope.definitionData.allowScheduler = data.allowScheduler=='Y'?true:false; - $scope.definitionData.sizedByContent = data.sizedByContent=='Y'?true:false; - - $scope.definitionData.oneTimeRec = data.oneTimeRec=='Y'?true:false; - $scope.definitionData.hourlyRec = data.hourlyRec=='Y'?true:false; - $scope.definitionData.dailyRec = data.dailyRec=='Y'?true:false; - $scope.definitionData.dailyMFRec = data.dailyMFRec=='Y'?true:false; - $scope.definitionData.weeklyRec = data.weeklyRec=='Y'?true:false; - $scope.definitionData.monthlyRec = data.monthlyRec=='Y'?true:false; - - if($scope.definitionData.reportTitle==null || $scope.definitionData.reportTitle=='') - $scope.definitionData.reportTitle = $scope.definitionData.reportName; - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: getDefinitionById failed."); - $scope.showLoader = false; - }); - } - - $scope.constructureDefDropDown = function(){ - - for(i in $scope.pageSizeValues){ - var v = { - value :$scope.pageSizeValues[i], - text :$scope.pageSizeValues[i] - } - $scope.pageSizeOptions.push(v); - } - for(i in $scope.maxRowValues){ - var v = { - value :$scope.maxRowValues[i], - text :$scope.maxRowValues[i] - } - $scope.maxRowOptions.push(v); - } - for(i in $scope.frozenColValues){ - var v = { - value :$scope.frozenColValues[i]+'', - text :$scope.frozenColValues[i] - } - $scope.frozenColOptions.push(v); - } - for(i in $scope.dataGridAlignValues){ - var v = { - value :$scope.dataGridAlignValues[i].toLowerCase(), - text :$scope.dataGridAlignValues[i] - } - $scope.dataGridAlignOptions.push(v); - } - for(i in $scope.dataContainerValues){ - var v = { - value :$scope.dataContainerValues[i], - text :$scope.dataContainerValues[i] - } - $scope.dataContainerOptions.push(v); - } - for(i in $scope.runTimeFormNumValues){ - var v = { - value :$scope.runTimeFormNumValues[i], - text :$scope.runTimeFormNumValues[i] - } - $scope.runTimeFormNumOptions.push(v); - } - } - - $scope.constructDef = function(){ - var data =Object.assign({}, $scope.definitionData); - if($scope.definitionData.dbSrc){ - console.log("Hello World ", $scope.definitionData.dbSrc); - data.dbInfo = $scope.definitionData.dbSrc; - } - for(x in $scope.definitionData.displayOptions){ - if($scope.definitionData.displayOptions[x].name=='HideFormFields') - data.displayOptions[x].selected = $scope.displayOptions.hideFormFields - else if($scope.definitionData.displayOptions[x].name=='HideChart') - data.displayOptions[x].selected = $scope.displayOptions.hideChart - else if($scope.definitionData.displayOptions[x].name=='HideReportData') - data.displayOptions[x].selected = $scope.displayOptions.hideReportData - else if($scope.definitionData.displayOptions[x].name=='HideExcel') - data.displayOptions[x].selected = $scope.displayOptions.hideExcel - else if($scope.definitionData.displayOptions[x].name=='HidePdf') - data.displayOptions[x].selected = $scope.displayOptions.hidePdf - } - if(data.pageSize==null || data.pageSize.startsWith("Select")) - data.pageSize = null; - if(data.maxRowsInExcelCSVDownload==null || data.maxRowsInExcelCSVDownload.startsWith("Select")) - data.maxRowsInExcelCSVDownload = null; - if(data.frozenColumns==null || data.frozenColumns.startsWith("Select")) - data.frozenColumns = null; - if(data.dataGridAlign==null || data.dataGridAlign.startsWith("Select")) - data.dataGridAlign = null; - if(data.dataContainerHeight==null || data.dataContainerHeight.startsWith("Select")) - data.dataContainerHeight = null; - if(data.dataContainerWidth ==null || data.dataContainerWidth.startsWith("Select")) - data.dataContainerWidth = null; - if(data.numFormCols ==null || data.numFormCols.startsWith("Select")) - data.numFormCols = null; - - if(!$scope.isEdit) - data.reportId=-1; - if(data.reportTitle==null || data.reportTitle=='') - data.reportTitle = data.reportName; - return data; - } - $scope.updateDef = function(){ - $scope.showLoader=true; - var dataToSave = $scope.constructDef(); - raptorReportFactory.updateDefinition(dataToSave,$scope.isEdit).then(function(data){ - $scope.successPopUp('Definition is updated'); - for(x in $scope.stepTabs){ - $scope.stepTabs[x].disabled=false; - } - $scope.showLoader=false; - if(isCopy){ - var newReportId = data.anyStacktrace.split("-")[0]; - if(newReportId!=null && newReportId!='' && newReportId!=-1) - $window.location.href = "#/report_wizard/"+newReportId; - } - },function(error){ - $scope.errorPopUp(error); - $log.error("report-step-controller: updateDefinition by Id failed."); - }); - } - /*******************Step1 Ends****************/ - /*******************Step2 SQL****************/ - $scope.pageisCreating = false; - $scope.sqlScript={ - value:'' - }; - $scope.sqlTestTableData=''; - /*function*/ - $scope.getSql = function(){ - $scope.showLoader = true; - raptorReportFactory.getSqlInSession().then(function(data){ - $scope.sqlInSessionJSON = data; - $scope.sqlScript.value = data.query; - $scope.showLoader = false; - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: getSearchData failed."); - }); - } - $scope.testRunSql = function(){ - $scope.showLoader=true; - var queryJSON = {query: $scope.sqlScript.value}; - queryJSON = JSON.stringify(queryJSON); - raptorReportFactory.testRunSQL(queryJSON).then(function(data){ - $scope.showLoader=false; - var modalInstance = $modal.open({ - scope: $scope, - animation: $scope.animationsEnabled, - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-wizard-test-run-sql.html', - windowClass:'modal-docked', - sizeClass: 'modal-large', - controller: testRunSqlController, - resolve:{ - queriedData: function(){ - return data; - } - } - }); - - modalInstance.result.finally(function () { - if(!$scope.isEdit){ - $scope.showLoader=true; - $scope.pageisCreating = true; - $scope.pageMsg = 'Please wait while we are creating the report. Page will be reloaded after the creation is done.' - raptorReportFactory.getDefinitionInSession().then(function(data){ - var newReportId = data.reportId; - if(newReportId!=null && newReportId!='' && newReportId!=-1) - $window.location.href = "#/report_wizard/"+newReportId; - - $scope.showLoader = false; - $scope.pageisCreating = false; - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: get Definition In Session failed."); - $scope.showLoader = false; - }); - } - }); - - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: test run SQL failed."); - }); - } - - /*******************Step2 End****************/ - /*******************Step3 Column****************/ - $scope.colTableRowData=''; - $scope.isEditCol= true; - - $scope.getColumn = function(){ - $scope.showLoader = true; - raptorReportFactory.getColumnList().then(function(data){ - $scope.colTableRowData = data; - $scope.showLoader = false; - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: get column list failed."); - }); - } - - $scope.openColumnPopup = function (rowData) { - var modalInstance = $modal.open({ - scope: $scope, - animation: $scope.animationsEnabled, - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-wizard-col-edit.html', - windowClass:'modal-docked', - sizeClass: 'modal-jumbo', - controller: openColumnPopupController, - resolve:{ - colData: function(){ - return rowData; - } - } - }); - modalInstance.result.finally(function () { - $scope.getColumn(); - }); - }; - - /*******************Step3 End****************/ - /*******************Step4 Starts Form Fields****************/ - - $scope.dataProcessing = false; - $scope.formFieldData = []; - $scope.getFormFieldList = function(){ - $scope.showLoader= true; - $scope.formFieldData = []; - raptorReportFactory.getFormFieldList().then(function(data){ - $scope.showLoader= false; - $scope.formFieldData = data; - $scope.formFieldData.sort(function(obj1, obj2) { - // Ascending: first age less than the previous - return obj1.orderSeq - obj2.orderSeq; - }); - - $scope.showLoader = false; - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: get formfields failed."); - $scope.showLoader = false; - }); - } - - $scope.formFieldReOrder = function(upID, downID){ - - $scope.moveUpFF={}; - $scope.moveDownFF={}; - $scope.showLoader=true; - raptorReportFactory.getFormFieldEditInfoById(upID).then(function(data){ - $scope.moveUpFF = data; - raptorReportFactory.getFormFieldEditInfoById(downID).then(function(data){ - $scope.moveDownFF = data; - var downOrder = $scope.moveDownFF.orderSeq; - $scope.moveDownFF.orderSeq = $scope.moveUpFF.orderSeq; - $scope.moveUpFF.orderSeq = downOrder; - raptorReportFactory.saveFormFieldEditInfo($scope.moveDownFF).then(function(data){ - raptorReportFactory.saveFormFieldEditInfo($scope.moveUpFF).then(function(data){ - $scope.successPopUp(''); - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: saveFormFieldEditInfo failed."); - }).finally(function() { - $scope.showLoader=false; - $scope.getFormFieldList(); - }) - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: saveFormFieldEditInfo failed."); - }); - - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: getColumnEditInfoById failed."); - }); - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: getColumnEditInfoById failed."); - }) - - - } - - $scope.formFieldVerifySQL= function(sqlScript){ - var queryJSON = {query: sqlScript}; - queryJSON = JSON.stringify(queryJSON); - raptorReportFactory.formFieldVerifySQL(queryJSON).then(function(data){ - var modalInstance = $modal.open({ - scope: $scope, - animation: $scope.animationsEnabled, - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-wizard-test-run-sql.html', - sizeClass: 'modal-large', - controller: formFieldVerifySQLController, - resolve:{ - queriedData: function(){ - return data; - } - } - }) - - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: test run SQL failed."); - }); - } - - - $scope.openFormFieldPopup = function (rowData,type) { - $scope.type= type; - var modalInstance = $modal.open({ - scope: $scope, - animation: true, - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-wizard-formfield-edit.html', - sizeClass: 'modal-large', - controller: openFormFieldPopupController, - resolve:{ - fieldData: function(){ - return rowData; - } - } - }); - - modalInstance.result.finally(function () { - $scope.getFormFieldList(); - }); - }; - $scope.addFormField = function(){ - $scope.openFormFieldPopup('','add'); - } - - - $scope.deleteFormField = function(rowData) { - var modalInstance = $modal.open({ - scope: $scope, - animation: $scope.animationsEnabled, - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-formfield-del-confirm.html', - sizeClass: 'modal-small', - controller: deleteFormFieldController, - resolve:{ - rowData: function(){ - return rowData; - } - } - }); - modalInstance.result.then(function () { - $scope.getFormFieldList(); - }, function () { - }); - } - - /*******************Step4 End****************/ - /*******************Step5 Starts Security****************/ - $scope.ynOptions = [ - {value:"true", text:"Yes"}, - {value:"false", text:"No"} - ]; - $scope.addReportUserId={ - id:'' - }; - $scope.addReportRoleId={ - id:'' - }; - $scope.loadSecurityPage = function() { - $scope.showLoader = true; - raptorReportFactory.resetSecurityLoadingCounter(); - - //API call 1: - raptorReportFactory.getSecurityReportOwnerList().then(function(data){ - $scope.reportOwnerList = data; - raptorReportFactory.icrementSecurityLoadingCounter(); - if(raptorReportFactory.checkSecurityLoadingCounter()){$scope.showLoader = false;}; - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: getSecurityReportOwnerList failed."); - }); - - //API call 2: get report role list - raptorReportFactory.getReportRoleList().then(function(data){ - $scope.reportRoleList = data; - raptorReportFactory.icrementSecurityLoadingCounter(); - if(raptorReportFactory.checkSecurityLoadingCounter()){$scope.showLoader = false;}; - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: getReportRoleList failed."); - }); - - //API call 3: get security page basic info - raptorReportFactory.getReportSecurityInfo().then(function(data){ - $scope.reportSecurityInfo = data; - $scope.reportOwnerId ={id: $scope.reportSecurityInfo.ownerId}; - raptorReportFactory.icrementSecurityLoadingCounter(); - if(raptorReportFactory.checkSecurityLoadingCounter()){$scope.showLoader = false;}; - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: getReportSecurityInfo failed."); - $scope.showLoader = false;}); - - //API call 4: retrieve security users - raptorReportFactory.getReportSecurityUsers().then(function(data){ - - $scope.reportSecurityUsers = data; - for (var i=0; i<$scope.reportSecurityUsers.length;i++) { - $scope.reportSecurityUsers[i]["accessAllowed"] = !$scope.reportSecurityUsers[i]["readOnly"]; - $scope.reportSecurityUsers[i].runAccess = true; // need to check why 1702 version is making it true always - } - raptorReportFactory.icrementSecurityLoadingCounter(); - if(raptorReportFactory.checkSecurityLoadingCounter()){$scope.showLoader = false;}; - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: reportSecurityUsers failed."); - }); - - //API call 5: retrieve security roles - raptorReportFactory.getReportSecurityRoles().then(function(data){ - $scope.reportSecurityRoles = data; - for (var i=0; i<$scope.reportSecurityRoles.length;i++) { - $scope.reportSecurityRoles[i]["accessAllowed"] = !$scope.reportSecurityRoles[i]["readOnly"]; - $scope.reportSecurityRoles[i].runAccess = true; // need to check why 1702 version is making it true always - } - - raptorReportFactory.icrementSecurityLoadingCounter(); - if(raptorReportFactory.checkSecurityLoadingCounter()){$scope.showLoader = false;}; - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: reportSecurityRoles failed."); - }); - } - $scope.addReportSecurityUser = function(userId) { - $scope.showLoader=true; - raptorReportFactory.addReportSecurityUser(userId).then(function(data){ - $scope.loadSecurityPage(); - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: addReportSecurityUser failed."); - }).finally(function() { - $scope.showLoader=false; - }); - } - - $scope.removeReportSecurityUser = function(securityUser) { - var modalInstance = $modal.open({ - scope: $scope, - animation: $scope.animationsEnabled, - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-user-del-confirm.html', - sizeClass: 'modal-small', - controller: removeReportSecurityUserController, - resolve:{ - securityUser: function(){ - return securityUser; - } - } - }); - modalInstance.result.then(function () { - $scope.loadSecurityPage(); - }, function () { - }); - }; - $scope.addReportSecurityRole = function(roleId) { - raptorReportFactory.addReportSecurityRole(roleId).then(function(data){ - $scope.loadSecurityPage(); - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: addReportSecurityRole failed."); - }); - } - - - $scope.removeReportSecurityRole = function(securityRole) { - var modalInstance = $modal.open({ - scope: $scope, - animation: $scope.animationsEnabled, - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-role-del-confirm.html', - sizeClass: 'modal-small', - controller: removeReportSecurityRoleController, - resolve:{ - securityRole: function(){ - return securityRole; - } - } - }); - modalInstance.result.then(function () { - $scope.loadSecurityPage(); - }, function () { - }); - } - - $scope.saveReportSecurityInfo = function() { - $scope.showLoader = true; - var securityInfo = {'userId':$scope.reportSecurityInfo.ownerId+"",'isPublic':$scope.reportSecurityInfo.isPublic}; - raptorReportFactory.updateReportSecurityInfo(securityInfo).then(function(data){ - $scope.successPopUp(''); - $scope.loadSecurityPage(); - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: updateReportSecurityInfo failed."); - }); - }; - - $scope.toggleUserEditAccessActive = function(rowData) { - var modalInstance = $modal.open({ - scope: $scope, - animation: $scope.animationsEnabled, - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-user-role-confirm-toggle.html', - sizeClass: 'modal-small', - controller: toggleUserEditAccessActiveController, - resolve:{ - rowData: function(){ - return rowData; - } - } - }); - } - - $scope.toggleRoleEditAccessActive = function(rowData) { - var modalInstance = $modal.open({ - scope: $scope, - animation: $scope.animationsEnabled, - templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-user-role-confirm-toggle.html', - sizeClass: 'modal-small', - controller: toggleRoleEditAccessActiveController, - resolve:{ - rowData: function(){ - return rowData; - } - } - }); - } - - /*******************Step5 End****************/ - /*******************Step6 Starts****************/ - $scope.logs = []; - $scope.getReportID = function(){ - $scope.showLoader = true; - raptorReportFactory.getReportLogs($routeParams.reportId).then(function(data){ - $scope.logs = data; - $scope.showLoader = false; - - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: getReportID failed."+ error); - }); - } - - - /*******************Step6 End****************/ - /*******************Step7 Starts Run****************/ - $scope.loadDefinitionInSession = function(){ - $scope.showLoader = true; - raptorReportFactory.getDefinitionInSession().then(function(data){ - $scope.reportId = data.reportId; - $scope.showLoader = false; - },function(error){ - $scope.errorPopUp(error); - $log.error("raptorReportFactory: getDefinitionInSession failed."); - $scope.showLoader = false; - }); - } - $scope.runReport = function(){ - $window.location.href = "#/report_run/c_master="+$scope.reportId+"&refresh=Y"; - } - /*******************Step7 End****************/ - - /********************Init*************/ - $scope.init = function(){ - if ($routeParams.reportMode=="copy") { - $scope.isCopy = true; - raptorReportFactory.copyReportById($routeParams.reportId).then(function(data){ - $scope.isEdit = true; - $scope.reportId = -1; - $scope.getDefinitionById(-1); - },function(error){ - $log.error("raptorReportFactory: deleteFormFieldById failed."); - }); - } /*else if ($routeParams.reportMode=="import") { - $scope.$emit('RefreshInsession'); - }*/ - - - if($scope.activeTabsId=='definition'){ /*Step 1*/ - $scope.constructureDefDropDown(); - if($scope.isEdit) - $scope.getDefinitionById($scope.reportIdURL); //edit - else - $scope.getDefinitionById(-1); //create - }else if($scope.activeTabsId=='sql'){ /*Step 2*/ - $scope.getSql(); - }else if($scope.activeTabsId=='columns'){ - $scope.getColumn(); - }else if($scope.activeTabsId=='formFields'){ - $scope.getFormFieldList(); - }else if($scope.activeTabsId=='security'){ - $scope.loadSecurityPage(); - }else if($scope.activeTabsId=='log'){ - $scope.getReportID(); - }else if($scope.activeTabsId=='run'){ - $scope.reportId = $scope.reportIdURL; - if($scope.reportId==null || $scope.reportId=='') - $scope.loadDefinitionInSession(); - } - } - - $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; - } - } - }); - }; - - $scope.init(); -}); |