summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/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/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.ts460
1 files changed, 291 insertions, 169 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 1895cc35..cc520380 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,30 +1,41 @@
-import { AfterViewInit, Component, OnInit, ViewChild, Input, SimpleChange, SimpleChanges } from '@angular/core';
+import { AfterViewInit, Component, OnInit, ViewChild, Input, SimpleChange, SimpleChanges, ChangeDetectorRef, Inject } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
-import { MatTable } from '@angular/material/table';
+import { MatTable, MatTableDataSource } from '@angular/material/table';
import { RunReportDataSource, RunReportFinalTableItem } from './run-report-datasource';
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';
+
+
+export interface PeriodicElement {
+
+}
+
+
+const ELEMENT_DATA: PeriodicElement[] = [{}];
@Component({
selector: 'app-run-report',
templateUrl: './run-report.component.html',
styleUrls: ['./run-report.component.css']
})
-export class RunReportComponent implements OnInit {
+export class RunReportComponent implements OnInit, AfterViewInit {
@Input("reportId") reportId1 : string;
@Input("reportMode") reportMode : string;
@Input("queryString") queryString : string;
+ @Input("DashboardReportObj") DashboardReportObj : Array<GridsterItem>;
+ @Input("TriggerFFArr") TriggerFFArr : string[];
+ @Input("hitCnt") hitCnt : number;
@ViewChild(MatPaginator, {static: false} as any) paginator: MatPaginator;
@ViewChild(MatSort, {static: false} as any) sort: MatSort;
@ViewChild(MatTable, {static: false} as any) table: MatTable<RunReportFinalTableItem>;
- dataSource: RunReportDataSource;
-
- /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
+ dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
displayedColumns : string[];
IncomingReportId : string;
displayedColumnsArr : string[];
@@ -36,236 +47,347 @@ export class RunReportComponent implements OnInit {
responseFormFieldListLength : number;
NEWdisplayedColumns : string[];
initCnt : number;
+ reportName : string;
+ showDashboardReport : boolean;
+ checkCnt : number;
+
+ options: GridsterConfig;
+ dashboard : Array<GridsterItem> = new Array();
+ openOptionsFlag : boolean;
+ showMoreVert : boolean;
+ errorMessage : string = "";
+ stackTrace : string = "";
+ error : boolean = false;
+ environment : any;
+ initialQueryString : string;
+ initCounter : number;
+ runButtonHitCnt : number;
+
+
- constructor(private _http : HttpClient, private _route : ActivatedRoute, private _runService : RunService, private _router : Router){
+ constructor(private _http : HttpClient,
+ private _route : ActivatedRoute,
+ private _runService : RunService,
+ private _router : Router,
+ private changeDetectorRefs: ChangeDetectorRef)
+ {
this.displayedColumnsArr = new Array();
this.displayedRowObj = new Array();
this.displayedColumns = new Array();
this.formFieldList = new Array();
- // this.formFieldPresent = false;
this.showSpinner = true;
this.isReady = false;
this.NEWdisplayedColumns = new Array();
this.initCnt = 0;
+ this.checkCnt = 0;
+ this.showDashboardReport = false;
+ this.openOptionsFlag = false;
+ this.showMoreVert = false;
+ this.environment = environment;
+ this.initCounter = 0;
+ this.runButtonHitCnt = 0;
+
+ this._router.routeReuseStrategy.shouldReuseRoute = function() {
+ return false;
+ };
}
-
ngOnChanges(changes: SimpleChanges)
{
-
- if(this.reportMode !== "Regular" && this.initCnt > 0)
+ if(this.reportMode !== "Regular" && this.initCnt > 0 && this.TriggerFFArr.length == 0)
{
- console.log(changes);
- this.queryString = changes["queryString"]["currentValue"];
- this.initCnt = 1;
+ this.showMoreVert = false;
+ if(changes["queryString"])
+ {
+ this.queryString = changes["queryString"]["currentValue"];
+ }
+ this.initCnt = 1;
+ this.showDashboardReport = false;
-
- this.dataSource = new RunReportDataSource();
+ this.dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
this.displayedColumnsArr = new Array();
this.displayedRowObj = new Array();
this.displayedColumns = new Array();
this.formFieldList = new Array();
- // this.formFieldPresent = false;
this.showSpinner = true;
this.isReady = false;
this.NEWdisplayedColumns = new Array();
-
- this._runService.getReportDataWithFormFields(this.queryString, this.reportId1)
- .subscribe((response) => {
- console.log(response);
- this.responseFormFieldListLength = 0;
- this.formFieldPresent = false;
-
- // this.formFieldPresent = true;
-
- let i=0;
- while(response["reportDataColumns"][i])
- {
- this.displayedColumnsArr.push(response["reportDataColumns"][i]["columnTitle"] +","+ response["reportDataColumns"][i]["colId"]);
- i++;
- }
-
- let j=0;
- while(response["reportDataRows"][j])
- {
- let k=0;
- let obj = new Object();
- while(this.displayedColumnsArr[k])
+ this._runService.getReportDataWithFormFields(this.queryString, this.reportId1)
+ .subscribe((response) => {
+ if(response["errormessage"])
{
- if(response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]])
+ this.showError(response);
+ }
+ else
+ {
+ if(this.reportMode !== "FormField")
+ {
+ this.postFetchingReportDataFn(response);
+ this.showMoreVert = true;
+ this.showDashboardReport = true;
+ }
+ else
{
- //console.log(response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]);
- obj[response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]["colId"]] = response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]["displayValue"];
- //this.displayedRowObj.push(response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]);
+ this.postFetchingReportDataFn(response);
+ this.showMoreVert = true;
}
- k++;
}
- this.displayedRowObj.push(obj);
- //console.log(response["reportDataRows"][j]);
- j++;
- }
-
- console.log(this.displayedColumnsArr);
- console.log(this.displayedRowObj);
-
- for(let l=0; l<this.displayedColumnsArr.length; l++)
- {
- this.displayedColumns.push(this.displayedColumnsArr[l].split(",")[1]);
- }
-
-
- this.showSpinner = false;
-
- this.dataSource.data = this.displayedRowObj;
- this.dataSource.sort = this.sort;
- this.dataSource.paginator = this.paginator;
- this.table.dataSource = this.dataSource;
-
});
}
+ else
+ {
+ }
+
+ if(this.initialQueryString !== this.queryString && this.initCounter > 0 && this.hitCnt !== this.runButtonHitCnt)
+ {
+ this.runButtonHitCnt = this.hitCnt;
+ this.initialQueryString = this.queryString;
+ this.initialProcesses();
+ this.afterViewInitialProcesses();
+ }
+ else
+ {
+ this.runButtonHitCnt = this.hitCnt;
+ this.initialQueryString = this.queryString;
+ }
}
- ngOnInit() {
+ ngOnInit(){
+ this.initialProcesses();
+ }
+
+ initialProcesses()
+ {
+ if(this.DashboardReportObj.length > 0)
+ {
+ this.dashboard = this.DashboardReportObj;
+ this.options = {
+ gridType: GridType.ScrollVertical,
+ margin: 10,
+ outerMargin: true,
+ outerMarginTop: 10,
+ outerMarginRight: 10,
+ outerMarginBottom: 5000,
+ outerMarginLeft: 10,
+ scrollSensitivity: 10,
+ scrollSpeed: 20,
+ emptyCellDragMaxCols: null,
+ emptyCellDragMaxRows: null,
+ ignoreContentClass: 'gridster-item-content',
+ enableOccupiedCellDrop : true,
+ ignoreMarginInRow: false,
+ draggable: {
+ enabled: true,
+ },
+ resizable: {
+ enabled: true,
+ },
+ swap: true,
+ pushItems: true,
+ disablePushOnDrag: false,
+ disablePushOnResize: false,
+ pushDirections: {north: true, east: true, south: true, west: true},
+ pushResizeItems: true,
+ disableWindowResize: true,
+ disableWarnings: false,
+ scrollToNewItems: true,
+ enableDropToAdd : true,
+ enableEmptyCellDrop : true,
+ minCols : 2,
+ minRows : 2,
+
+ };
+ this.showDashboardReport = true;
- if(this.reportMode == "Regular" && this.initCnt == 0)
+ }
+
+ this.hitCnt = this.runButtonHitCnt;
+ this.initialQueryString = this.queryString;
+ this.initCounter++;
+ }
+
+ ngAfterViewInit() {
+ this.afterViewInitialProcesses();
+ }
+
+afterViewInitialProcesses()
+{
+
+ if(this.DashboardReportObj.length === 0)
+ {
+ if(this.reportMode === "Regular" && this.initCnt == 0)
{
- this.dataSource = new RunReportDataSource();
+ this.showMoreVert = false;
+ this.dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
this.displayedColumnsArr = new Array();
this.displayedRowObj = new Array();
this.displayedColumns = new Array();
this.formFieldList = new Array();
- // this.formFieldPresent = false;
this.showSpinner = true;
this.isReady = false;
this.NEWdisplayedColumns = new Array();
- this._runService.getReportData(this.reportId1)
- .subscribe((response) => {
- this.formFieldPresent = false;
- this.responseFormFieldListLength = 0;
- console.log(this.reportId1, this.reportMode);
- // this._router.navigate(['v2/run', this.reportId1]);
-
- let i=0;
- while(response["reportDataColumns"][i])
- {
- this.displayedColumnsArr.push(response["reportDataColumns"][i]["columnTitle"] +","+ response["reportDataColumns"][i]["colId"]);
- i++;
- }
-
- let j=0;
- while(response["reportDataRows"][j])
- {
- let k=0;
- let obj = new Object();
- while(this.displayedColumnsArr[k])
+ this._runService.getReportData(this.reportId1)
+ .subscribe((response) => {
+ if(response["errormessage"])
{
- if(response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]])
- {
- //console.log(response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]);
- obj[response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]["colId"]] = response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]["displayValue"];
- //this.displayedRowObj.push(response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]);
- }
- k++;
+ this.showError(response);
}
- this.displayedRowObj.push(obj);
- //console.log(response["reportDataRows"][j]);
- j++;
- }
-
- console.log(this.displayedColumnsArr);
- console.log(this.displayedRowObj);
-
- for(let l=0; l<this.displayedColumnsArr.length; l++)
- {
- this.displayedColumns.push(this.displayedColumnsArr[l].split(",")[1]);
- }
-
- this.showSpinner = false;
-
- this.dataSource.data = this.displayedRowObj;
-
- this.dataSource.sort = this.sort;
- this.dataSource.paginator = this.paginator;
+ else
+ {
+ this.postFetchingReportDataFn(response);
+ this.showMoreVert = true;
+ }
+ });
+ }
+ else
+ {
- this.table.dataSource = this.dataSource;
-
- });
- }
- else
- {
-
- this.dataSource = new RunReportDataSource();
+ this.showMoreVert = false;
+ this.dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
this.displayedColumnsArr = new Array();
this.displayedRowObj = new Array();
this.displayedColumns = new Array();
this.formFieldList = new Array();
- // this.formFieldPresent = false;
this.showSpinner = true;
this.isReady = false;
this.NEWdisplayedColumns = new Array();
+ this._runService.getReportDataWithFormFields(this.queryString, this.reportId1)
+ .subscribe((response) => {
+ if(response["errormessage"])
+ {
+ this.showError(response);
+ }
+ else
+ {
+ this.postFetchingReportDataFn(response);
+ this.showMoreVert = true;
+ }
+ });
+ }
+
- this._runService.getReportDataWithFormFields(this.queryString, this.reportId1)
- .subscribe((response) => {
- console.log(response);
- this.responseFormFieldListLength = 0;
- this.formFieldPresent = false;
+}
+else
+{
+this.showSpinner = false;
+}
- // this.formFieldPresent = true;
-
- let i=0;
- while(response["reportDataColumns"][i])
- {
- this.displayedColumnsArr.push(response["reportDataColumns"][i]["columnTitle"] +","+ response["reportDataColumns"][i]["colId"]);
- i++;
- }
+this.initCnt = 1;
+}
- let j=0;
- while(response["reportDataRows"][j])
- {
- let k=0;
- let obj = new Object();
- while(this.displayedColumnsArr[k])
- {
- if(response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]])
- {
- //console.log(response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]);
- obj[response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]["colId"]] = response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]["displayValue"];
- //this.displayedRowObj.push(response["reportDataRows"][j][this.displayedColumnsArr[k].split(",")[1]]);
- }
- k++;
- }
- this.displayedRowObj.push(obj);
- //console.log(response["reportDataRows"][j]);
- j++;
- }
+showError(Errresponse : any)
+{
+ this.errorMessage = Errresponse["errormessage"];
+ this.stackTrace = Errresponse["stacktrace"];
+ this.error = true;
+ this.showSpinner = false;
+}
- console.log(this.displayedColumnsArr);
- console.log(this.displayedRowObj);
+ postFetchingReportDataFn(response : any)
+ {
+
+ this.formFieldPresent = false;
+ this.responseFormFieldListLength = 0;
+
+ this.reportName = response["reportName"];
+
+ let i=0;
+ while(response["reportDataColumns"][i])
+ {
+ let columnTitle = response["reportDataColumns"][i]["columnTitle"];
+ let columnId = response["reportDataColumns"][i]["colId"];
+ this.displayedColumnsArr.push(columnTitle +","+ columnId);
+ i++;
+ }
- for(let l=0; l<this.displayedColumnsArr.length; l++)
+ let j=0;
+ while(response["reportDataRows"][j])
+ {
+ let k=0;
+ let obj = new Object();
+ let reportDataRows = response["reportDataRows"][j];
+ while(this.displayedColumnsArr[k])
+ {
+ let rowColumnId = this.displayedColumnsArr[k].split(",")[1];
+ if(reportDataRows[rowColumnId])
{
- this.displayedColumns.push(this.displayedColumnsArr[l].split(",")[1]);
+ obj[reportDataRows[rowColumnId]["colId"]] = reportDataRows[rowColumnId]["displayValue"];
}
+ k++;
+ }
+ this.displayedRowObj.push(obj);
+ j++;
+ }
+ for(let l=0; l<this.displayedColumnsArr.length; l++)
+ {
+ let columnArrId = this.displayedColumnsArr[l].split(",")[1];
+ this.displayedColumns.push(columnArrId);
+ }
+ this.showSpinner = false;
+
+ this.dataSource = new MatTableDataSource<PeriodicElement>(this.displayedRowObj);
+
+ this.dataSource.sort = this.sort;
+ this.dataSource.paginator = this.paginator;
+
+ this.table.dataSource = this.dataSource;
+
+ this.changeDetectorRefs.detectChanges();
+ }
+ linkToReport(reportID : string, queryParameters : string)
+ {
+ this._router.navigate(['v2/run', reportID, queryParameters]);
+ }
+
+
+ linkToFeedback(feedBackId : string, queryParameters : string)
+ {
+ this._router.navigate(['v2/feedback', feedBackId]);
+ }
+
+ linkToMail(mailId : string)
+ {
+ var email = "mailto:" + mailId;
+ window.location.href = email;
+ }
+
+
+ openOptions()
+ {
+ this.openOptionsFlag = !this.openOptionsFlag;
+ }
+
+ downloadReportExcel()
+ {
+ this._runService.downloadReportExcel(this.reportId1)
+ .subscribe((responseExcel) => {
- this.showSpinner = false;
-
- this.dataSource.data = this.displayedRowObj;
- this.dataSource.sort = this.sort;
- this.dataSource.paginator = this.paginator;
- this.table.dataSource = this.dataSource;
-
+ this.downLoadFile(responseExcel, "application/vnd.ms-excel")
});
}
- this.initCnt = 1;
- }
+ downLoadFile(data: any, type: string) {
+ let blob = new Blob([data], { type: type});
+ let url = window.URL.createObjectURL(blob);
+ let pwa = window.open(url);
+ if (!pwa || pwa.closed || typeof pwa.closed == 'undefined') {
+ alert( 'Please disable your Pop-up blocker and try again.');
+ }
+}
+
+applyFilter(filterValue: string) {
+ this.dataSource.filter = filterValue.trim().toLowerCase();
}
+
+
+}
+