Ajout d'un loading sur la page Summary

This commit is contained in:
Sébastien André
2020-02-14 10:20:48 +01:00
parent d77067b57e
commit a1adc417bb
4 changed files with 110 additions and 92 deletions

View File

@@ -10,5 +10,6 @@
<WebStackScaffolding_LayoutPageFile /> <WebStackScaffolding_LayoutPageFile />
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected> <WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
<NameOfLastUsedPublishProfile>skydiveLogsApi - Web Deploy</NameOfLastUsedPublishProfile> <NameOfLastUsedPublishProfile>skydiveLogsApi - Web Deploy</NameOfLastUsedPublishProfile>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@@ -46,7 +46,7 @@ export class NewJumpComponent implements OnInit {
) { } ) { }
ngOnInit() { ngOnInit() {
this.serviceComm.UpdatedComponentTitle("Add a new jump"); this.serviceComm.UpdatedComponentTitle('Add a new jump');
this.endDate = new Date(); this.endDate = new Date();
this.beginDate = this.dateService.AddDays(new Date(), -1); this.beginDate = this.dateService.AddDays(new Date(), -1);
@@ -136,6 +136,6 @@ export class NewJumpComponent implements OnInit {
} }
public allDatasLoaded(): boolean { public allDatasLoaded(): boolean {
return this.countDatasLoaded == 4; return this.countDatasLoaded === 4;
} }
} }

View File

@@ -1,3 +1,4 @@
<div *ngIf="allDatasLoaded() else loading">
<div> <div>
<label>Total jumps</label> <label>Total jumps</label>
Total Total Total Total
@@ -89,3 +90,8 @@
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table> </table>
</div> </div>
</div>
<ng-template #loading>
<mat-progress-spinner [mode]="'indeterminate'"></mat-progress-spinner>
</ng-template>

View File

@@ -15,6 +15,7 @@ export class SummaryComponent implements OnInit {
public dsNbJumpByGear; public dsNbJumpByGear;
public dsNbJumpByType; public dsNbJumpByType;
public dsNbJumpByYear; public dsNbJumpByYear;
private countDatasLoaded: number;
constructor( constructor(
private serviceApi: StatsService, private serviceApi: StatsService,
@@ -22,24 +23,34 @@ export class SummaryComponent implements OnInit {
) { } ) { }
ngOnInit() { ngOnInit() {
this.countDatasLoaded = 0;
this.serviceComm.UpdatedComponentTitle('Summary'); this.serviceComm.UpdatedComponentTitle('Summary');
const statsResult = this.serviceApi.getStatsOfJumps(); const statsResult = this.serviceApi.getStatsOfJumps();
statsResult.statsByDz.subscribe(data => { statsResult.statsByDz.subscribe(data => {
this.dsNbJumpByDz = new MatTableDataSource(data); this.dsNbJumpByDz = new MatTableDataSource(data);
this.countDatasLoaded++;
}); });
statsResult.statsByAircraft.subscribe(data => { statsResult.statsByAircraft.subscribe(data => {
this.dsNbJumpByAircraft = new MatTableDataSource(data); this.dsNbJumpByAircraft = new MatTableDataSource(data);
this.countDatasLoaded++;
}); });
statsResult.statsByGear.subscribe(data => { statsResult.statsByGear.subscribe(data => {
this.dsNbJumpByGear = new MatTableDataSource(data); this.dsNbJumpByGear = new MatTableDataSource(data);
this.countDatasLoaded++;
}); });
statsResult.statsByJumpType.subscribe(data => { statsResult.statsByJumpType.subscribe(data => {
this.dsNbJumpByType = new MatTableDataSource(data); this.dsNbJumpByType = new MatTableDataSource(data);
this.countDatasLoaded++;
}); });
statsResult.statsByYear.subscribe(data => { statsResult.statsByYear.subscribe(data => {
this.dsNbJumpByYear = new MatTableDataSource(data); this.dsNbJumpByYear = new MatTableDataSource(data);
this.countDatasLoaded++;
}); });
} }
public allDatasLoaded(): boolean {
return this.countDatasLoaded === 5;
}
} }