summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report
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-dashboard-report')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/dashboard-report.service.spec.ts37
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/dashboard-report.service.ts22
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.css90
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.html44
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.scss0
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.spec.ts126
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.ts303
7 files changed, 622 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/dashboard-report.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/dashboard-report.service.spec.ts
new file mode 100644
index 00000000..1c96f7ed
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/dashboard-report.service.spec.ts
@@ -0,0 +1,37 @@
+import { TestBed } from '@angular/core/testing';
+
+import { DashboardReportService } from './dashboard-report.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { HttpClient } from '@angular/common/http';
+import { environment } from 'src/environments/environment';
+
+describe('DashboardReportService', () => {
+
+ let service: DashboardReportService;
+
+ beforeEach(() => {TestBed.configureTestingModule({
+ imports: [HttpClientTestingModule],
+ providers: [HttpClient, HttpClientTestingModule, DashboardReportService]
+ });
+ service = TestBed.get(DashboardReportService);
+
+});
+
+ it('should be created', () => {
+ const service: DashboardReportService = TestBed.get(DashboardReportService);
+ expect(service).toBeTruthy();
+ });
+
+ it('should getReportData', () => {
+ service.getReportData("test").subscribe((res) => {
+ expect(res).toBe(environment);
+ });
+ });
+
+ it('should getReportDataWithFormFields', () => {
+ service.getReportDataWithFormFields("just", "test").subscribe((res) => {
+ expect(res).toBe(environment);
+ });
+ });
+
+});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/dashboard-report.service.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/dashboard-report.service.ts
new file mode 100644
index 00000000..009865e7
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/dashboard-report.service.ts
@@ -0,0 +1,22 @@
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { environment } from 'src/environments/environment';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class DashboardReportService {
+
+ constructor(private _http: HttpClient) {
+ }
+
+
+ getReportData(reportId: string): Observable<any> {
+ return this._http.get(environment.baseUrl + 'raptor.htm?action=report.run.container&c_master=' + reportId + '&refresh=Y');
+ }
+
+ getReportDataWithFormFields(queryString: string, reportId: string): Observable<any> {
+ return this._http.get(environment.baseUrl + 'raptor.htm?action=report.run.container&c_master=' + reportId + queryString + '&refresh=Y&display_content=Y&r_page=0&child=true');
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.css b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.css
new file mode 100644
index 00000000..730fa004
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.css
@@ -0,0 +1,90 @@
+.submit-approval-btn{
+ display: contents;
+}
+.lds-ring {
+ display: inline-block;
+ position: relative;
+ width: 64px;
+ height: 64px;
+}
+.lds-ring div {
+ box-sizing: border-box;
+ display: block;
+ position: absolute;
+ width: 35px;
+ height: 35px;
+ margin: 6px;
+ margin-top: 40px;
+ border: 6px solid #006496;
+ border-radius: 80%;
+ animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
+ border-color: #006496 transparent transparent transparent;
+}
+.lds-ring div:nth-child(1) {
+ animation-delay: -0.45s;
+}
+.lds-ring div:nth-child(2) {
+ animation-delay: -0.3s;
+}
+.lds-ring div:nth-child(3) {
+ animation-delay: -0.15s;
+}
+@keyframes lds-ring {
+ 0% {
+ transform: rotate(0deg);
+ }
+ 100% {
+ transform: rotate(360deg);
+ }
+}
+
+
+table {
+ width: 100%;
+ }
+ .example-container {
+ height: auto;
+ max-height: 500px;
+ overflow: auto;
+ }
+
+ td.mat-cell{
+ padding-left: 3px;
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+ border-right: 0.1px solid gray;
+ border-left: 0.1px solid gray;
+}
+.mat-icon-delete{
+ color: #006496;
+ cursor: pointer;
+}
+
+
+.app-data-table {
+ margin-top: 0px;
+ }
+
+
+th{
+ background-color: #2125299c;
+ color: rgb(255, 255, 255);
+ font-size: 15px;
+ border-radius: 2px;
+ height: 35px;
+ }
+
+ tr:nth-child(even) {
+ background-color: #dddddd;
+ font-size: 2px;
+ height: 35px;
+ border-radius: 4px;
+
+ }
+
+ tr:nth-child(odd) {
+ font-size: 2px;
+ height: 35px;
+ border-radius: 4px;
+ }
+
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.html
new file mode 100644
index 00000000..5384e89b
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.html
@@ -0,0 +1,44 @@
+<span *ngIf="showSpinner" class="ecomp-spinner"></span>
+
+<div *ngIf="!showChart">
+ <div class="app-data-table">
+ <div class="app-data-table-fixed-height">
+ <div class="example-container">
+<!-- <mat-paginator [pageSizeOptions]="[5, 10, 20]" showFirstLastButtons></mat-paginator>-->
+ <table [dataSource]="dataSource" mat-table matSort>
+ <div *ngFor="let keys of displayedColumns; let i = index">
+ <ng-container matColumnDef="{{keys}}">
+ <th *matHeaderCellDef mat-header-cell
+ mat-sort-header>{{displayedColumnsArr[i].split(",")[0]}}</th>
+ <td *matCellDef="let row" mat-cell [ngStyle]="setStyle(row[keys])">
+ <div *ngIf="row[keys].split('|')[0] == 'linkToReport'"
+ [ngStyle]="setStyle(row[keys].split('|')[4])">
+ <a (click)="linkToReport(row[keys].split('|')[1], row[keys].split('|')[2])"
+ [routerLink]="">{{row[keys].split('|')[3]}}</a>
+ </div>
+ <div *ngIf="row[keys].split('|')[0] == 'linkToMail'"
+ [ngStyle]="setStyle(row[keys].split('|')[3])">
+ <a (click)="linkToMail(row[keys].split('|')[1])"
+ [routerLink]="">{{row[keys].split('|')[2]}}</a>
+ </div>
+ <div *ngIf="row[keys].split('|')[0] !== 'linkToReport' && row[keys].split('|')[0] !== 'linkToMail'">
+ {{row[keys].split('|')[0]}}</div>
+ </td>
+ <td *matFooterCellDef align="center"
+ mat-footer-cell>{{getDisplayTotal(keys)}}</td>
+ </ng-container>
+ </div>
+
+ <tr *matHeaderRowDef="displayedColumns; sticky: true;"
+ mat-header-row></tr>
+ <tr *matRowDef="let row; columns: displayedColumns;" mat-row></tr>
+ <tr *matFooterRowDef="displayedColumns; sticky: true;" mat-footer-row></tr>
+ </table>
+ </div>
+ </div>
+ </div>
+</div>
+<div *ngIf="showChart" align="center">
+ <iframe #iframe height="550px" style="border: none" width="100%"></iframe>
+</div>
+
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.scss
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.scss
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.spec.ts
new file mode 100644
index 00000000..ba2fbf34
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.spec.ts
@@ -0,0 +1,126 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { MatTableModule } from '@angular/material';
+import { RunDashboardReportComponent } from './run-dashboard-report.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { RouterModule, Router } from '@angular/router';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+import { DashboardReportService } from './dashboard-report.service';
+import { MockBackend, MockConnection } from '@angular/http/testing';
+import { Http, BaseRequestOptions } from '@angular/http';
+import { Observable } from 'rxjs';
+import 'rxjs/add/observable/empty';
+import 'rxjs/add/observable/of';
+import { environment } from 'src/environments/environment';
+
+describe('RunDashboardReportComponent', () => {
+ let component: RunDashboardReportComponent;
+ let fixture: ComponentFixture<RunDashboardReportComponent>;
+ let dashboardService : DashboardReportService;
+ let router: Router;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ RunDashboardReportComponent ],
+ imports: [MatTableModule, RouterTestingModule, HttpClientTestingModule],
+ providers:[DashboardReportService, MockBackend, BaseRequestOptions, {
+ provide: Http,
+ useFactory: (backend: MockBackend, defaultOptions: BaseRequestOptions) => {
+ return new Http(backend, defaultOptions);
+ },
+ deps: [MockBackend, BaseRequestOptions],
+ }]
+ })
+ .compileComponents();
+ dashboardService = TestBed.get(DashboardReportService);
+ router = TestBed.get(Router);
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(RunDashboardReportComponent);
+ component = fixture.componentInstance;
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('should test ngOnInit method', () => {
+ component.queryString = "test";
+ component.ngOnInit();
+ expect(component.initialQueryString).toEqual("test");
+ expect(component.initCounter).toEqual(component.initCounter++);
+ spyOn(component, 'initialProcesses');
+ component.initialProcesses();
+ expect(component.initialProcesses).toHaveBeenCalled();
+ });
+
+ it('should test initialProcess method', () => {
+ component.initialProcesses();
+ expect(component.dataSource.paginator).toEqual(component.paginator);
+ });
+
+ it('should test ngOnChanges methods if condition', () => {
+
+ component.hitCnt = 1;
+ component.queryString = "testing"
+ component.initialQueryString === "test";
+ component.initCounter > 0;
+ component.runButtonHitCounter === 2;
+
+ component.ngOnChanges();
+ expect(component.initialQueryString).toEqual(component.queryString);
+ expect(component.runButtonHitCounter).toEqual(component.hitCnt);
+
+ spyOn(component, 'initialProcesses');
+ spyOn(component, 'afterViewInitProcesses');
+ component.initialProcesses();
+ component.afterViewInitProcesses();
+ expect(component.initialProcesses).toHaveBeenCalled();
+ expect(component.afterViewInitProcesses).toHaveBeenCalled();
+
+ });
+
+ it('should test ngOnChanges methods else condition', () => {
+
+ component.hitCnt = 1;
+ component.queryString = "testing"
+ component.initialQueryString === "testing";
+ component.initCounter = 0;
+ component.runButtonHitCounter === 1;
+
+ component.ngOnChanges();
+ expect(component.runButtonHitCounter).toBe(component.hitCnt);
+ expect(component.initialQueryString).toBe(component.queryString);
+
+});
+
+ it('should test applyFilter method', () => {
+ component.applyFilter("testing");
+ expect(component.dataSource.filter).toEqual("testing".trim().toLowerCase());
+ });
+
+ it('should test afterViewInitProcesses method', () => {
+ component.afterViewInitProcesses();
+ expect(component.displayedColumnsArr).toEqual(new Array());
+ expect(component.displayedRowObj).toEqual(new Array());
+ expect(component.displayedColumns).toEqual(new Array());
+ expect(component.formFieldList).toEqual(new Array());
+ expect(component.showSpinner).toEqual(true);
+ expect(component.isReady).toEqual(false);
+ expect(component.NEWdisplayedColumns).toEqual(new Array());
+ });
+
+ it('should test linkToReport method', () => {
+ let reportId = "abc";
+ let queryParameters = "def";
+ component.linkToReport(reportId, queryParameters);
+ });
+
+ it('should test linkToMail method', () => {
+ let mailID = "abc";
+ component.linkToMail(mailID);
+ });
+
+}); \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.ts
new file mode 100644
index 00000000..e37154a1
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report/run-dashboard-report/run-dashboard-report.component.ts
@@ -0,0 +1,303 @@
+import {Component, OnInit, Input, AfterViewInit, ViewChild, ElementRef, ChangeDetectorRef} from '@angular/core';
+import { GridsterConfig, GridType, GridsterItem } from 'angular-gridster2';
+import { MatTableDataSource } from '@angular/material/table';
+import { MatPaginator } from '@angular/material/paginator';
+import { DashboardReportService } from './dashboard-report.service';
+import { MatSort } from '@angular/material';
+import { Router } from '@angular/router';
+import { RunService } from '../../run.service';
+import {FormControl} from '@angular/forms';
+import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
+import {environment} from '../../../../../environments/environment';
+import {DisplayHtml} from '../../../../pages/analytics/Report_List/Report/display-html';
+import {ErrorModalComponent} from '../../../../modals/error-modal/error-modal.component';
+
+export interface PeriodicElement {
+
+}
+
+const ELEMENT_DATA: PeriodicElement[] = [{}];
+
+@Component({
+ selector: 'app-run-dashboard-report',
+ templateUrl: './run-dashboard-report.component.html',
+ styleUrls: ['./run-dashboard-report.component.css']
+})
+
+export class RunDashboardReportComponent implements AfterViewInit {
+
+ @Input('reportId') inputReportId: string;
+ @Input('queryString') queryString: string;
+ @Input('hitCnt') hitCnt: number;
+ @Input('reportType') reportType: string;
+ @Input('parentId') parentId: string;
+ dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
+ @ViewChild(MatPaginator, {static: false} as any) paginator: MatPaginator;
+ @ViewChild(MatSort, {static: false} as any) sort: MatSort;
+ @ViewChild('iframe') iframe: ElementRef;
+ options: GridsterConfig;
+ dashboard: Array<GridsterItem> = [];
+ displayedColumns: string[];
+ IncomingReportId: string;
+ displayedColumnsArr: string[];
+ displayedRowObj: {}[];
+ formFieldPresent: boolean;
+ showSpinner: boolean;
+ formFieldList: {}[];
+ isReady: boolean;
+ responseFormFieldListLength: number;
+ NEWdisplayedColumns: string[];
+ initCnt: number;
+ reportName: string;
+ showDashboardReport: boolean;
+ checkCnt: number;
+ initialQueryString: string;
+ initCounter: number;
+ runButtonHitCounter: number;
+ showChart = false;
+ displayColumValue: string;
+ displayTotal: any[];
+ private chartRunUrl: string;
+ replaceDisplayValue: String;
+saveResponseObj:any;
+
+ constructor(private _dashboardReportService: DashboardReportService,
+ private _router: Router,
+ private _runService: RunService,
+ private ngModal: NgbModal,
+ private changeDetectorRefs: ChangeDetectorRef,
+ public ngbModal: NgbModal) {
+ this.initCounter = 0;
+ this.runButtonHitCounter = 0;
+ }
+
+ ngOnInit() {
+ this.initialQueryString = this.queryString;
+ this.initCounter++;
+ this.runButtonHitCounter = this.hitCnt;
+ if (this.reportType === 'Chart') {
+ this.showChart = true;
+ }
+
+ this.initialProcesses();
+ }
+
+ initialProcesses() {
+ // this.dataSource.paginator = this.paginator;
+ }
+
+ ngOnChanges() {
+ if (this.initialQueryString !== this.queryString && this.initCounter > 0 && this.runButtonHitCounter !== this.hitCnt) {
+ this.initialQueryString = this.queryString;
+ this.runButtonHitCounter = this.hitCnt;
+ this.initialProcesses();
+ this.afterViewInitProcesses();
+ } else {
+ this.runButtonHitCounter = this.hitCnt;
+ this.initialQueryString = this.queryString;
+ }
+ }
+
+ ngAfterViewInit() {
+ this.afterViewInitProcesses();
+ }
+
+ afterViewInitProcesses() {
+ if (this.showChart) {
+ this.chartRunUrl = environment.baseUrl + 'raptor.htm?action=chart.run&c_master=' +
+ this.inputReportId + this.queryString + '&refresh=Y&display_content=Y&r_page=0';
+ this.iframe.nativeElement.setAttribute('src', this.chartRunUrl);
+ this.showSpinner = false;
+ } else {
+
+ this.displayedColumnsArr = [];
+ this.displayedRowObj = [];
+ this.displayedColumns = [];
+ this.formFieldList = [];
+ this.showSpinner = true;
+ this.isReady = false;
+ this.NEWdisplayedColumns = [];
+ this.displayTotal = [];
+ if (localStorage.getItem(this.inputReportId)) {
+ this.postFetchingReportDataFn(JSON.parse(localStorage.getItem(this.inputReportId)));
+ localStorage.removeItem(this.inputReportId);
+ } else {
+ this._dashboardReportService.getReportDataWithFormFields(this.queryString, this.inputReportId)
+ .subscribe((response) => {
+ if (response['errormessage']){
+ this.openErrorModel(response['errormessage']);
+ this.showSpinner = false;
+ this.changeDetectorRefs.detectChanges();
+ } else {
+ this.postFetchingReportDataFn(response);
+ }
+ }, error => {
+ this.openErrorModel('Error occurred while running report: ' + this.inputReportId);
+ this.showSpinner = false;
+ this.changeDetectorRefs.detectChanges();
+ });
+ }
+ }
+ }
+
+ postFetchingReportDataFn(response: any){
+ this.saveResponseObj = response;
+ this.formFieldPresent = false;
+ this.responseFormFieldListLength = 0;
+ this.reportName = response['reportName'];
+ let columnCntr = 0;
+ this.displayedColumnsArr.push('RowNum,RowNum');
+ while (response['reportDataColumns'][columnCntr]) {
+ this.displayedColumnsArr.push(response['reportDataColumns'][columnCntr]['columnTitle'] + ','
+ + response['reportDataColumns'][columnCntr]['colId']);
+ columnCntr++;
+ }
+ let totalCnt = 0;
+ while (response['reportTotalDataRows'][totalCnt]) {
+ this.displayTotal.push(response['reportTotalDataRows'][totalCnt]);
+ totalCnt++;
+ }
+ let rdr_cntr = 0;
+ while (response['reportDataRows'][rdr_cntr]) {
+ let dca_cntr = 0;
+ const obj = {};
+ const reportDataRows = response['reportDataRows'][rdr_cntr];
+ while (this.displayedColumnsArr[dca_cntr]) {
+ const rowColumnId = this.displayedColumnsArr[dca_cntr].split(',')[1];
+ if (reportDataRows[rowColumnId]) {
+ let drillDownHtml = '';
+ let displayValue = '';
+ drillDownHtml = reportDataRows[rowColumnId]['drillDownURL'];
+ displayValue = reportDataRows[rowColumnId]['displayValue'];
+ if (drillDownHtml !== null &&
+ drillDownHtml.length > 0 &&
+ !displayValue.includes('linkToReport')) {
+ const value = this.convertToLinkToReport(drillDownHtml);
+ if (value.length > 0) {
+ this.replaceDisplayValue = value + ',' +
+ reportDataRows[rowColumnId]['displayValue'];
+ } else {
+ this.replaceDisplayValue = reportDataRows[rowColumnId]['displayValue'];
+ }
+ } else {
+ this.replaceDisplayValue = reportDataRows[rowColumnId]['displayValue'];
+ }
+ let displayObj: DisplayHtml = new class implements DisplayHtml {
+ 'background-color': string;
+ 'font-family': string;
+ 'font-size': string;
+ 'font-style': string;
+ 'font-weight': string;
+ 'text-align': string;
+ 'text-decoration': string;
+ color: string;
+ };
+ if (reportDataRows[rowColumnId]['displayValueHtml'].includes('{')) {
+ displayObj = JSON.parse(reportDataRows[rowColumnId]['displayValueHtml']);
+ }
+ displayObj['text-align'] = reportDataRows[rowColumnId]['alignment'];
+ obj['RowNum'] = (rdr_cntr + 1) + '|{"text-align":"center"}';
+ if (this.replaceDisplayValue.includes('linkToReport') || this.replaceDisplayValue.includes('linkToMail')) {
+ obj[reportDataRows[rowColumnId]['colId']] = this.replaceDisplayValue.split(',').join('|')
+ + '|' + JSON.stringify(displayObj);
+ } else {
+ obj[reportDataRows[rowColumnId]['colId']] = this.replaceDisplayValue
+ + '|' + JSON.stringify(displayObj);
+ }
+ }
+ dca_cntr++;
+ }
+ this.displayedRowObj.push(obj);
+ rdr_cntr++;
+ }
+ for (let pushCounter = 0; pushCounter < this.displayedColumnsArr.length; pushCounter++) {
+ this.displayedColumns.push(this.displayedColumnsArr[pushCounter].split(',')[1]);
+ }
+ this.showSpinner = false;
+ this.dataSource = new MatTableDataSource<PeriodicElement>(this.displayedRowObj);
+ this.dataSource.sort = this.sort;
+ this.changeDetectorRefs.detectChanges();
+ }
+
+ linkToReport(reportID: string, queryParameters: string) {
+ localStorage.setItem(this.inputReportId, JSON.stringify(this.saveResponseObj));
+ if (sessionStorage.length === 0) {
+ sessionStorage.setItem('1', this.parentId + '|' + this.queryString);
+ } else {
+ let length = sessionStorage.length;
+ length++;
+ sessionStorage.setItem(length.toString(), this.parentId + '|' + this.queryString);
+ }
+ this._router.navigate(['v2/run', reportID, queryParameters]);
+ }
+
+ linkToMail(mailId: string) {
+ const email = 'mailto:' + mailId;
+ window.location.href = email;
+ }
+
+ applyFilter(filterValue: string) {
+ this.dataSource.filter = filterValue.trim().toLowerCase();
+ }
+
+ 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 !== undefined && styles.includes('{')) {
+ return JSON.parse(styles);
+ } else {
+ return {};
+ }
+ }
+
+ getDisplayTotal(keys: any) {
+ if (this.displayTotal.length > 0) {
+ return this.displayTotal[0][keys].displayValue;
+ } else {
+ return '';
+ }
+ }
+
+ convertToLinkToReport(value: string) {
+ value = value.replace(/;/g, '');
+ let outPut = '';
+ while (value.includes('c_master=')) {
+ const index = value.indexOf('c_master=');
+ if (index > 0) {
+ value = value.substring(index, value.length);
+ } else if (index === 0) {
+ value = value.replace('c_master=', '');
+ }
+ }
+ const split = value.split('&');
+ // const spltFirst = split[0].split('=');
+ if (split[1].length <= 0) {
+ return outPut;
+ }
+ outPut = 'linkToReport,' + split[0] + ',';
+ let splitCounter = 1;
+ for (splitCounter = 1; splitCounter < split.length; splitCounter++) {
+ if (!split[splitCounter].includes('LOGIN_ID=') &&
+ !split[splitCounter].includes('display_content=') &&
+ !split[splitCounter].includes('drilldown_index=') &&
+ !split[splitCounter].includes('show_back_btn=') &&
+ !split[splitCounter].includes('r_action')) {
+ outPut = outPut + '&' + split[splitCounter];
+ }
+ }
+ return outPut;
+ }
+
+ openErrorModel(_message: string) {
+ const modalInfoRef = this.ngbModal.open(ErrorModalComponent);
+ modalInfoRef.componentInstance.message = _message;
+ return modalInfoRef;
+ }
+
+}