Renommage du composant 'Home' en 'Dashboard'

This commit is contained in:
Julien Gautier
2023-10-03 16:28:03 +02:00
parent 340228e698
commit 2ccc9fc858
12 changed files with 65 additions and 63 deletions
+4 -4
View File
@@ -2,14 +2,14 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule, PreloadAllModules } from '@angular/router'; import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
const routes: Routes = [ const routes: Routes = [
{
path: 'dashboard',
loadChildren: () => import('./components/home/home.module').then(m => m.HomeModule)
},
{ {
path: 'calculator', path: 'calculator',
loadChildren: () => import('./components/calculator/calculator.module').then(m => m.CalculatorModule) loadChildren: () => import('./components/calculator/calculator.module').then(m => m.CalculatorModule)
}, },
{
path: 'dashboard',
loadChildren: () => import('./components/dashboard/dashboard.module').then(m => m.DashboardModule)
},
{ {
path: 'logbook', path: 'logbook',
loadChildren: () => import('./components/logbook/logbook.module').then(m => m.LogbookModule) loadChildren: () => import('./components/logbook/logbook.module').then(m => m.LogbookModule)
+2 -2
View File
@@ -8,7 +8,7 @@ import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { CoreModule } from './core/core.module'; import { CoreModule } from './core/core.module';
import { AuthModule } from './components/auth/auth.module'; import { AuthModule } from './components/auth/auth.module';
import { HomeModule } from './components/home/home.module'; import { DashboardModule } from './components/dashboard/dashboard.module';
import { SpinnerComponent } from './components/shared'; import { SpinnerComponent } from './components/shared';
import { FullComponent } from 'src/app/components/shared/layout'; import { FullComponent } from 'src/app/components/shared/layout';
//import { FullComponent } from 'src/app/components/shared/layout/full.component'; //import { FullComponent } from 'src/app/components/shared/layout/full.component';
@@ -27,7 +27,7 @@ registerLocaleData(localeFr);
SpinnerComponent, SpinnerComponent,
FullComponent, FullComponent,
//HeaderComponent, FooterComponent, FullComponent, //HeaderComponent, FooterComponent, FullComponent,
HomeModule DashboardModule
], ],
providers: [ Title, { provide: LOCALE_ID, useValue: 'fr-FR' } ], providers: [ Title, { provide: LOCALE_ID, useValue: 'fr-FR' } ],
bootstrap: [ AppComponent ] bootstrap: [ AppComponent ]
@@ -125,54 +125,54 @@
<hr /> <hr />
<h4 class="border-bottom border-secondary py-2 mb-2">Tableau des tailles de voile par poids</h4> <h4 class="border-bottom border-secondary py-2 mb-2">Tableau des tailles de voile par poids</h4>
<table mat-table [dataSource]="canopy_size_table" matSort class="table table-striped table-dark table-hover mat-elevation-z2"> <table mat-table [dataSource]="canopy_size_table" matSort class="table table-striped table-dark table-hover mat-elevation-z2">
<!-- Numero Column --> <!-- weight column -->
<ng-container matColumnDef="weight"> <ng-container matColumnDef="weight">
<th mat-header-cell *matHeaderCellDef mat-sort-header class="first {{tableHeader[0].active}}"> {{tableHeader[0].name}} </th> <th mat-header-cell *matHeaderCellDef mat-sort-header class="first {{tableHeader[0].active}}"> {{tableHeader[0].name}} </th>
<th mat-cell *matCellDef="let element;" class="text-end ps-3 pe-4 fs-6" role="button" (click)="setCurrentWeight(element.weight)"> <th mat-cell *matCellDef="let element;" class="text-end ps-3 pe-4 fs-6" role="button" (click)="setCurrentWeight(element.weight)">
<span class="text-warn d-block">{{element.weight}}</span> <span class="text-warn d-block">{{element.weight}}</span>
</th> </th>
</ng-container> </ng-container>
<!-- range_ Column --> <!-- range_1 column -->
<ng-container matColumnDef="range_1"> <ng-container matColumnDef="range_1">
<th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[1].active}}"> {{tableHeader[1].name}} </th> <th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[1].active}}"> {{tableHeader[1].name}} </th>
<td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[0].active}}">{{element.ranges[0].value}}</td> <td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[0].active}}">{{element.ranges[0].value}}</td>
</ng-container> </ng-container>
<!-- range_ Column --> <!-- range_2 column -->
<ng-container matColumnDef="range_2"> <ng-container matColumnDef="range_2">
<th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[2].active}}"> {{tableHeader[2].name}} </th> <th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[2].active}}"> {{tableHeader[2].name}} </th>
<td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[1].active}}">{{element.ranges[1].value}}</td> <td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[1].active}}">{{element.ranges[1].value}}</td>
</ng-container> </ng-container>
<!-- range_ Column --> <!-- range_3 column -->
<ng-container matColumnDef="range_3"> <ng-container matColumnDef="range_3">
<th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[3].active}}"> {{tableHeader[3].name}} </th> <th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[3].active}}"> {{tableHeader[3].name}} </th>
<td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[2].active}}">{{element.ranges[2].value}}</td> <td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[2].active}}">{{element.ranges[2].value}}</td>
</ng-container> </ng-container>
<!-- range_ Column --> <!-- range_4 column -->
<ng-container matColumnDef="range_4"> <ng-container matColumnDef="range_4">
<th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[4].active}}"> {{tableHeader[4].name}} </th> <th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[4].active}}"> {{tableHeader[4].name}} </th>
<td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[3].active}}">{{element.ranges[3].value}}</td> <td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[3].active}}">{{element.ranges[3].value}}</td>
</ng-container> </ng-container>
<!-- range_ Column --> <!-- range_5 column -->
<ng-container matColumnDef="range_5"> <ng-container matColumnDef="range_5">
<th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[5].active}}"> {{tableHeader[5].name}} </th> <th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[5].active}}"> {{tableHeader[5].name}} </th>
<td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[4].active}}">{{element.ranges[4].value}}</td> <td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[4].active}}">{{element.ranges[4].value}}</td>
</ng-container> </ng-container>
<!-- range_ Column --> <!-- range_6 column -->
<ng-container matColumnDef="range_6"> <ng-container matColumnDef="range_6">
<th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[6].active}}"> {{tableHeader[6].name}} </th> <th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[6].active}}"> {{tableHeader[6].name}} </th>
<td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[5].active}}">{{element.ranges[5].value}}</td> <td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[5].active}}">{{element.ranges[5].value}}</td>
</ng-container> </ng-container>
<!-- range_ Column --> <!-- range_7 column -->
<ng-container matColumnDef="range_7"> <ng-container matColumnDef="range_7">
<th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[7].active}}"> {{tableHeader[7].name}} </th> <th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[7].active}}"> {{tableHeader[7].name}} </th>
<td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[6].active}}">{{element.ranges[6].value}}</td> <td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[6].active}}">{{element.ranges[6].value}}</td>
</ng-container> </ng-container>
<!-- range_ Column --> <!-- range_8 column -->
<ng-container matColumnDef="range_8"> <ng-container matColumnDef="range_8">
<th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[8].active}}"> {{tableHeader[8].name}} </th> <th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[8].active}}"> {{tableHeader[8].name}} </th>
<td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[7].active}}">{{element.ranges[7].value}}</td> <td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[7].active}}">{{element.ranges[7].value}}</td>
</ng-container> </ng-container>
<!-- range_ Column --> <!-- range_9 column -->
<ng-container matColumnDef="range_9"> <ng-container matColumnDef="range_9">
<th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[9].active}}"> {{tableHeader[9].name}} </th> <th class="pl-3" mat-header-cell *matHeaderCellDef class="{{tableHeader[9].active}}"> {{tableHeader[9].name}} </th>
<td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[8].active}}">{{element.ranges[8].value}}</td> <td mat-cell *matCellDef="let element;" class="pl-3 text-nowrap fs-6 {{element.ranges[8].active}}">{{element.ranges[8].value}}</td>
@@ -186,11 +186,11 @@
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> </div>
<!--
<div class="content"> <div class="content">
<h1>{{title}}</h1> <h1>{{title}}</h1>
<div class="col-xs-12"> <div class="col-xs-12">
<div class="demo-buttons my-2"> <div class="demo-buttons my-2">
<!-- primary buttons -->
<button mat-button color="primary" class="me-2">Texte</button> <button mat-button color="primary" class="me-2">Texte</button>
<button mat-stroked-button color="primary" class="me-2">Texte Stroked</button> <button mat-stroked-button color="primary" class="me-2">Texte Stroked</button>
<button mat-flat-button color="primary" class="me-2">Texte Flat</button> <button mat-flat-button color="primary" class="me-2">Texte Flat</button>
@@ -206,7 +206,6 @@
</button> </button>
</div> </div>
<div class="demo-buttons my-2"> <div class="demo-buttons my-2">
<!-- accent buttons -->
<button mat-button color="accent" class="me-2">Texte</button> <button mat-button color="accent" class="me-2">Texte</button>
<button mat-stroked-button color="accent" class="me-2">Texte Stroked</button> <button mat-stroked-button color="accent" class="me-2">Texte Stroked</button>
<button mat-flat-button color="accent" class="me-2">Texte Flat</button> <button mat-flat-button color="accent" class="me-2">Texte Flat</button>
@@ -222,7 +221,6 @@
</button> </button>
</div> </div>
<div class="demo-buttons my-2"> <div class="demo-buttons my-2">
<!-- warn buttons -->
<button mat-button color="warn" class="me-2">Texte</button> <button mat-button color="warn" class="me-2">Texte</button>
<button mat-stroked-button color="warn" class="me-2">Texte Stroked</button> <button mat-stroked-button color="warn" class="me-2">Texte Stroked</button>
<button mat-flat-button color="warn" class="me-2">Texte Flat</button> <button mat-flat-button color="warn" class="me-2">Texte Flat</button>
@@ -238,7 +236,6 @@
</button> </button>
</div> </div>
<div class="demo-buttons my-2"> <div class="demo-buttons my-2">
<!-- danger buttons -->
<button mat-button color="danger" class="me-2">Texte</button> <button mat-button color="danger" class="me-2">Texte</button>
<button mat-stroked-button color="danger" class="me-2">Texte Stroked</button> <button mat-stroked-button color="danger" class="me-2">Texte Stroked</button>
<button mat-flat-button color="danger" class="me-2">Texte Flat</button> <button mat-flat-button color="danger" class="me-2">Texte Flat</button>
@@ -254,7 +251,6 @@
</button> </button>
</div> </div>
<div class="demo-buttons my-2"> <div class="demo-buttons my-2">
<!-- info buttons -->
<button mat-button color="info" class="me-2">Texte</button> <button mat-button color="info" class="me-2">Texte</button>
<button mat-stroked-button color="info" class="me-2">Texte Stroked</button> <button mat-stroked-button color="info" class="me-2">Texte Stroked</button>
<button mat-flat-button color="info" class="me-2">Texte Flat</button> <button mat-flat-button color="info" class="me-2">Texte Flat</button>
@@ -270,7 +266,6 @@
</button> </button>
</div> </div>
<div class="demo-buttons my-2"> <div class="demo-buttons my-2">
<!-- success buttons -->
<button mat-button color="success" class="me-2">Texte</button> <button mat-button color="success" class="me-2">Texte</button>
<button mat-stroked-button color="success" class="me-2">Texte Stroked</button> <button mat-stroked-button color="success" class="me-2">Texte Stroked</button>
<button mat-flat-button color="success" class="me-2">Texte Flat</button> <button mat-flat-button color="success" class="me-2">Texte Flat</button>
@@ -463,4 +458,5 @@
</div> </div>
</div> </div>
</section> </section>
</div> </div>
-->
@@ -1,13 +1,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home.component'; import { DashboardComponent } from './dashboard.component';
import { AuthResolver } from 'src/app/core/services'; import { AuthResolver } from 'src/app/core/services';
const routes: Routes = [ const routes: Routes = [
{ {
path: '', path: '',
component: HomeComponent, component: DashboardComponent,
resolve: { resolve: {
isAuthenticated: AuthResolver isAuthenticated: AuthResolver
} }
@@ -18,4 +18,4 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
exports: [RouterModule] exports: [RouterModule]
}) })
export class HomeRoutingModule { } export class DashboardRoutingModule { }
@@ -1,16 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component'; import { DashboardComponent } from './dashboard.component';
describe('HomeComponent', () => { describe('DashboardComponent', () => {
let component: HomeComponent; let component: DashboardComponent;
let fixture: ComponentFixture<HomeComponent>; let fixture: ComponentFixture<DashboardComponent>;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [HomeComponent] declarations: [DashboardComponent]
}); });
fixture = TestBed.createComponent(HomeComponent); fixture = TestBed.createComponent(DashboardComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
@@ -6,7 +6,8 @@ import { Observable, Subscription } from 'rxjs';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
import { User, Errors, Aeronef, AeronefByImat, Canopy, CanopyModelBySize, DropZone, DropZoneByYear } from 'src/app/core/models'; import { User, Errors, Aeronef, AeronefByImat, Canopy, CanopyModelBySize, DropZone, DropZoneByYear } from 'src/app/core/models';
import { AeronefsService, CanopiesService, DropZonesService, UserService } from 'src/app/core/services'; //import { AeronefsService, CanopiesService, DropZonesService, UserService } from 'src/app/core/services';
import { UserService } from 'src/app/core/services';
import { ShowAuthedDirective } from 'src/app/components/shared/show-authed.directive'; import { ShowAuthedDirective } from 'src/app/components/shared/show-authed.directive';
import { import {
AeronefsComponent, AeronefsBarComponent, AeronefsComponent, AeronefsBarComponent,
@@ -24,16 +25,18 @@ import {
DropZonesComponent, DropZonesBarComponent, DropZonesComponent, DropZonesBarComponent,
JumpsByMonthComponent JumpsByMonthComponent
], ],
selector: 'huapp-home', selector: 'huapp-dashboard',
templateUrl: './home.component.html', templateUrl: './dashboard.component.html',
styleUrls: ['./home.component.scss'] styleUrls: ['./dashboard.component.scss']
}) })
export class HomeComponent implements OnInit, OnDestroy { export class DashboardComponent implements OnInit, OnDestroy {
private _currentUser: Subscription = new Subscription(); private _currentUser: Subscription = new Subscription();
private _data: Subscription = new Subscription(); private _data: Subscription = new Subscription();
/*
private _aeronefs: Subscription = new Subscription(); private _aeronefs: Subscription = new Subscription();
private _canopies: Subscription = new Subscription(); private _canopies: Subscription = new Subscription();
private _dropzones: Subscription = new Subscription(); private _dropzones: Subscription = new Subscription();
*/
title = 'Dashboard'; title = 'Dashboard';
errors!: Errors; errors!: Errors;
isAuthenticated = false; isAuthenticated = false;
@@ -45,7 +48,7 @@ export class HomeComponent implements OnInit, OnDestroy {
canopyAggregate!: Array<CanopyModelBySize>; canopyAggregate!: Array<CanopyModelBySize>;
canopies!: Array<Canopy>; canopies!: Array<Canopy>;
canopiesCount = 0; canopiesCount = 0;
dropzoneAggregate!: Array<DropZoneByYear>; // Array<DropZoneByOaci> dropzoneAggregate!: Array<DropZoneByYear>;
dropzones!: Array<DropZone>; dropzones!: Array<DropZone>;
dropzonesCount = 0; dropzonesCount = 0;
@@ -53,10 +56,12 @@ export class HomeComponent implements OnInit, OnDestroy {
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private titleService: Title, private titleService: Title,
private userService: UserService, private userService: UserService
/*
private aeronefsService: AeronefsService, private aeronefsService: AeronefsService,
private canopiesService: CanopiesService, private canopiesService: CanopiesService,
private dropzonesService: DropZonesService private dropzonesService: DropZonesService
*/
) { ) {
this._resetErrors(); this._resetErrors();
} }
@@ -85,6 +90,7 @@ export class HomeComponent implements OnInit, OnDestroy {
ngOnDestroy() { ngOnDestroy() {
this._currentUser.unsubscribe(); this._currentUser.unsubscribe();
this._data.unsubscribe();
/* /*
this._aeronefs.unsubscribe(); this._aeronefs.unsubscribe();
this._canopies.unsubscribe(); this._canopies.unsubscribe();
@@ -96,6 +102,7 @@ export class HomeComponent implements OnInit, OnDestroy {
this.errors = { errors: {} }; this.errors = { errors: {} };
} }
/*
private _loadAeronefs(): void { private _loadAeronefs(): void {
const aeronefs$: Observable<Array<AeronefByImat>> = this.aeronefsService.getAllByImat(); const aeronefs$: Observable<Array<AeronefByImat>> = this.aeronefsService.getAllByImat();
this._aeronefs = aeronefs$.subscribe((aggregate: Array<AeronefByImat>) => { this._aeronefs = aeronefs$.subscribe((aggregate: Array<AeronefByImat>) => {
@@ -117,8 +124,6 @@ export class HomeComponent implements OnInit, OnDestroy {
} }
private _loadDropzones(): void { private _loadDropzones(): void {
//const dropzones$: Observable<Array<DropZoneByOaci>> = this.dropzonesService.getAllByOaci();
//this._dropzones = dropzones$.subscribe((aggregate: Array<DropZoneByOaci>) => {
const dropzones$: Observable<Array<DropZoneByYear>> = this.dropzonesService.getAllByDate(); const dropzones$: Observable<Array<DropZoneByYear>> = this.dropzonesService.getAllByDate();
this._dropzones = dropzones$.subscribe((aggregate: Array<DropZoneByYear>) => { this._dropzones = dropzones$.subscribe((aggregate: Array<DropZoneByYear>) => {
this.dropzoneAggregate = aggregate; this.dropzoneAggregate = aggregate;
@@ -127,4 +132,5 @@ export class HomeComponent implements OnInit, OnDestroy {
console.log(this.dropzonesCount); console.log(this.dropzonesCount);
}); });
} }
*/
} }
@@ -0,0 +1,15 @@
import { NgModule } from '@angular/core';
import { AuthResolver } from 'src/app/core/services';
import { DashboardComponent } from './dashboard.component';
import { DashboardRoutingModule } from './dashboard-routing.module';
@NgModule({
imports: [
DashboardRoutingModule,
DashboardComponent
],
exports: [],
providers: [AuthResolver]
})
export class DashboardModule { }
-15
View File
@@ -1,15 +0,0 @@
import { NgModule } from '@angular/core';
import { AuthResolver } from 'src/app/core/services';
import { HomeComponent } from './home.component';
import { HomeRoutingModule } from './home-routing.module';
@NgModule({
imports: [
HomeRoutingModule,
HomeComponent
],
exports: [],
providers: [AuthResolver]
})
export class HomeModule { }
+1 -1
View File
@@ -1,6 +1,6 @@
export * from './auth/auth.component'; export * from './auth/auth.component';
export * from './calculator/calculator.component'; export * from './calculator/calculator.component';
export * from './home/home.component'; export * from './dashboard/dashboard.component';
export * from './logbook/logbook.component'; export * from './logbook/logbook.component';
export * from './profile/profile.component'; export * from './profile/profile.component';
export * from './shared'; export * from './shared';
+6 -6
View File
@@ -1,14 +1,14 @@
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { AuthComponent, CalculatorComponent, HomeComponent, LogbookComponent, ProfileComponent } from 'src/app/components'; import { AuthComponent, CalculatorComponent, DashboardComponent, LogbookComponent, ProfileComponent } from 'src/app/components';
import { AuthResolver, NoAuthGuard } from 'src/app/core/services'; import { NoAuthGuard } from 'src/app/core/services';
export const FRONT_ROUTES: Routes = [ export const FRONT_ROUTES: Routes = [
{ path: 'authenticate', component: AuthComponent, canActivate: [ NoAuthGuard ] },
{ path: 'calculator', component: CalculatorComponent }, { path: 'calculator', component: CalculatorComponent },
{ path: 'dashboard', component: HomeComponent}, { path: 'dashboard', component: DashboardComponent},
{ path: 'logbook', component: LogbookComponent }, { path: 'logbook', component: LogbookComponent },
{ path: 'profile', component: ProfileComponent },
{ path: 'login', component: AuthComponent, canActivate: [ NoAuthGuard ] }, { path: 'login', component: AuthComponent, canActivate: [ NoAuthGuard ] },
{ path: 'register', component: AuthComponent, canActivate: [ NoAuthGuard ] }, { path: 'profile', component: ProfileComponent },
{ path: 'authenticate', component: AuthComponent, canActivate: [ NoAuthGuard ] } { path: 'register', component: AuthComponent, canActivate: [ NoAuthGuard ] }
]; ];