Ajout d'un système de cache des
requêtes HTTP
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ServiceComm } from '../services/serviceComm';
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { ServiceComm } from "../services/service-comm.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.css']
|
||||
selector: "app-root",
|
||||
templateUrl: "./app.component.html",
|
||||
styleUrls: ["./app.component.css"]
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
title = 'app';
|
||||
title = "app";
|
||||
showMenu = false;
|
||||
|
||||
constructor(private serviceComm: ServiceComm) {
|
||||
}
|
||||
constructor(private serviceComm: ServiceComm) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.componentTitle.subscribe(title => this.title = title);
|
||||
this.serviceComm.componentTitle.subscribe(title => (this.title = title));
|
||||
}
|
||||
|
||||
toggleMenu() {
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { BrowserModule } from "@angular/platform-browser";
|
||||
import { NgModule } from "@angular/core";
|
||||
import { RouterModule, Routes } from "@angular/router";
|
||||
import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http";
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { AppComponent } from "./app.component";
|
||||
|
||||
import { SummaryComponent } from './summary/summary.component';
|
||||
import { ListOfJumpsComponent } from './list-of-jumps/list-of-jumps.component';
|
||||
import { ListOfDzsComponent } from './list-of-dzs/list-of-dzs.component';
|
||||
import { NewJumpComponent } from './new-jump/new-jump.component';
|
||||
import { ListOfAircraftsComponent } from './list-of-aircrafts/list-of-aircrafts.component';
|
||||
import { ListOfJumpTypesComponent } from './list-of-jump-types/list-of-jump-types.component';
|
||||
import { SummaryComponent } from "./summary/summary.component";
|
||||
import { ListOfJumpsComponent } from "./list-of-jumps/list-of-jumps.component";
|
||||
import { ListOfDzsComponent } from "./list-of-dzs/list-of-dzs.component";
|
||||
import { NewJumpComponent } from "./new-jump/new-jump.component";
|
||||
import { ListOfAircraftsComponent } from "./list-of-aircrafts/list-of-aircrafts.component";
|
||||
import { ListOfJumpTypesComponent } from "./list-of-jump-types/list-of-jump-types.component";
|
||||
|
||||
import { DateService } from '../services/dateService';
|
||||
import { ServiceApiGet } from '../services/serviceApiGet';
|
||||
import { ServiceApiPost } from '../services/serviceApiPost';
|
||||
import { ServiceComm } from '../services/serviceComm';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { DateService } from "../services/date.service";
|
||||
import { ServiceApiGet } from "../services/service-api-get.service";
|
||||
import { ServiceApiPost } from "../services/service-api-post.service";
|
||||
import { ServiceComm } from "../services/service-comm.service";
|
||||
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
|
||||
import { FormsModule } from "@angular/forms";
|
||||
import {
|
||||
MatPaginatorModule,
|
||||
MatTableModule,
|
||||
@@ -30,20 +30,19 @@ import {
|
||||
MatInputModule,
|
||||
MatButtonModule,
|
||||
MatIconModule
|
||||
} from '@angular/material';
|
||||
|
||||
|
||||
} from "@angular/material";
|
||||
import { RequestCache } from "../services/request-cache.service";
|
||||
import { CachingInterceptor } from "../services/caching-interceptor.service";
|
||||
|
||||
const appRoutes: Routes = [
|
||||
{ path: 'summary', component: SummaryComponent },
|
||||
{ path: 'jumpsList', component: ListOfJumpsComponent },
|
||||
{ path: 'dz', component: ListOfDzsComponent },
|
||||
{ path: 'newjump', component: NewJumpComponent },
|
||||
{ path: 'aircraftList', component: ListOfAircraftsComponent },
|
||||
{ path: 'jumpTypeList', component: ListOfJumpTypesComponent }
|
||||
{ path: "summary", component: SummaryComponent },
|
||||
{ path: "jumpsList", component: ListOfJumpsComponent },
|
||||
{ path: "dz", component: ListOfDzsComponent },
|
||||
{ path: "newjump", component: NewJumpComponent },
|
||||
{ path: "aircraftList", component: ListOfAircraftsComponent },
|
||||
{ path: "jumpTypeList", component: ListOfJumpTypesComponent }
|
||||
];
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
@@ -75,7 +74,14 @@ const appRoutes: Routes = [
|
||||
MatIconModule
|
||||
],
|
||||
exports: [HttpClientModule],
|
||||
providers: [ServiceApiPost, ServiceApiGet, ServiceComm, DateService],
|
||||
providers: [
|
||||
ServiceApiPost,
|
||||
ServiceApiGet,
|
||||
ServiceComm,
|
||||
DateService,
|
||||
RequestCache,
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: CachingInterceptor, multi: true }
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
export class AppModule {}
|
||||
|
||||
@@ -1,34 +1,35 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
import { MatPaginator } from "@angular/material/paginator";
|
||||
import { MatTableDataSource } from "@angular/material/table";
|
||||
|
||||
import { AircraftResp } from '../../models/aircraft';
|
||||
import { ServiceApiGet } from '../../services/serviceApiGet';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { AircraftResp } from "../../models/aircraft";
|
||||
import { ServiceApiGet } from "../../services/service-api-get.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-aircrafts',
|
||||
templateUrl: './list-of-aircrafts.component.html',
|
||||
styleUrls: ['./list-of-aircrafts.component.css']
|
||||
selector: "app-list-of-aircrafts",
|
||||
templateUrl: "./list-of-aircrafts.component.html",
|
||||
styleUrls: ["./list-of-aircrafts.component.css"]
|
||||
})
|
||||
export class ListOfAircraftsComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = ['id', 'name'];
|
||||
public displayedColumns: Array<string> = ["id", "name"];
|
||||
public dataSourceTable;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
|
||||
constructor(private serviceApi: ServiceApiGet, private serviceComm: ServiceComm) {
|
||||
}
|
||||
constructor(
|
||||
private serviceApi: ServiceApiGet,
|
||||
private serviceComm: ServiceComm
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('List of aircrafts');
|
||||
this.serviceComm.updatedComponentTitle("List of aircrafts");
|
||||
this.getListOfAircrafts();
|
||||
}
|
||||
|
||||
getListOfAircrafts() {
|
||||
this.serviceApi.getListOfAircrafts()
|
||||
.subscribe(data => {
|
||||
this.dataSourceTable = new MatTableDataSource<AircraftResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
});
|
||||
this.serviceApi.getListOfAircrafts().subscribe(data => {
|
||||
this.dataSourceTable = new MatTableDataSource<AircraftResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,43 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
import { MatPaginator } from "@angular/material/paginator";
|
||||
import { MatTableDataSource } from "@angular/material/table";
|
||||
|
||||
import { DropZoneResp } from '../../models/dropzone';
|
||||
import { ServiceApiGet } from '../../services/serviceApiGet';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { DropZoneResp } from "../../models/dropzone";
|
||||
import { ServiceApiGet } from "../../services/service-api-get.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-dzs',
|
||||
templateUrl: './list-of-dzs.component.html',
|
||||
styleUrls: ['./list-of-dzs.component.css']
|
||||
selector: "app-list-of-dzs",
|
||||
templateUrl: "./list-of-dzs.component.html",
|
||||
styleUrls: ["./list-of-dzs.component.css"]
|
||||
})
|
||||
|
||||
|
||||
export class ListOfDzsComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = ['id', 'name', 'latitude', 'longitude', 'address', 'email', 'type'];
|
||||
public displayedColumns: Array<string> = [
|
||||
"id",
|
||||
"name",
|
||||
"latitude",
|
||||
"longitude",
|
||||
"address",
|
||||
"email",
|
||||
"type"
|
||||
];
|
||||
public dataSourceTable;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
|
||||
constructor(private serviceApi: ServiceApiGet,
|
||||
private serviceComm: ServiceComm) {
|
||||
}
|
||||
constructor(
|
||||
private serviceApi: ServiceApiGet,
|
||||
private serviceComm: ServiceComm
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('List of DZs');
|
||||
this.serviceComm.updatedComponentTitle("List of DZs");
|
||||
this.getListOfDropZones();
|
||||
}
|
||||
|
||||
getListOfDropZones() {
|
||||
this.serviceApi.getListOfDropZones()
|
||||
.subscribe(data => {
|
||||
this.dataSourceTable = new MatTableDataSource<DropZoneResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
});
|
||||
this.serviceApi.getListOfDropZones().subscribe(data => {
|
||||
this.dataSourceTable = new MatTableDataSource<DropZoneResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,35 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
import { MatPaginator } from "@angular/material/paginator";
|
||||
import { MatTableDataSource } from "@angular/material/table";
|
||||
|
||||
import { JumpTypeResp } from '../../models/jumpType';
|
||||
import { ServiceApiGet } from '../../services/serviceApiGet';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { JumpTypeResp } from "../../models/jumpType";
|
||||
import { ServiceApiGet } from "../../services/service-api-get.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-jump-types',
|
||||
templateUrl: './list-of-jump-types.component.html',
|
||||
styleUrls: ['./list-of-jump-types.component.css']
|
||||
selector: "app-list-of-jump-types",
|
||||
templateUrl: "./list-of-jump-types.component.html",
|
||||
styleUrls: ["./list-of-jump-types.component.css"]
|
||||
})
|
||||
export class ListOfJumpTypesComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = ['id', 'name'];
|
||||
public displayedColumns: Array<string> = ["id", "name"];
|
||||
public dataSourceTable;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
|
||||
constructor(private serviceApi: ServiceApiGet, private serviceComm: ServiceComm) {
|
||||
}
|
||||
constructor(
|
||||
private serviceApi: ServiceApiGet,
|
||||
private serviceComm: ServiceComm
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('List of jump types');
|
||||
this.serviceComm.updatedComponentTitle("List of jump types");
|
||||
this.getListOfJumpTypes();
|
||||
}
|
||||
|
||||
getListOfJumpTypes() {
|
||||
this.serviceApi.getListOfJumpTypes()
|
||||
.subscribe(data => {
|
||||
this.dataSourceTable = new MatTableDataSource<JumpTypeResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
});
|
||||
this.serviceApi.getListOfJumpTypes().subscribe(data => {
|
||||
this.dataSourceTable = new MatTableDataSource<JumpTypeResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,36 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { JumpResp } from '../../models/jump';
|
||||
import { ServiceApiGet } from '../../services/serviceApiGet';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
import { MatPaginator } from "@angular/material/paginator";
|
||||
import { MatTableDataSource } from "@angular/material/table";
|
||||
|
||||
import { Observable } from "rxjs";
|
||||
import { JumpResp } from "../../models/jump";
|
||||
import { ServiceApiGet } from "../../services/service-api-get.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-jumps',
|
||||
templateUrl: './list-of-jumps.component.html',
|
||||
styleUrls: ['./list-of-jumps.component.css']
|
||||
selector: "app-list-of-jumps",
|
||||
templateUrl: "./list-of-jumps.component.html",
|
||||
styleUrls: ["./list-of-jumps.component.css"]
|
||||
})
|
||||
export class ListOfJumpsComponent implements OnInit {
|
||||
public listOfJumps: Observable<Array<JumpResp>>;
|
||||
public displayedColumns: Array<string> = ['id', 'jumpDate', 'jumpTypeId', 'aircraftId', 'dropZoneId',];
|
||||
public displayedColumns: Array<string> = [
|
||||
"id",
|
||||
"jumpDate",
|
||||
"jumpTypeId",
|
||||
"aircraftId",
|
||||
"dropZoneId"
|
||||
];
|
||||
public dataSourceTable;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
|
||||
constructor(private serviceApi: ServiceApiGet, private serviceComm: ServiceComm) {
|
||||
}
|
||||
constructor(
|
||||
private serviceApi: ServiceApiGet,
|
||||
private serviceComm: ServiceComm
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('List of jumps');
|
||||
this.serviceComm.updatedComponentTitle("List of jumps");
|
||||
this.getListOfJumps();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { ServiceApiGet } from '../../services/serviceApiGet';
|
||||
import { ServiceApiPost } from '../../services/serviceApiPost';
|
||||
import { JumpTypeResp } from '../../models/jumpType';
|
||||
import { AircraftResp } from '../../models/aircraft';
|
||||
import { DropZoneResp } from '../../models/dropzone';
|
||||
import { DateService } from '../../services/dateService';
|
||||
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
import { ServiceApiGet } from "../../services/service-api-get.service";
|
||||
import { ServiceApiPost } from "../../services/service-api-post.service";
|
||||
import { JumpTypeResp } from "../../models/jumpType";
|
||||
import { AircraftResp } from "../../models/aircraft";
|
||||
import { DropZoneResp } from "../../models/dropzone";
|
||||
import { DateService } from "../../services/date.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-jump',
|
||||
templateUrl: './new-jump.component.html',
|
||||
styleUrls: ['./new-jump.component.css']
|
||||
selector: "app-new-jump",
|
||||
templateUrl: "./new-jump.component.html",
|
||||
styleUrls: ["./new-jump.component.css"]
|
||||
})
|
||||
export class NewJumpComponent implements OnInit {
|
||||
beginDate: Date;
|
||||
@@ -28,14 +27,15 @@ export class NewJumpComponent implements OnInit {
|
||||
listOfAircraft: Array<AircraftResp>;
|
||||
listOfDropZone: Array<DropZoneResp>;
|
||||
|
||||
constructor(private serviceComm: ServiceComm,
|
||||
constructor(
|
||||
private serviceComm: ServiceComm,
|
||||
private serviceApiGet: ServiceApiGet,
|
||||
private serviceApiPost: ServiceApiPost,
|
||||
private dateService: DateService) {
|
||||
}
|
||||
private dateService: DateService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('Add a new jump');
|
||||
this.serviceComm.updatedComponentTitle("Add a new jump");
|
||||
|
||||
this.endDate = new Date();
|
||||
|
||||
@@ -64,26 +64,23 @@ export class NewJumpComponent implements OnInit {
|
||||
}
|
||||
|
||||
private getListOfJumpTypes() {
|
||||
this.serviceApiGet.getListOfJumpTypes()
|
||||
.subscribe(data => {
|
||||
this.listOfJumpType = data;
|
||||
this.getListOfAircrafts();
|
||||
this.getListOfDropZones();
|
||||
});
|
||||
this.serviceApiGet.getListOfJumpTypes().subscribe(data => {
|
||||
this.listOfJumpType = data;
|
||||
this.getListOfAircrafts();
|
||||
this.getListOfDropZones();
|
||||
});
|
||||
}
|
||||
|
||||
private getListOfAircrafts() {
|
||||
this.serviceApiGet.getListOfAircrafts()
|
||||
.subscribe(data => {
|
||||
this.listOfAircraft = data;
|
||||
});
|
||||
this.serviceApiGet.getListOfAircrafts().subscribe(data => {
|
||||
this.listOfAircraft = data;
|
||||
});
|
||||
}
|
||||
|
||||
private getListOfDropZones() {
|
||||
this.serviceApiGet.getListOfDropZones()
|
||||
.subscribe(data => {
|
||||
this.listOfDropZone = data;
|
||||
});
|
||||
this.serviceApiGet.getListOfDropZones().subscribe(data => {
|
||||
this.listOfDropZone = data;
|
||||
});
|
||||
}
|
||||
|
||||
// private getListOfGears() {
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
import { ServiceApiGet } from '../../services/serviceApiGet';
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
import { ServiceApiGet } from "../../services/service-api-get.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-summary',
|
||||
templateUrl: './summary.component.html',
|
||||
styleUrls: ['./summary.component.css']
|
||||
selector: "app-summary",
|
||||
templateUrl: "./summary.component.html",
|
||||
styleUrls: ["./summary.component.css"]
|
||||
})
|
||||
export class SummaryComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = ['label', 'nb'];
|
||||
public displayedColumns: Array<string> = ["label", "nb"];
|
||||
public dsNbJumpByDz;
|
||||
public dsNbJumpByAircraft;
|
||||
public dsNbJumpByRig;
|
||||
public dsNbJumpByType;
|
||||
public dsNbJumpByYear;
|
||||
|
||||
constructor(private serviceApi: ServiceApiGet,
|
||||
private serviceComm: ServiceComm) { }
|
||||
constructor(
|
||||
private serviceApi: ServiceApiGet,
|
||||
private serviceComm: ServiceComm
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('Summary');
|
||||
this.serviceComm.updatedComponentTitle("Summary");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user