Bug fix +
Meilleur chargement du cache après login
This commit is contained in:
@@ -8,10 +8,6 @@ import { AuthenticationService } from "../services/authentication.service";
|
||||
import { ServiceComm } from "../services/service-comm.service";
|
||||
import { ConfigurationHelper } from "../services/configuration-helper";
|
||||
import { ServiceCacheApi } from "../services/service-cache-api.service";
|
||||
import { AircraftService } from "../services/aircraft.service";
|
||||
import { GearService } from "../services/gear.service";
|
||||
import { JumpTypeService } from "../services/jump-type.service";
|
||||
import { DropzoneService } from "../services/dropzone.service";
|
||||
|
||||
@Component({
|
||||
selector: "app-root",
|
||||
@@ -26,11 +22,7 @@ export class AppComponent implements OnInit {
|
||||
constructor(private router: Router,
|
||||
private authenticationService: AuthenticationService,
|
||||
private serviceComm: ServiceComm,
|
||||
private serviceCacheApi : ServiceCacheApi,
|
||||
private serviceApiAircraft : AircraftService,
|
||||
private serviceApiJumpType : JumpTypeService,
|
||||
private serviceApiDropzone : DropzoneService,
|
||||
private serviceApiGear : GearService)
|
||||
private serviceCacheApi : ServiceCacheApi)
|
||||
{
|
||||
this.authenticationService.currentUser.subscribe(user => { this.currentUser = user; });
|
||||
|
||||
@@ -44,13 +36,6 @@ export class AppComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.componentTitle.subscribe(title => (this.title = title));
|
||||
|
||||
if (this.authenticationService.currentUserValue != undefined) {
|
||||
this.serviceApiAircraft.getListOfAircrafts(false).subscribe();
|
||||
this.serviceApiJumpType.getListOfJumpTypes().subscribe();
|
||||
this.serviceApiDropzone.getListOfDropZones(false).subscribe();
|
||||
this.serviceApiGear.getListOfGears().subscribe();
|
||||
}
|
||||
}
|
||||
|
||||
show() {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { MatDialog } from "@angular/material/dialog";
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { AddAction } from '../../models/add-action.enum';
|
||||
import { JumpResp } from '../../models/jump';
|
||||
import { Jump } from '../../models/jump';
|
||||
import { JumpService } from '../../services/jump.service';
|
||||
import { ServiceComm } from '../../services/service-comm.service';
|
||||
import { JumpInfosComponent } from "../jump-infos/jump-infos.component";
|
||||
@@ -16,7 +16,7 @@ import { JumpInfosComponent } from "../jump-infos/jump-infos.component";
|
||||
styleUrls: ['./list-of-jumps.component.css']
|
||||
})
|
||||
export class ListOfJumpsComponent implements OnInit {
|
||||
public listOfJumps: Observable<Array<JumpResp>>;
|
||||
public listOfJumps: Observable<Array<Jump>>;
|
||||
public displayedColumns: Array<string> = [
|
||||
'infos',
|
||||
'id',
|
||||
@@ -56,7 +56,7 @@ export class ListOfJumpsComponent implements OnInit {
|
||||
return b.jumpDate > a.jumpDate ? 1 : -1;
|
||||
});
|
||||
|
||||
this.dataSourceTable = new MatTableDataSource<JumpResp>(data);
|
||||
this.dataSourceTable = new MatTableDataSource<Jump>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
this.paginator.pageSize
|
||||
this.resultsLength = data.length;
|
||||
@@ -64,7 +64,7 @@ export class ListOfJumpsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
openDialog(item: JumpResp, editMode: boolean) {
|
||||
openDialog(item: Jump, editMode: boolean) {
|
||||
this.dialog.open(JumpInfosComponent,
|
||||
{ data: { "jump": item, "editMode": editMode},
|
||||
maxHeight: "400px",
|
||||
@@ -72,8 +72,8 @@ export class ListOfJumpsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
delete(item: JumpResp) {
|
||||
let data : Array<JumpResp> = this.dataSourceTable.data;
|
||||
delete(item: Jump) {
|
||||
let data : Array<Jump> = this.dataSourceTable.data;
|
||||
data = data.filter(d => d.id !== item.id);
|
||||
|
||||
this.dataSourceTable.data = data;
|
||||
|
||||
@@ -6,6 +6,10 @@ import { MatInput } from '@angular/material/input';
|
||||
import { first } from 'rxjs/operators';
|
||||
|
||||
import { AuthenticationService } from '../../services/authentication.service';
|
||||
import { AircraftService } from "../../services/aircraft.service";
|
||||
import { GearService } from "../../services/gear.service";
|
||||
import { JumpTypeService } from "../../services/jump-type.service";
|
||||
import { DropzoneService } from "../../services/dropzone.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-login-user',
|
||||
@@ -20,13 +24,14 @@ export class LoginUserComponent implements OnInit, AfterViewInit {
|
||||
error = '';
|
||||
@ViewChild('username') userNameInput: MatInput;
|
||||
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private authenticationService: AuthenticationService
|
||||
) {
|
||||
// redirect to home if already logged in
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private authenticationService: AuthenticationService,
|
||||
private serviceApiAircraft : AircraftService,
|
||||
private serviceApiJumpType : JumpTypeService,
|
||||
private serviceApiDropzone : DropzoneService,
|
||||
private serviceApiGear : GearService) {
|
||||
if (this.authenticationService.currentUserValue) {
|
||||
this.router.navigate(['/']);
|
||||
}
|
||||
@@ -40,12 +45,7 @@ export class LoginUserComponent implements OnInit, AfterViewInit {
|
||||
this.loginForm = this.formBuilder.group(
|
||||
{
|
||||
username: ['', [Validators.required, Validators.minLength(3)]],
|
||||
password: [
|
||||
'',
|
||||
[
|
||||
Validators.required
|
||||
]
|
||||
]
|
||||
password: ['', [Validators.required]]
|
||||
},
|
||||
{ updateOn: 'blur' }
|
||||
);
|
||||
@@ -68,17 +68,21 @@ export class LoginUserComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
this.authenticationService
|
||||
.login(this.formCtrls.username.value, this.formCtrls.password.value)
|
||||
.pipe(first())
|
||||
.subscribe(
|
||||
data => {
|
||||
this.router.navigate([this.returnUrl]);
|
||||
},
|
||||
error => {
|
||||
this.error = error;
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
this.authenticationService.login(this.formCtrls.username.value, this.formCtrls.password.value)
|
||||
.pipe(first())
|
||||
.subscribe(
|
||||
() => {
|
||||
this.serviceApiAircraft.getListOfAircrafts(false).subscribe();
|
||||
this.serviceApiJumpType.getListOfJumpTypes().subscribe();
|
||||
this.serviceApiDropzone.getListOfDropZones(false).subscribe();
|
||||
this.serviceApiGear.getListOfGears().subscribe();
|
||||
|
||||
this.router.navigate([this.returnUrl]);
|
||||
},
|
||||
error => {
|
||||
this.error = error;
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<div class="paragraph">
|
||||
<label class="left130">Last jump</label>
|
||||
<span>: {{ lastJump | date: 'yyyy-MM-dd' }}</span>
|
||||
<span>: {{ lastJump }}</span>
|
||||
</div>
|
||||
|
||||
<div class="paragraph" style="margin-top: 20px;">
|
||||
@@ -21,7 +21,7 @@
|
||||
</div>
|
||||
|
||||
<mat-tab-group mat-align-tabs="left" animationDuration="0ms"
|
||||
(selectedTabChange)="onTabChanged($event);">
|
||||
(selectedIndex)="0" (selectedTabChange)="onTabChanged($event);">
|
||||
<mat-tab label="Jumps in the last month">
|
||||
<ng-template matTabContent>
|
||||
<div class="containerFlex">
|
||||
|
||||
@@ -50,8 +50,6 @@ export class SummaryComponent implements OnInit {
|
||||
data.byJumpType
|
||||
);
|
||||
});
|
||||
|
||||
this.tabGroup.selectedIndex = 0;
|
||||
}
|
||||
|
||||
public refreshStats() {
|
||||
|
||||
Reference in New Issue
Block a user