summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.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-list.component.ts')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.ts378
1 files changed, 168 insertions, 210 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.ts
index 2cf95427..1c2d443e 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.ts
@@ -8,231 +8,189 @@ import { Router } from '@angular/router';
import { environment } from '../../../../environments/environment';
import { ReportListService } from './report-list.service';
-@Component({
- selector: 'app-all-reports',
- templateUrl: './report-list.component.html',
- styleUrls: ['./report-list.component.css']
-})
+@Component( {
+ selector: 'app-all-reports',
+ templateUrl: './report-list.component.html',
+ styleUrls: ['./report-list.component.css']
+} )
export class ReportListComponent implements AfterViewInit, OnInit {
- @ViewChild(MatPaginator, {static: false} as any) paginator: MatPaginator;
- @ViewChild(MatSort, {static: false} as any) sort: MatSort;
- @ViewChild(MatTable, {static: false} as any) table: MatTable<AllReportsItem>;
-
- @Input("reportId") reportId1 : string;
-
-
- dataSource: AllReportsDataSource;
- dataSource1 : any;
- finalGETObj : {};
- finalGETObjRowsArr : [][];
- rowArr : {}[];
- reportIdArr : string[];
- toggle : boolean;
- intermediateDisplayedColumns : string[];
- displayedColumns : string[];
- finalRowArr : AllReportsItem[];
- rowObj : any;
- reportId : string;
- toggle1 : boolean;
- showSpinner : boolean;
- showDialog : boolean;
- closable : boolean;
- delete : boolean;
- newReportId : string;
- constructor(private _http : HttpClient, private _router : Router, private _reportListService : ReportListService){
-
- this.showDialog = false;
- this.closable = false;
- this.delete = false;
-
- this.initializeReportList();
-
-
- }
-
-
- initializeReportList()
- {
+ @ViewChild( MatPaginator, { static: false } as any ) paginator: MatPaginator;
+ @ViewChild( MatSort, { static: false } as any ) sort: MatSort;
+ @ViewChild( MatTable, { static: false } as any ) table: MatTable<AllReportsItem>;
+ @Input( "reportId" ) reportId1: string;
+ dataSource: AllReportsDataSource;
+ dataSource1: any;
+ finalGETObj: {};
+ finalGETObjRowsArr: [][];
+ rowArr: {}[];
+ reportIdArr: string[];
+ toggle: boolean;
+ intermediateDisplayedColumns: string[];
+ displayedColumns = ["rep_id", "rep_name", "descr", "owner", "create_date", "copy", "edit", "delete", "schedule", "run"];
+ finalRowArr: AllReportsItem[];
+ rowObj: any;
+ reportId: string;
+ toggle1: boolean;
+ showSpinner: boolean;
+ showDialog: boolean;
+ closable: boolean;
+ delete: boolean;
+ newReportId: string;
+ constructor( private _http: HttpClient, private _router: Router, private _reportListService: ReportListService ) {
+ this.showDialog = false;
+ this.closable = false;
+ this.delete = false;
+ this.initializeReportList();
+ }
- this.showSpinner = true;
- this.dataSource = new AllReportsDataSource();
- this.dataSource1 = new MatTableDataSource();
- this.intermediateDisplayedColumns = new Array();
-
-
- this.finalGETObj = new Object();
-
- this.finalGETObj = new Object();
- this.finalGETObjRowsArr = new Array();
- this.rowArr = new Array();
- this.reportIdArr = new Array();
- this.toggle = false;
- this.toggle1 = false;
-
- this.finalRowArr = new Array();
-
-
- this._http.get(environment.baseUrl + "raptor.htm?action=report.search.execute&r_page=0")
- .subscribe((responseObj) => {
- this.finalGETObj = responseObj;
- this.finalGETObjRowsArr = this.finalGETObj["rows"];
-
- let j=0;
- while(this.finalGETObj["columns"][0][j])
- {
- if(this.finalGETObj["columns"][0][j]["columnId"] !== "no")
- {
- this.intermediateDisplayedColumns.push(this.finalGETObj["columns"][0][j]["columnId"]);
- }
- j++;
- }
-
- this.displayedColumns = this.intermediateDisplayedColumns;
-
- let i=0;
-
- while(this.finalGETObjRowsArr[0][i])
- {
- this.rowArr = this.finalGETObjRowsArr[0][i];
- this.rowObj = new Object();
- let j=0;
- while(this.rowArr[j])
- {
-
-
- if(this.rowArr[j]["columnId"] === "rep_id")
- {
- this.rowObj["rep_id"] = this.rowArr[j]["searchresultField"]["displayValue"];
- this.reportIdArr.push(this.rowArr[j]["searchresultField"]["displayValue"]);
- }
-
- if(this.rowArr[j]["columnId"] === "rep_name")
- {
- this.rowObj["rep_name"] = this.rowArr[j]["searchresultField"]["displayValue"];
- }
-
- if(this.rowArr[j]["columnId"] === "descr")
- {
- this.rowObj["descr"] = this.rowArr[j]["searchresultField"]["displayValue"];
- }
-
- if(this.rowArr[j]["columnId"] === "owner")
- {
- this.rowObj["owner"] = this.rowArr[j]["searchresultField"]["displayValue"];
- }
-
- if(this.rowArr[j]["columnId"] === "create_date")
- {
- this.rowObj["create_date"] = this.rowArr[j]["searchresultField"]["displayValue"];
- }
-
- if(this.rowArr[j]["columnId"] === "copy")
- {
- this.rowObj["copy"] = this.rowArr[j]["searchresultField"]["displayValue"]; }
-
- if(this.rowArr[j]["columnId"] === "edit")
- {
- this.rowObj["edit"] = this.rowArr[j]["searchresultField"]["displayValue"];
- }
-
- if(this.rowArr[j]["columnId"] === "delete")
- {
- this.rowObj["delete"] = this.rowArr[j]["searchresultField"]["displayValue"];
- }
-
- if(this.rowArr[j]["columnId"] === "schedule")
- {
- this.rowObj["schedule"] = this.rowArr[j]["searchresultField"]["displayValue"];
- }
-
- if(this.rowArr[j]["columnId"] === "run")
- {
- this.rowObj["run"] = this.rowArr[j]["searchresultField"]["displayValue"];
- }
-
-
- j++;
- }
- this.finalRowArr.push(this.rowObj);
- i++;
- }
-
- this.showSpinner = false;
-
- if(!this.showSpinner)
- {
-
-
- this.dataSource.data = this.finalRowArr;
- this.dataSource1 = new MatTableDataSource(this.finalRowArr);
- this.dataSource1.sort = this.sort;
- this.dataSource1.paginator = this.paginator;
- this.table.dataSource = this.dataSource;
- }
- });
- }
-
- ngOnInit() {
- this.toggle = false;
- }
-
- ngAfterViewInit() {
- this.dataSource.sort = this.sort;
- this.dataSource.paginator = this.paginator;
- this.table.dataSource = this.dataSource;
- }
+ initializeReportList() {
+ this.showSpinner = true;
+ this.dataSource = new AllReportsDataSource();
+ this.dataSource1 = new MatTableDataSource();
+ this.intermediateDisplayedColumns = new Array();
+ this.finalGETObj = new Object();
+ this.finalGETObj = new Object();
+ this.finalGETObjRowsArr = new Array();
+ this.rowArr = new Array();
+ this.reportIdArr = new Array();
+ this.toggle = false;
+ this.toggle1 = false;
+ this.finalRowArr = new Array();
+ this._reportListService.getAllReports()
+ .subscribe(( responseObj ) => {
+ this.finalGETObj = responseObj;
+ this.finalGETObjRowsArr = this.finalGETObj["rows"];
+ let j = 0;
+ while ( this.finalGETObj["columns"][0][j] ) {
+ if ( this.finalGETObj["columns"][0][j]["columnId"] !== "no" ) {
+ this.intermediateDisplayedColumns.push( this.finalGETObj["columns"][0][j]["columnId"] );
+ }
+ j++;
+ }
+ this.displayedColumns = this.intermediateDisplayedColumns;
+ let i = 0;
+ while ( this.finalGETObjRowsArr[0][i] ) {
+ this.rowArr = this.finalGETObjRowsArr[0][i];
+ this.rowObj = new Object();
+ let j = 0;
+ while ( this.rowArr[j] ) {
+ if ( this.rowArr[j]["columnId"] === "rep_id" ) {
+ this.rowObj["rep_id"] = this.rowArr[j]["searchresultField"]["displayValue"];
+ this.reportIdArr.push( this.rowArr[j]["searchresultField"]["displayValue"] );
+ }
+
+ if ( this.rowArr[j]["columnId"] === "rep_name" ) {
+ this.rowObj["rep_name"] = this.rowArr[j]["searchresultField"]["displayValue"];
+ }
+
+ if ( this.rowArr[j]["columnId"] === "descr" ) {
+ this.rowObj["descr"] = this.rowArr[j]["searchresultField"]["displayValue"];
+ }
+
+ if ( this.rowArr[j]["columnId"] === "owner" ) {
+ this.rowObj["owner"] = this.rowArr[j]["searchresultField"]["displayValue"];
+ }
+
+ if ( this.rowArr[j]["columnId"] === "create_date" ) {
+ this.rowObj["create_date"] = this.rowArr[j]["searchresultField"]["displayValue"];
+ }
+
+ if ( this.rowArr[j]["columnId"] === "copy" ) {
+ this.rowObj["copy"] = this.rowArr[j]["searchresultField"]["displayValue"];
+ }
+
+ if ( this.rowArr[j]["columnId"] === "edit" ) {
+ this.rowObj["edit"] = this.rowArr[j]["searchresultField"]["displayValue"];
+ this.rowObj["canEdit"] = this.rowArr[j]["searchresultField"]["authorized"];
+ }
+
+ if ( this.rowArr[j]["columnId"] === "delete" ) {
+ this.rowObj["delete"] = this.rowArr[j]["searchresultField"]["displayValue"];
+ this.rowObj["canDelete"] = this.rowArr[j]["searchresultField"]["authorized"];
+ }
+
+ if ( this.rowArr[j]["columnId"] === "schedule" ) {
+ this.rowObj["schedule"] = this.rowArr[j]["searchresultField"]["displayValue"];
+ }
+
+ if ( this.rowArr[j]["columnId"] === "run" ) {
+ this.rowObj["run"] = this.rowArr[j]["searchresultField"]["displayValue"];
+ }
+ j++;
+ }
+ this.finalRowArr.push( this.rowObj );
+ i++;
+ }
+ this.showSpinner = false;
+ if ( !this.showSpinner ) {
+ this.dataSource.data = this.finalRowArr;
+ this.dataSource1 = new MatTableDataSource( this.finalRowArr );
+ this.dataSource1.sort = this.sort;
+ this.dataSource1.paginator = this.paginator;
+ this.table.dataSource = this.dataSource;
+ }
+ } );
+ }
- displayReport(reportId : string)
- {
- this.reportId = reportId;
+ ngOnInit() {
+ sessionStorage.clear();
+ const myItem = localStorage.getItem('id');
+ localStorage.clear();
+ localStorage.setItem('id', myItem);
+ this.toggle = false;
+ }
- this._router.navigate(["v2/reports", "Edit",reportId]);
+ ngAfterViewInit() {
+ this.dataSource.sort = this.sort;
+ this.dataSource.paginator = this.paginator;
+ this.table.dataSource = this.dataSource;
+ }
-
-
- }
+ displayReport( reportId: string ) {
+ this.reportId = reportId;
+ this._router.navigate( ["v2/reports", "Edit", reportId] );
+ }
- runReport(reportId : string)
- {
- this.reportId = reportId;
+ runReport( reportId: string ) {
+ this.reportId = reportId;
+ this._router.navigate( ['v2/run', reportId] );
+ }
- this._router.navigate(['v2/run', reportId]);
+ applyFilter( filterValue: string ) {
+ this.dataSource1.filter = filterValue.trim().toLowerCase();
+ }
- }
- applyFilter(filterValue: string) {
- this.dataSource1.filter = filterValue.trim().toLowerCase();
- }
+ confirmDelete( reportId: string ) {
+ this.showDialog = true;
+ this.closable = true;
+ this.newReportId = reportId;
+ }
- confirmDelete(reportId : string)
- {
- this.showDialog = true;
- this.closable = true;
+ deleteReport() {
+ this._reportListService.deleteReport( this.newReportId )
+ .subscribe(( responseDelete ) => {
+ this.initializeReportList();
+ this.showDialog = !this.showDialog;
+ this.closable = false;
- this.newReportId = reportId;
- }
+ } );
+ }
+ close() {
+ this.showDialog = !this.showDialog;
+ this.closable = false;
+ }
+
+ openReportSchedule( reportId: string ) {
+ this._router.navigate( ['v2/schedule_report', reportId] );
+ }
- deleteReport()
+ copydisplayReport(reportId : string)
{
- this._reportListService.deleteReport(this.newReportId)
- .subscribe((responseDelete) => {
- this.initializeReportList();
- this.showDialog = !this.showDialog;
- this.closable = false;
-
- });
+ this.reportId = reportId;
+ this._router.navigate(["v2/reports", "Copy",reportId]);
}
- close() {
- this.showDialog = !this.showDialog;
- this.closable = false;
- }
-
-
- openReportSchedule(reportId:string){
- this._router.navigate(['v2/schedule_report', reportId]);
- }
-
}