|
|
|
@ -3,6 +3,7 @@ import { Component } from '@angular/core'; |
|
|
|
|
import { ResetDataService } from '../service/reset_data.service'; |
|
|
|
|
import { Router, RouterModule } from '@angular/router'; |
|
|
|
|
import { AppRoutingModule } from '../app-routing.module'; |
|
|
|
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog'; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-navbar', |
|
|
|
@ -11,6 +12,7 @@ import { AppRoutingModule } from '../app-routing.module'; |
|
|
|
|
}) |
|
|
|
|
export class NavbarComponent { |
|
|
|
|
public mobileOpen: boolean = false; |
|
|
|
|
public isLoading: boolean = false; |
|
|
|
|
|
|
|
|
|
constructor(private resetDataService: ResetDataService, private router: Router){} |
|
|
|
|
|
|
|
|
@ -19,7 +21,18 @@ export class NavbarComponent { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public applyResetDatabase():void { |
|
|
|
|
this.resetDataService.resetDatabase().subscribe(); |
|
|
|
|
this.router.navigateByUrl(''); |
|
|
|
|
if(window.confirm('Êtes-vous sûr de vouloir recharger le BDD ? Cela peut prendre du temps !')){ |
|
|
|
|
this.isLoading = true; |
|
|
|
|
this.resetDataService.resetDatabase().subscribe( |
|
|
|
|
() => { |
|
|
|
|
//this.router.navigateByUrl('');
|
|
|
|
|
this.isLoading = false; |
|
|
|
|
}, |
|
|
|
|
(error: HttpErrorResponse) => { |
|
|
|
|
alert(error.message) |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|