chore(deps): upgrade Angular 18 → 19
- ng update @angular/core@19 @angular/cli@19 @angular/material@19 @angular-eslint/schematics@19 - Migration: remove standalone:true (now default in v19) from 60 components - Migration: zone.js 0.14 → 0.15 - Fix pre-existing build budget error: raise initial bundle limit to 5mb (app ships large static JSON assets)
This commit is contained in:
@@ -12,7 +12,13 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatSliderModule } from '@angular/material/slider';
|
||||
import { MatSnackBar, MatSnackBarConfig, MatSnackBarHorizontalPosition, MatSnackBarModule, MatSnackBarVerticalPosition } from '@angular/material/snack-bar';
|
||||
import {
|
||||
MatSnackBar,
|
||||
MatSnackBarConfig,
|
||||
MatSnackBarHorizontalPosition,
|
||||
MatSnackBarModule,
|
||||
MatSnackBarVerticalPosition,
|
||||
} from '@angular/material/snack-bar';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
@@ -24,13 +30,21 @@ import data from 'src/jumps.json';
|
||||
//import data from 'src/jumps_02.json';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule, RouterModule, FormsModule,
|
||||
MatButtonModule, MatCardModule, MatDividerModule, MatExpansionModule,
|
||||
MatIconModule, MatInputModule, MatMenuModule, MatDialogModule,
|
||||
MatSliderModule, MatSnackBarModule,
|
||||
JumpTableComponent
|
||||
CommonModule,
|
||||
RouterModule,
|
||||
FormsModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatDividerModule,
|
||||
MatExpansionModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatMenuModule,
|
||||
MatDialogModule,
|
||||
MatSliderModule,
|
||||
MatSnackBarModule,
|
||||
JumpTableComponent,
|
||||
],
|
||||
selector: 'app-logbook',
|
||||
templateUrl: './logbook.component.html',
|
||||
@@ -38,16 +52,10 @@ import data from 'src/jumps.json';
|
||||
animations: [
|
||||
trigger('flyInOut', [
|
||||
state('in', style({ transform: 'translateY(0)' })),
|
||||
transition('void => *', [
|
||||
style({ transform: 'translateY(-100%)' }),
|
||||
animate(200)
|
||||
]),
|
||||
transition('* => void', [
|
||||
style({ transform: 'translateY(100%)' }),
|
||||
animate(200)
|
||||
])
|
||||
])
|
||||
]
|
||||
transition('void => *', [style({ transform: 'translateY(-100%)' }), animate(200)]),
|
||||
transition('* => void', [style({ transform: 'translateY(100%)' }), animate(200)]),
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked {
|
||||
private _currentUser: Subscription = new Subscription();
|
||||
@@ -77,11 +85,11 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
hauteur: Range;
|
||||
year: Range;
|
||||
} = {
|
||||
numero: {start: 1, end: 100000},
|
||||
taille: {start: 1, end: 400},
|
||||
participants: {start: 1, end: 200},
|
||||
hauteur: {start: 0, end: 10000},
|
||||
year: {start: 1970, end: 2020}
|
||||
numero: { start: 1, end: 100000 },
|
||||
taille: { start: 1, end: 400 },
|
||||
participants: { start: 1, end: 200 },
|
||||
hauteur: { start: 0, end: 10000 },
|
||||
year: { start: 1970, end: 2020 },
|
||||
};
|
||||
|
||||
constructor(
|
||||
@@ -92,13 +100,16 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
private _jumpsService: JumpsService,
|
||||
private _jumpTableService: JumpTableService,
|
||||
private _userService: UserService,
|
||||
public menuItems: MenuItems
|
||||
) { }
|
||||
public menuItems: MenuItems,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
//this.importJumps();
|
||||
const data$: Observable<{isAuthenticated: boolean, lastjump: Jump}> = this.route.data as Observable<{isAuthenticated: boolean, lastjump: Jump}>;
|
||||
this._data = data$.subscribe((data: {isAuthenticated: boolean, lastjump: Jump}) => {
|
||||
const data$: Observable<{ isAuthenticated: boolean; lastjump: Jump }> = this.route.data as Observable<{
|
||||
isAuthenticated: boolean;
|
||||
lastjump: Jump;
|
||||
}>;
|
||||
this._data = data$.subscribe((data: { isAuthenticated: boolean; lastjump: Jump }) => {
|
||||
this.isAuthenticated = data.isAuthenticated;
|
||||
if (!this.isAuthenticated) {
|
||||
this.router.navigateByUrl('/login');
|
||||
@@ -114,24 +125,24 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
const currentYear: number = new Date().getFullYear();
|
||||
this.lastJump = data['lastjump'];
|
||||
this.rangesMinMax = {
|
||||
numero: {start: 1, end: data.lastjump.numero},
|
||||
taille: {start: data.lastjump.taille!, end: 230},
|
||||
participants: {start: 1, end: 20},
|
||||
hauteur: {start: 1000, end: 8000},
|
||||
year: {start: 2018, end: currentYear}
|
||||
}
|
||||
numero: { start: 1, end: data.lastjump.numero },
|
||||
taille: { start: data.lastjump.taille!, end: 230 },
|
||||
participants: { start: 1, end: 20 },
|
||||
hauteur: { start: 1000, end: 8000 },
|
||||
year: { start: 2018, end: currentYear },
|
||||
};
|
||||
this.listConfig.filters.numeroRangeStart = this.rangesMinMax.numero.start;
|
||||
this.listConfig.filters.numeroRangeEnd = this.rangesMinMax.numero.end;
|
||||
this.listConfig.filters.tailleRangeStart = this.rangesMinMax.taille.start;
|
||||
this.listConfig.filters.tailleRangeEnd = this.rangesMinMax.taille.end;
|
||||
this.listConfig.filters.participantsRangeStart = this.rangesMinMax.participants.start;
|
||||
this.listConfig.filters.participantsRangeEnd = (this.rangesMinMax.participants.end / 2);
|
||||
this.listConfig.filters.participantsRangeEnd = this.rangesMinMax.participants.end / 2;
|
||||
this.listConfig.filters.hauteurRangeStart = this.rangesMinMax.hauteur.start;
|
||||
this.listConfig.filters.hauteurRangeEnd = this.rangesMinMax.hauteur.end;
|
||||
this.listConfig.filters.yearRangeStart = this.rangesMinMax.year.start;
|
||||
this.listConfig.filters.yearRangeEnd = this.rangesMinMax.year.end;
|
||||
this.jumpsSinceHundred = computed(() => (this.lastJump.numero % 100));
|
||||
this.jumpsToHundred = computed(() => (100 - this.jumpsSinceHundred()));
|
||||
this.jumpsSinceHundred = computed(() => this.lastJump.numero % 100);
|
||||
this.jumpsToHundred = computed(() => 100 - this.jumpsSinceHundred());
|
||||
/*
|
||||
this._lastjump$ = this._jumpsService.getLastJump();
|
||||
this._lastjump = this._lastjump$.subscribe((jump) => {
|
||||
@@ -165,7 +176,7 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
this._data.unsubscribe();
|
||||
this._currentUser.unsubscribe();
|
||||
this._lastjump.unsubscribe();
|
||||
this._subscriptions.forEach(subscription => {
|
||||
this._subscriptions.forEach((subscription) => {
|
||||
subscription.unsubscribe();
|
||||
});
|
||||
}
|
||||
@@ -185,17 +196,18 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
try {
|
||||
data.forEach((entry) => {
|
||||
Object.assign(this.jump, entry);
|
||||
this._jumpsService.save(this.jump)
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
next: (jump) => {
|
||||
console.log(`Le saut n°${jump.numero} a été ajouté !`, 'OK');
|
||||
},
|
||||
error: (err) => {
|
||||
console.log(`Le saut n'a pas été ajouté !`, 'Error', err);
|
||||
this.errors = err;
|
||||
}
|
||||
});
|
||||
this._jumpsService
|
||||
.save(this.jump)
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
next: (jump) => {
|
||||
console.log(`Le saut n°${jump.numero} a été ajouté !`, 'OK');
|
||||
},
|
||||
error: (err) => {
|
||||
console.log(`Le saut n'a pas été ajouté !`, 'Error', err);
|
||||
this.errors = err;
|
||||
},
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -204,19 +216,21 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
|
||||
openAddDialog(): void {
|
||||
this.jump = <Jump>{};
|
||||
this.jump.numero = (this.lastJump.numero + 1);
|
||||
this.jump.numero = this.lastJump.numero + 1;
|
||||
this.jump.sautants = [];
|
||||
this.jump.participants = 1;
|
||||
const dialogRef = this.dialog.open(JumpAddDialogComponent, {
|
||||
width: '70vw',
|
||||
data: {jump: this.jump, lastJump: this.lastJump}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(take(1))
|
||||
.subscribe(result => {
|
||||
if (result != undefined) {
|
||||
this._onEntry(result);
|
||||
}
|
||||
data: { jump: this.jump, lastJump: this.lastJump },
|
||||
});
|
||||
dialogRef
|
||||
.afterClosed()
|
||||
.pipe(take(1))
|
||||
.subscribe((result) => {
|
||||
if (result != undefined) {
|
||||
this._onEntry(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setTotalResults(value: number): void {
|
||||
@@ -229,112 +243,128 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
config.filters.offset = 0;
|
||||
config.filters.dateRangeStart = `${jumps[0].date!.substring(0, 10)} 00:00:00`;
|
||||
config.filters.dateRangeEnd = `${jumps[0].date!.substring(0, 10)} 23:59:59`;
|
||||
const subscription: Subscription = this._jumpsService.getAllFromSkydiverIdApi(config)
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
next: (data) => {
|
||||
if (data.items.length) {
|
||||
const diff = jumps.length - data.items.length;
|
||||
if (diff < 0) {
|
||||
console.error(`${diff} ${diff > 1 ? 'données' : 'donnée'} altimètre de trop le ${jumps[0].date!.substring(0, 10)}`);
|
||||
const subscription: Subscription = this._jumpsService
|
||||
.getAllFromSkydiverIdApi(config)
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
next: (data) => {
|
||||
if (data.items.length) {
|
||||
const diff = jumps.length - data.items.length;
|
||||
if (diff < 0) {
|
||||
console.error(
|
||||
`${diff} ${diff > 1 ? 'données' : 'donnée'} altimètre de trop le ${jumps[0].date!.substring(0, 10)}`,
|
||||
);
|
||||
}
|
||||
if (diff > 0) {
|
||||
console.error(
|
||||
`${diff}/${jumps.length} ${diff > 1 ? 'données altimètre manquantes' : 'donnée altimètre manquante'} le ${jumps[0].date!.substring(0, 10)}`,
|
||||
jumps,
|
||||
data.items,
|
||||
);
|
||||
}
|
||||
console.log(
|
||||
`${jumps.length} ${jumps.length > 1 ? 'sauts' : 'saut'} le ${data.items[0].date!.substring(0, 10)}`,
|
||||
jumps.sort((a, b) => b.numero! - a.numero!),
|
||||
data.items,
|
||||
);
|
||||
this._addX2Data(data.items, jumps);
|
||||
} else {
|
||||
console.info('Aucune données altimètre pour le ', jumps[0].date!.substring(0, 10));
|
||||
}
|
||||
if (diff > 0) {
|
||||
console.error(`${diff}/${jumps.length} ${diff > 1 ? 'données altimètre manquantes' : 'donnée altimètre manquante'} le ${jumps[0].date!.substring(0, 10)}`, jumps, data.items);
|
||||
}
|
||||
console.log(`${jumps.length} ${jumps.length > 1 ? 'sauts' : 'saut'} le ${data.items[0].date!.substring(0, 10)}`, jumps.sort((a, b) => b.numero! - a.numero!), data.items);
|
||||
this._addX2Data(data.items, jumps);
|
||||
} else {
|
||||
console.info('Aucune données altimètre pour le ', jumps[0].date!.substring(0, 10));
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
console.error('getAllFromSkydiverIdApi error');
|
||||
this.errors = err;
|
||||
}
|
||||
});
|
||||
},
|
||||
error: (err) => {
|
||||
console.error('getAllFromSkydiverIdApi error');
|
||||
this.errors = err;
|
||||
},
|
||||
});
|
||||
this._subscriptions.push(subscription);
|
||||
}
|
||||
|
||||
private _addJump(jumps: Array<Jump>, index: number = 0) {
|
||||
this._jumpsService.save(jumps[index])
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
next: (jump) => {
|
||||
jumps[index] = jump;
|
||||
console.log('Ajout du saut', jump.numero);
|
||||
Object.assign(this.jump, jump);
|
||||
this._openSnackBar(`Le saut n°${jump.numero} a été ajouté !`, 'Annuler');
|
||||
this._resetErrors();
|
||||
if (jumps.length == (index + 1)) {
|
||||
this._loadSkydiverIdJumps(jumps);
|
||||
} else {
|
||||
this._addJump(jumps, (index + 1));
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
this.errors = err;
|
||||
this.isSubmitting = false;
|
||||
}
|
||||
});
|
||||
this._jumpsService
|
||||
.save(jumps[index])
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
next: (jump) => {
|
||||
jumps[index] = jump;
|
||||
console.log('Ajout du saut', jump.numero);
|
||||
Object.assign(this.jump, jump);
|
||||
this._openSnackBar(`Le saut n°${jump.numero} a été ajouté !`, 'Annuler');
|
||||
this._resetErrors();
|
||||
if (jumps.length == index + 1) {
|
||||
this._loadSkydiverIdJumps(jumps);
|
||||
} else {
|
||||
this._addJump(jumps, index + 1);
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
this.errors = err;
|
||||
this.isSubmitting = false;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private _addX2Data(x2data: Array<X2Data>, jumps: Array<Jump>, index: number = 0) {
|
||||
const file: JumpFile = {
|
||||
name: x2data[index].name,
|
||||
path: `/Volumes/Storage/Skydive/X2_Logs/${x2data[index].date!.substring(0, 4)}/`,
|
||||
type: JumpFileType.CSV
|
||||
type: JumpFileType.CSV,
|
||||
} as JumpFile;
|
||||
this._subscriptions.push(
|
||||
this._jumpsService.saveX2Data(jumps[index].slug!, file, x2data[index])
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
next: (jump) => {
|
||||
jumps[index] = jump;
|
||||
console.log(`Le fichier ${file.name} a été ajouté au saut n°${jump.numero} !`, 'OK');
|
||||
if (jumps.length == (index + 1) || x2data.length == (index + 1)) {
|
||||
this._addKmlFile(jumps);
|
||||
} else {
|
||||
this._addX2Data(x2data, jumps, (index + 1));
|
||||
}
|
||||
|
||||
},
|
||||
error: (err) => {
|
||||
this.errors = err;
|
||||
}
|
||||
})
|
||||
this._jumpsService
|
||||
.saveX2Data(jumps[index].slug!, file, x2data[index])
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
next: (jump) => {
|
||||
jumps[index] = jump;
|
||||
console.log(`Le fichier ${file.name} a été ajouté au saut n°${jump.numero} !`, 'OK');
|
||||
if (jumps.length == index + 1 || x2data.length == index + 1) {
|
||||
this._addKmlFile(jumps);
|
||||
} else {
|
||||
this._addX2Data(x2data, jumps, index + 1);
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
this.errors = err;
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private _addKmlFile(jumps: Array<Jump>, index: number = 0) {
|
||||
if (jumps[index].x2data !== null) {
|
||||
//console.log(`Le fichier ${jump.x2data.name} existe pour le saut n°${jump.numero} !`, `https://skydiver.id/api/jump/${jump.x2data.id}/kml`);
|
||||
const file: JumpFile = {
|
||||
name: jumps[index].x2data.name.substring(0, -4) + '.kml',
|
||||
path: `/Volumes/Storage/Skydive/X2_Kmls/${jumps[index].date.substring(0, 4)}/`,
|
||||
type: JumpFileType.KML
|
||||
type: JumpFileType.KML,
|
||||
} as JumpFile;
|
||||
this._subscriptions.push(
|
||||
this._jumpsService.saveKml(jumps[index].slug, file)
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
next: (file) => {
|
||||
console.log(`Le fichier ${file.path}${file.name} a été ajouté au saut n°${jumps[index].numero} !`, 'OK');
|
||||
if (jumps.length == (index + 1)) {
|
||||
this._resetErrors();
|
||||
this.jumpRefresh = !this.jumpRefresh;
|
||||
this._jumpTableService.updateJumpRefresh(this.jumpRefresh);
|
||||
this._lastjump$ = this._jumpsService.getLastJump();
|
||||
this._lastjump = this._lastjump$.subscribe((jump) => {
|
||||
this.lastJump = jump;
|
||||
});
|
||||
} else {
|
||||
this._addKmlFile(jumps, (index + 1));
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
this.errors = err;
|
||||
}
|
||||
})
|
||||
this._jumpsService
|
||||
.saveKml(jumps[index].slug, file)
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
next: (file) => {
|
||||
console.log(
|
||||
`Le fichier ${file.path}${file.name} a été ajouté au saut n°${jumps[index].numero} !`,
|
||||
'OK',
|
||||
);
|
||||
if (jumps.length == index + 1) {
|
||||
this._resetErrors();
|
||||
this.jumpRefresh = !this.jumpRefresh;
|
||||
this._jumpTableService.updateJumpRefresh(this.jumpRefresh);
|
||||
this._lastjump$ = this._jumpsService.getLastJump();
|
||||
this._lastjump = this._lastjump$.subscribe((jump) => {
|
||||
this.lastJump = jump;
|
||||
});
|
||||
} else {
|
||||
this._addKmlFile(jumps, index + 1);
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
this.errors = err;
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -387,7 +417,7 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
const config: MatSnackBarConfig = {
|
||||
horizontalPosition: <MatSnackBarHorizontalPosition>'end',
|
||||
verticalPosition: <MatSnackBarVerticalPosition>'bottom',
|
||||
duration: 4000
|
||||
duration: 4000,
|
||||
};
|
||||
this.snackBar.open(content, title, config);
|
||||
}
|
||||
@@ -395,5 +425,4 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
private _resetErrors(): void {
|
||||
this.errors = { errors: {} };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user