Message in run report when It is being exported to S3 (#1788)

Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
José Alberto Hernández
2023-07-19 08:58:08 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent 2aef60ce93
commit dd4b37c060
5 changed files with 132 additions and 87 deletions
@@ -1,32 +1,53 @@
<div *ngIf = "!hideOutput">
<div class="container">
<div class="m-b-10" *ngIf = "dataObject.report.type === 'Table'" fxLayoutAlign="end">
<button mat-raised-button color="primary" (click)="downloadCSV()" [disabled]="notExistsReportData">
Export CSV
</button>
</div>
<div *ngIf="!hideOutput && !toBeExportedToRepo">
<div class="table-output" [hidden]="notExistsReportData">
<table mat-table [dataSource]="dataSource">
<div *ngFor= "let column of displayedColumns index as i">
<ng-container [matColumnDef]="column">
<th mat-header-cell *matHeaderCellDef>{{column}}</th>
<td mat-cell *matCellDef="let param" >
<span *ngIf="isDecimal(i)">{{toDecimal(param.row[i])}}</span>
<span *ngIf="!isDecimal(i)">{{param.row[i]}}</span>
</td>
</ng-container>
<div class="m-b-10" *ngIf="dataObject.report.type === 'Table'" fxLayoutAlign="end">
<button mat-raised-button color="primary" (click)="downloadCSV()" [disabled]="notExistsReportData"
matToolTip="Export the data to CSV file">
Export CSV
</button>
</div>
<div class="table-output" [hidden]="notExistsReportData">
<table mat-table [dataSource]="dataSource">
<div *ngFor="let column of displayedColumns index as i">
<ng-container [matColumnDef]="column">
<th mat-header-cell *matHeaderCellDef>{{column}}</th>
<td mat-cell *matCellDef="let param">
<span *ngIf="isDecimal(i)">{{toDecimal(param.row[i])}}</span>
<span *ngIf="!isDecimal(i)">{{param.row[i]}}</span>
</td>
</ng-container>
</div>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row"></tr>
</table>
<mat-paginator [pageSizeOptions]="[100, 200, 300]" showFirstLastButtons></mat-paginator>
</div>
<div class="alert" [hidden]="!notExistsReportData">
<div class="message">
<i class="fa fa-exclamation-circle alert-check"></i>
No report data was generated
</div>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row" ></tr>
</table>
<mat-paginator [pageSizeOptions]="[100, 200, 300]" showFirstLastButtons></mat-paginator>
</div>
<div class="alert" [hidden]="!notExistsReportData">
<div class="message">
<i class="fa fa-exclamation-circle alert-check"></i>
No report data was generated
</div>
</div>
<div class="alert" *ngIf="!hideOutput && toBeExportedToRepo">
<div class="message">
<i class="fa fa-exclamation-circle alert-check"></i>
The report request has been sent and the report will be exported to file repository
</div>
</div>
<div class="table-output" *ngIf="hideOutput">
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
</div>
<div class="back-button" *ngIf="!hideOutput">
<button type="button" color="primary" mat-raised-button [routerLink]="['../..']">
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>Back</button>
</div>
</div>
@@ -11,3 +11,10 @@
margin-left: 5px;
margin-right: 5px;
}
.back-button {
text-align: center;
margin-top: 25px;
max-height: 2%;
margin-bottom: 2%;
}
@@ -31,6 +31,7 @@ export class TableAndSmsComponent implements OnChanges {
/** Data to be converted into CSV file */
csvData: any;
notExistsReportData = false;
toBeExportedToRepo = false;
/** Paginator for run-report table. */
@ViewChild(MatPaginator) paginator: MatPaginator;
@@ -53,15 +54,19 @@ export class TableAndSmsComponent implements OnChanges {
}
getRunReportData() {
const exportS3 = this.dataObject.formData.exportS3;
this.reportsService.getRunReportData(this.dataObject.report.name, this.dataObject.formData)
.subscribe( (res: any) => {
this.csvData = res.data;
this.notExistsReportData = (res.data.length === 0);
this.setOutputTable(res.data);
res.columnHeaders.forEach((header: any) => {
this.columnTypes.push(header.columnDisplayType);
this.displayedColumns.push(header.columnName);
});
this.toBeExportedToRepo = exportS3;
if (!this.toBeExportedToRepo) {
this.csvData = res.data;
this.notExistsReportData = (res.data.length === 0);
this.setOutputTable(res.data);
res.columnHeaders.forEach((header: any) => {
this.columnTypes.push(header.columnDisplayType);
this.displayedColumns.push(header.columnName);
});
}
this.hideOutput = false;
});
}