diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.ts')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.ts | 130 |
1 files changed, 67 insertions, 63 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.ts index 7e0ac549..7f1e8331 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.ts @@ -1,28 +1,28 @@ import { AfterViewInit, + ChangeDetectionStrategy, + ChangeDetectorRef, Component, - OnInit, - ViewChild, + ElementRef, Input, - SimpleChange, + OnInit, SimpleChanges, - ChangeDetectorRef, - Inject, - ElementRef + ViewChild } from '@angular/core'; -import {MatPaginator} from '@angular/material/paginator'; -import {MatSort} from '@angular/material/sort'; -import {MatTable, MatTableDataSource} from '@angular/material/table'; -import {ActivatedRoute, Router} from '@angular/router'; -import {HttpClient} from '@angular/common/http'; -import {environment} from '../../../../../../../environments/environment'; -import {RunService} from '../run.service'; -import {GridsterConfig, GridsterItem, GridType} from 'angular-gridster2'; -import {Observable} from 'rxjs'; -import {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser'; -import {displayGrids} from 'angular-gridster2/lib/gridsterConfig.interface'; -import {DisplayHtml} from '../../display-html'; -import {FormControl} from '@angular/forms'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; +import { MatTableDataSource } from '@angular/material/table'; +import { ActivatedRoute, Router } from '@angular/router'; +import { HttpClient } from '@angular/common/http'; +import { environment } from '../../../../../../../environments/environment'; +import { RunService } from '../run.service'; +import { GridsterConfig, GridsterItem, GridType } from 'angular-gridster2'; +import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; +import { DisplayHtml } from '../../display-html'; +import { FormControl } from '@angular/forms'; +import { HeaderService } from 'src/app/shared/services/header/header.service'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; export interface PeriodicElement { @@ -33,7 +33,8 @@ const ELEMENT_DATA: PeriodicElement[] = [{}]; @Component({ selector: 'app-run-report', templateUrl: './run-report.component.html', - styleUrls: ['./run-report.component.css'] + styleUrls: ['./run-report.component.css'], + changeDetection: ChangeDetectionStrategy.OnPush }) export class RunReportComponent implements OnInit, AfterViewInit { @Input('reportId') inputReportId: string; @@ -44,9 +45,10 @@ export class RunReportComponent implements OnInit, AfterViewInit { @Input('hitCnt') hitCnt: number; @Input('runAgain') runAgain: string; @Input('groupSelectValue') groupSelectValue: string; + @Input('chartType') chartType: string; @ViewChild('iframe') iframe: ElementRef; - @ViewChild(MatPaginator, {static: false} as any) paginator: MatPaginator; - @ViewChild(MatSort, {static: false} as any) sort: MatSort; + @ViewChild(MatPaginator, { static: false } as any) paginator: MatPaginator; + @ViewChild(MatSort, { static: false } as any) sort: MatSort; dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA); displayedColumns: string[]; IncomingReportId: string; @@ -90,7 +92,6 @@ export class RunReportComponent implements OnInit, AfterViewInit { timeTaken = '...'; saveResponseObj: any; showBackButton = false; - showChart: boolean = false; constructor(private _http: HttpClient, private _route: ActivatedRoute, @@ -219,7 +220,7 @@ export class RunReportComponent implements OnInit, AfterViewInit { pushItems: true, disablePushOnDrag: false, disablePushOnResize: false, - pushDirections: {north: true, east: true, south: true, west: true}, + pushDirections: { north: true, east: true, south: true, west: true }, pushResizeItems: true, disableWindowResize: true, disableWarnings: false, @@ -245,7 +246,6 @@ export class RunReportComponent implements OnInit, AfterViewInit { this.hitCnt = this.runButtonHitCnt; this.initialQueryString = this.queryString; this.initCounter++; - } ngAfterViewInit() { @@ -310,22 +310,22 @@ export class RunReportComponent implements OnInit, AfterViewInit { this.showMoreVert = true; localStorage.removeItem(this.inputReportId); } else { - this._runService.getReportDataWithFormFields(this.queryString, this.inputReportId) - .subscribe((response) => { - if (response['errormessage']) { - this.showError(response); - } else { - this.chartRunUrl = environment.baseUrl + 'raptor.htm?action=chart.run&c_master=' + - this.inputReportId + this.queryString + '&refresh=Y&display_content=Y&r_page=0'; + this._runService.getReportDataWithFormFields(this.queryString, this.inputReportId) + .subscribe((response) => { + if (response['errormessage']) { + this.showError(response); + } else { + this.chartRunUrl = environment.baseUrl + 'raptor.htm?action=chart.run&c_master=' + + this.inputReportId + this.queryString + '&refresh=Y&display_content=Y&r_page=0'; this.saveResponseObj = response; - this.postFetchingReportDataFn(response, false); - const endDate: Date = new Date(); - const endTime = endDate.getTime(); - this.timeTaken = ((endTime - startTime) / 1000).toString(); - this.showMoreVert = true; - } - }); - } + this.postFetchingReportDataFn(response, false); + const endDate: Date = new Date(); + const endTime = endDate.getTime(); + this.timeTaken = ((endTime - startTime) / 1000).toString(); + this.showMoreVert = true; + } + }); + } } } else { this.showMoreVert = true; @@ -360,11 +360,9 @@ export class RunReportComponent implements OnInit, AfterViewInit { rdc_cntr++; } - if (response['chartWizardAvailable'] === true) { + if (response['chartWizardAvailable'] === true && this.chartType !== 'none') { this.isChartAvailable = true; - if(this.iframe){ - this.iframe.nativeElement.setAttribute('src', this.chartRunUrl); - } + this.iframe.nativeElement.setAttribute('src', this.chartRunUrl); } let totalCnt = 0; @@ -440,9 +438,6 @@ export class RunReportComponent implements OnInit, AfterViewInit { } this.dataSource.data = this.displayedRowObj; this.dataSource.sort = this.sort; - if(this.totalRecords >0){ - this.showChart = true; - } } @@ -455,13 +450,10 @@ export class RunReportComponent implements OnInit, AfterViewInit { length++; sessionStorage.setItem(length.toString(), this.inputReportId + '|' + this.queryString); } - this._router.navigate(['v2/run', reportID, queryParameters]); + this._router.navigate(['v2/app/run', reportID, queryParameters]); } - linkToFeedback(feedBackId: string, queryParameters: string) { - this._router.navigate(['v2/feedback', feedBackId]); - } linkToMail(mailId: string) { const email = 'mailto:' + mailId; @@ -509,13 +501,19 @@ export class RunReportComponent implements OnInit, AfterViewInit { } downLoadFile(data: any, type: string, extension: string, reportType: string) { - const blob = new Blob([data], {type: type}); - const dt = new Date(); - const utcDate = dt.getTime(); - let fileName = this.reportName + utcDate + '.' + extension; + const blob = new Blob([data], { type: type }); + const date = new Date(); + const dateStr = + ('00' + (date.getMonth() + 1)).slice(-2) + + ('00' + date.getDate()).slice(-2) + + date.getFullYear() + + ('00' + date.getHours()).slice(-2) + + ('00' + date.getMinutes()).slice(-2) + + ('00' + date.getMilliseconds()); + let fileName = this.reportName + dateStr + '.' + extension; if (reportType === 'Dashboard') { fileName = ''; - fileName = reportType + '-' + this.inputReportId + '.' + extension; + fileName = reportType + '_' + this.inputReportId + '_' + dateStr + '.' + extension; } if (window.navigator.msSaveOrOpenBlob) { window.navigator.msSaveBlob(blob, fileName); @@ -539,7 +537,15 @@ export class RunReportComponent implements OnInit, AfterViewInit { } } - setStyle(styles: string) { + setStyle(rowData: string) { + let styles = ''; + if (rowData.split('|')[0] === 'linkToReport') { + styles = rowData.split('|')[4]; + } else if (rowData.split('|')[0] === 'linkToMail') { + styles = rowData.split('|')[3]; + } else { + styles = rowData.split('|')[1]; + } if (styles.includes('{')) { return JSON.parse(styles); } else { @@ -547,6 +553,8 @@ export class RunReportComponent implements OnInit, AfterViewInit { } } + + getDisplayTotal(keys: string) { if (this.displayTotal.length > 0) { return this.displayTotal[0][keys].displayValue; @@ -633,7 +641,6 @@ export class RunReportComponent implements OnInit, AfterViewInit { } } const split = value.split('&'); - // const spltFirst = split[0].split('='); if (split[1].length <= 0) { return outPut; } @@ -651,10 +658,8 @@ export class RunReportComponent implements OnInit, AfterViewInit { return outPut; } - - takeToReport(queryString: string, reportID: string) { - this._router.navigate(['v2/run', reportID, queryString , this.groupSelectValue]); + this._router.navigate(['v2/app/run', reportID, queryString, this.groupSelectValue]); } goBack() { @@ -675,8 +680,7 @@ export class RunReportComponent implements OnInit, AfterViewInit { sessionStorage.removeItem('1'); } localStorage.removeItem(this.inputReportId); - this._router.navigate(['v2/run', repId, queryString]); + this._router.navigate(['v2/app/run', repId, queryString]); } } - |