Fix par fix
This commit is contained in:
@@ -30,9 +30,9 @@ import { User } from "../../models/user";
|
||||
MatFormFieldModule,
|
||||
ReactiveFormsModule,
|
||||
MatInputModule,
|
||||
MatButtonModule,
|
||||
TranslateModule,
|
||||
TranslatePipe,
|
||||
MatButtonModule,
|
||||
],
|
||||
})
|
||||
export class CreateUserComponent implements OnInit {
|
||||
|
||||
@@ -4,7 +4,9 @@ import { MAT_DIALOG_DATA } from "@angular/material/dialog";
|
||||
import { TranslateModule } from "@ngx-translate/core";
|
||||
import { MatCheckboxModule } from "@angular/material/checkbox";
|
||||
import { MatFormFieldModule } from "@angular/material/form-field";
|
||||
import { FormsModule } from "@angular/forms";
|
||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||
import { MatInputModule } from "@angular/material/input";
|
||||
import { MatButtonModule } from "@angular/material/button";
|
||||
|
||||
import { AddAction } from "../../models/add-action.enum";
|
||||
import { JumpResp } from "../../models/jump";
|
||||
@@ -19,9 +21,12 @@ import { ServiceComm } from "../../services/service-comm.service";
|
||||
imports: [
|
||||
TranslateModule,
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
MatCheckboxModule,
|
||||
MatFormFieldModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
MatInputModule,
|
||||
MatButtonModule,
|
||||
],
|
||||
})
|
||||
export class JumpInfosComponent implements OnInit {
|
||||
|
||||
@@ -12,6 +12,10 @@ import { CommonModule } from "@angular/common";
|
||||
import { MatIconModule } from "@angular/material/icon";
|
||||
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
||||
import { MatProgressBarModule } from "@angular/material/progress-bar";
|
||||
import { MatButtonModule } from "@angular/material/button";
|
||||
import { MatInputModule } from "@angular/material/input";
|
||||
import { ReactiveFormsModule } from "@angular/forms";
|
||||
import { MatFormFieldModule } from "@angular/material/form-field";
|
||||
|
||||
import { AddAction } from "../../models/add-action.enum";
|
||||
import { Jump } from "../../models/jump";
|
||||
@@ -27,13 +31,17 @@ import { StatsService } from "../../services/stats.service";
|
||||
imports: [
|
||||
TranslateModule,
|
||||
CommonModule,
|
||||
RouterLink,
|
||||
RouterModule,
|
||||
MatIconModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatProgressBarModule,
|
||||
RouterLink,
|
||||
RouterModule,
|
||||
MatTableModule,
|
||||
MatFormFieldModule,
|
||||
ReactiveFormsModule,
|
||||
MatInputModule,
|
||||
MatButtonModule,
|
||||
],
|
||||
})
|
||||
export class ListOfJumpsComponent implements OnInit {
|
||||
|
||||
@@ -15,7 +15,9 @@ import { MatCheckboxModule } from "@angular/material/checkbox";
|
||||
import { MatAutocompleteModule } from "@angular/material/autocomplete";
|
||||
import { MatDatepickerModule } from "@angular/material/datepicker";
|
||||
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
||||
import { FormsModule } from "@angular/forms";
|
||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||
import { MatInputModule } from "@angular/material/input";
|
||||
import { MatButtonModule } from "@angular/material/button";
|
||||
|
||||
import { JumpTypeResp } from "../../models/jumpType";
|
||||
import { AircraftResp } from "../../models/aircraft";
|
||||
@@ -57,16 +59,20 @@ class PickDateAdapter extends NativeDateAdapter {
|
||||
imports: [
|
||||
TranslateModule,
|
||||
CommonModule,
|
||||
RouterLink,
|
||||
FormsModule,
|
||||
RouterModule,
|
||||
MatIconModule,
|
||||
MatOptionModule,
|
||||
MatFormFieldModule,
|
||||
RouterLink,
|
||||
MatCheckboxModule,
|
||||
MatAutocompleteModule,
|
||||
MatDatepickerModule,
|
||||
MatProgressSpinnerModule,
|
||||
FormsModule,
|
||||
RouterModule,
|
||||
MatFormFieldModule,
|
||||
ReactiveFormsModule,
|
||||
MatInputModule,
|
||||
MatButtonModule,
|
||||
],
|
||||
})
|
||||
export class NewJumpComponent implements OnInit {
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
import { HttpHeaders } from "@angular/common/http";
|
||||
|
||||
import { ConfigurationHelper } from './configuration-helper';
|
||||
import { ServiceCacheApi } from './service-cache-api.service';
|
||||
import { ConfigurationHelper } from "./configuration-helper";
|
||||
import { ServiceCacheApi } from "./service-cache-api.service";
|
||||
|
||||
export class BaseService {
|
||||
protected headers: HttpHeaders;
|
||||
protected apiUrl: string;
|
||||
protected serviceCacheApi : ServiceCacheApi;
|
||||
protected headers: HttpHeaders;
|
||||
protected apiUrl: string;
|
||||
protected serviceCacheApi: ServiceCacheApi;
|
||||
|
||||
constructor() {
|
||||
ConfigurationHelper.settings.subscribe(settings =>
|
||||
{
|
||||
if (settings != null) {
|
||||
let tmpApiUrl : string = settings.apiUrl;
|
||||
|
||||
this.headers = new HttpHeaders({
|
||||
'Access-Control-Allow-Origin': tmpApiUrl
|
||||
});
|
||||
this.apiUrl = tmpApiUrl + '/api';
|
||||
}
|
||||
constructor() {
|
||||
ConfigurationHelper.settings.subscribe((settings) => {
|
||||
if (settings != null) {
|
||||
let tmpApiUrl: string = settings.apiUrl;
|
||||
|
||||
this.headers = new HttpHeaders({
|
||||
"Access-Control-Allow-Origin": tmpApiUrl,
|
||||
});
|
||||
this.apiUrl = tmpApiUrl + "/api";
|
||||
}
|
||||
});
|
||||
|
||||
this.serviceCacheApi = new ServiceCacheApi();
|
||||
}
|
||||
this.serviceCacheApi = new ServiceCacheApi();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { CacheApiKey } from '../models/cache-api-key.enum';
|
||||
import { of } from 'rxjs';
|
||||
import { Injectable } from "@angular/core";
|
||||
import { Observable } from "rxjs";
|
||||
import { tap } from "rxjs/operators";
|
||||
import { CacheApiKey } from "../models/cache-api-key.enum";
|
||||
import { of } from "rxjs";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
@Injectable({ providedIn: "root" })
|
||||
export class ServiceCacheApi {
|
||||
private cache: Map<CacheApiKey, Observable<any>>;
|
||||
|
||||
constructor() {
|
||||
constructor() {
|
||||
this.cache = new Map<CacheApiKey, Observable<any>>();
|
||||
}
|
||||
|
||||
public get<T>(key: CacheApiKey, callToApi: Observable<T>) : Observable<T> {
|
||||
public get<T>(key: CacheApiKey, callToApi: Observable<T>): Observable<T> {
|
||||
const cached = this.cache.get(key);
|
||||
|
||||
if (cached) {
|
||||
return cached;
|
||||
} else {
|
||||
return callToApi.pipe(
|
||||
tap(event => {
|
||||
this.cache.set(key, of(event));
|
||||
}));
|
||||
tap((event) => {
|
||||
this.cache.set(key, of(event));
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +30,7 @@ export class ServiceCacheApi {
|
||||
this.cache.delete(key);
|
||||
}
|
||||
|
||||
public getByKey<T>(key: CacheApiKey) : Observable<T> {
|
||||
public getByKey<T>(key: CacheApiKey): Observable<T> {
|
||||
return this.cache.get(key);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user