summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-report.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-report.component.ts')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-report.component.ts79
1 files changed, 70 insertions, 9 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-report.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-report.component.ts
index 54a45226..aa36178f 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-report.component.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-report.component.ts
@@ -24,7 +24,7 @@ import {DisplayHtml} from '../../../pages/analytics/Report_List/Report/display-h
import {ErrorModalComponent} from '../../../modals/error-modal/error-modal.component';
import {InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
import { FormControl } from '@angular/forms';
-import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
import {MatDialog} from '@angular/material';
import {HttpCacheService} from '../../../shared/services/cache.service';
@@ -44,6 +44,7 @@ const ELEMENT_DATA: PeriodicElement[] = [{}];
export class RunReportComponent implements OnInit, AfterViewInit, OnChanges {
@Input('reportId') inputReportId: string;
@Input('reportMode') reportMode: string;
+ @Input('reportType') reportType: string;
@Input('queryString') queryString: string;
@Input('isGoBack') isGoBack: string;
@Input('DashboardReportObj') DashboardReportObj: Array<GridsterItem>;
@@ -98,8 +99,10 @@ export class RunReportComponent implements OnInit, AfterViewInit, OnChanges {
timeTaken = '...';
saveResponseObj: any;
showBackButton = false;
+ customFieldsDataArray: any[];
isDashboardExcelReadyToDownload = false;
+ modalOptions: NgbModalOptions;
constructor(private _http: HttpClient,
private _route: ActivatedRoute,
@@ -131,6 +134,11 @@ export class RunReportComponent implements OnInit, AfterViewInit, OnChanges {
this.download_in_progress = false;
this.isGoBack = '';
this.isDashboardExcelReadyToDownload = false;
+ this.modalOptions = {
+ backdrop: 'static',
+ keyboard: false,
+ size: 'lg'
+ };
}
@HostListener('click') onClick() {
@@ -381,6 +389,7 @@ export class RunReportComponent implements OnInit, AfterViewInit, OnChanges {
this.totalRecords = 0;
this.displayedColumnsArr = [];
this.displayedColumns = [];
+ this.customFieldsDataArray = [];
this.formFieldPresent = false;
this.responseFormFieldListLength = 0;
this.reportName = response['reportName'];
@@ -404,7 +413,7 @@ export class RunReportComponent implements OnInit, AfterViewInit, OnChanges {
this.displayTotal.push(response['reportTotalDataRows'][totalCnt]);
totalCnt++;
}
-
+ this.customFieldsDataArray = response['reportDataRows'];
let rdr_cntr = 0;
while (response['reportDataRows'][rdr_cntr]) {
let dca_cntr = 0;
@@ -422,8 +431,17 @@ export class RunReportComponent implements OnInit, AfterViewInit, OnChanges {
!displayValue.includes('linkToReport')) {
const value = this.convertToLinkToReport(drillDownHtml);
if (value.length > 0) {
- this.replaceDisplayValue = value + ',' +
- reportDataRows[rowColumnId]['displayValue'];
+ let valueCount = [];
+ let valueDisplay = '';
+ valueCount = reportDataRows[rowColumnId]['displayValue'].split('|');
+ if (valueCount.length > 1 && this.reportType === 'Cross-Tab') {
+ for (let count = 0; count < valueCount.length - 1; count++) {
+ valueDisplay = valueDisplay + valueCount[count];
+ }
+ this.replaceDisplayValue = value + ',' + valueDisplay;
+ } else {
+ this.replaceDisplayValue = value + ',' + reportDataRows[rowColumnId]['displayValue'];
+ }
} else {
this.replaceDisplayValue = reportDataRows[rowColumnId]['displayValue'];
}
@@ -440,13 +458,20 @@ export class RunReportComponent implements OnInit, AfterViewInit, OnChanges {
'text-decoration': string;
color: string;
};
+ if (this.reportType === ('Cross-Tab') && reportDataRows[rowColumnId]['displayValueHtml'].includes('|')) {
+ let crossTabDisplayValArr = [];
+ crossTabDisplayValArr = reportDataRows[rowColumnId]['displayValueHtml'].split('|');
+ if (crossTabDisplayValArr.length > 1) {
+ displayObj['background-color'] = crossTabDisplayValArr[1];
+ }
+ }
if (reportDataRows[rowColumnId]['displayValueHtml'].includes('setStyle')) {
displayObj = JSON.parse(reportDataRows[rowColumnId]['displayValueHtml']);
}
displayObj['text-align'] = reportDataRows[rowColumnId]['alignment'];
obj['RowNum'] = (pagenum * response['pageSize'] + rdr_cntr + 1) + '|{"text-align":"center"}';
if (this.replaceDisplayValue.includes('linkToReport') || this.replaceDisplayValue.includes('linkToFeedback') || this.replaceDisplayValue.includes('linkToMail')
- || this.replaceDisplayValue.includes('linkToMap')) {
+ || this.replaceDisplayValue.includes('linkToMap') || this.replaceDisplayValue.includes('linkToHref')) {
let replaceValArr = new Array();
if (this.replaceDisplayValue.includes('linkToReport')) {
obj[reportDataRows[rowColumnId]['colId']] = this.replaceDisplayValue.split(',').join('|');
@@ -503,8 +528,8 @@ linkToReport(reportID: string, queryParameters: string) {
length++;
sessionStorage.setItem(length.toString(), this.inputReportId + '|' + this.queryString);
}*/
- let queryParamsArr = new Array();
- let columnDrilldownqueryParamsArr = new Array();
+ let queryParamsArr = [];
+ let columnDrilldownqueryParamsArr = [];
let groupSelectValue = '';
if (queryParameters.includes('groupSelectValue')) {
queryParamsArr = queryParameters.split('&');
@@ -626,10 +651,22 @@ linkToReport(reportID: string, queryParameters: string) {
styles = rowData.split('|')[4];
} else if (rowData.split('|')[0] === 'linkToMail') {
styles = rowData.split('|')[3];
+ } else if (this.reportType === 'Cross-Tab') {
+ const rowDataArray = rowData.split('|');
+ let crossTabstyles = {};
+ if (rowDataArray.length > 0) {
+ if (rowDataArray[1].includes('{')) {
+ styles = rowDataArray[1];
+ return JSON.parse(styles);
+ } else {
+ crossTabstyles = {'background-color': rowData.split('|')[1]};
+ return crossTabstyles;
+ }
+ }
} else {
styles = rowData.split('|')[1];
}
- if (styles.includes('{')) {
+ if (styles !== undefined && styles.includes('{')) {
return JSON.parse(styles);
} else {
return {};
@@ -778,9 +815,33 @@ linkToReport(reportID: string, queryParameters: string) {
openErrorModel(_message: string) {
this.changeDetectorRefs.detectChanges();
- const modalInfoRef = this.ngbModal.open(ErrorModalComponent);
+ const modalInfoRef = this.ngbModal.open(ErrorModalComponent, this.modalOptions);
modalInfoRef.componentInstance.message = _message;
return modalInfoRef;
}
+ openErrorModelPopup(_message: string) {
+ this.changeDetectorRefs.detectChanges();
+ const modalInfoRef = this.ngbModal.open(ErrorModalComponent, this.modalOptions);
+ modalInfoRef.componentInstance.message = _message;
+ modalInfoRef.result.then((data) => {
+ this.resetFormFieldValues(this.inputReportId);
+ });
+ return modalInfoRef;
+ }
+
+ resetFormFieldValues(reportId) {
+ this.httpCacheService.clearCache();
+ this._router.navigateByUrl('v2/app/refresh', {skipLocationChange: true}).then(() =>
+ this._router.navigate(['v2/run', reportId]));
+ }
+
+ linkToOpenNewTab(repId, formfiledValues) {
+ let str = [];
+ formfiledValues = formfiledValues.replaceAll('%2F','||');
+ str = window.location.pathname.split('/');
+ let approot = str[1];
+ let reportLink2 = this._router.serializeUrl(this._router.createUrlTree([approot + '/v2/run', repId, formfiledValues]));
+ window.open(reportLink2, '_blank');
+ }
}