From 382c506e61f11d9ebf41d2c90fc7794a3bb71900 Mon Sep 17 00:00:00 2001 From: jz385p Date: Tue, 21 Jul 2020 13:57:46 +0530 Subject: removed AngularJS project from Portal SDK removed AngularJS code base from the project Issue-ID: PORTAL-950 Change-Id: I098126e93fd7e6ada8a0babae58524f9d2ac76be Signed-off-by: jz385p --- .../ds2-reports/report-search-controller.js | 244 --------------------- 1 file changed, 244 deletions(-) delete mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-search-controller.js (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-search-controller.js') 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)}} - "
0\">/ {{ paginationApi.getTotalPages() }}
1\"> {{sizesLabel}}
{{grid.options.paginationPageSize}} {{sizesLabel}}
0\">{{(((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)}} {{paginationOf}} {{grid.options.totalItems}} {{totalItemsLabel}}
"; - - $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: '
' - }); - } else if(entry.columnTitle=='Edit'){ - $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId, enableSorting: false, - cellTemplate: '
' - }); - } else if(entry.columnTitle=='Delete'){ - $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId, enableSorting: false, - cellTemplate: '
' - }); - } else if(entry.columnTitle=='Copy'){ - $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId, enableSorting: false, - cellTemplate: '
' - }); - } 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: '
{{COL_FIELD.displayValue}}
' - }); - } - }); - $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; - }); - - -}]); -- cgit 1.2.3-korg