46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { MatTableDataSource } from '@angular/material/table';
|
|
import { ServiceComm } from '../../services/service-comm.service';
|
|
import { StatsService } from '../../services/stats.service';
|
|
|
|
@Component({
|
|
selector: 'app-summary',
|
|
templateUrl: './summary.component.html',
|
|
styleUrls: ['./summary.component.css']
|
|
})
|
|
export class SummaryComponent implements OnInit {
|
|
public displayedColumns: Array<string> = ['label', 'nb'];
|
|
public dsNbJumpByDz;
|
|
public dsNbJumpByAircraft;
|
|
public dsNbJumpByGear;
|
|
public dsNbJumpByType;
|
|
public dsNbJumpByYear;
|
|
|
|
constructor(
|
|
private serviceApi: StatsService,
|
|
private serviceComm: ServiceComm
|
|
) { }
|
|
|
|
ngOnInit() {
|
|
this.serviceComm.UpdatedComponentTitle('Summary');
|
|
|
|
const statsResult = this.serviceApi.getStatsOfJumps();
|
|
|
|
statsResult.statsByDz.subscribe(data => {
|
|
this.dsNbJumpByDz = new MatTableDataSource(data);
|
|
});
|
|
statsResult.statsByAircraft.subscribe(data => {
|
|
this.dsNbJumpByAircraft = new MatTableDataSource(data);
|
|
});
|
|
statsResult.statsByGear.subscribe(data => {
|
|
this.dsNbJumpByGear = new MatTableDataSource(data);
|
|
});
|
|
statsResult.statsByJumpType.subscribe(data => {
|
|
this.dsNbJumpByType = new MatTableDataSource(data);
|
|
});
|
|
statsResult.statsByYear.subscribe(data => {
|
|
this.dsNbJumpByYear = new MatTableDataSource(data);
|
|
});
|
|
}
|
|
}
|