diff --git a/src/frontend/app/actions/actions.service.ts b/src/frontend/app/actions/actions.service.ts index b5383b3dc6baa25f27e2fd706fcf8be6705fa5af..42a1023e215b04580cf1588cdeb5918298ee57ab 100644 --- a/src/frontend/app/actions/actions.service.ts +++ b/src/frontend/app/actions/actions.service.ts @@ -314,11 +314,11 @@ export class ActionsService { } }); if (redirectAfterClose != '') { - this.router.navigate([redirectAfterClose]); + this.router.navigate([redirectAfterClose], { queryParams: {refresh: new Date().getTime()} }); } else if (firstGroup == 0) { this.router.navigate(['/home']); } else { - this.router.navigate(['/indexing/' + firstGroup]); + this.router.navigate(['/indexing/' + firstGroup], { queryParams: {refresh: new Date().getTime()} }); } }), finalize(() => this.loading = false), diff --git a/src/frontend/app/indexation/indexation.component.ts b/src/frontend/app/indexation/indexation.component.ts index 69173b0ae0510f7eef2d3eee437f990f83f18654..1d1f2a934225b2cb3e9dd717ee2f24499153e5dc 100644 --- a/src/frontend/app/indexation/indexation.component.ts +++ b/src/frontend/app/indexation/indexation.component.ts @@ -5,7 +5,7 @@ import { NotificationService } from '../notification.service'; import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatSidenav } from '@angular/material/sidenav'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute, Router, ParamMap } from '@angular/router'; import { HeaderService } from '../../service/header.service'; import { FiltersListService } from '../../service/filtersList.service'; @@ -85,8 +85,27 @@ export class IndexationComponent implements OnInit { } ngOnInit(): void { - this.loading = false; + // Use to clean data after navigate on same url + this._activatedRoute.queryParamMap.subscribe((paramMap: ParamMap) => { + const refresh = paramMap.get('refresh'); + if (refresh) { + this.appDocumentViewer.templateListForm.reset(); + this.appDocumentViewer.file = { + name: '', + type: '', + content: null, + src: null + }; + this.appDocumentViewer.triggerEvent.emit('cleanFile'); + this.loadIndexingModel(this.indexingModels[0]); + } + }); + this.fetchData(); + } + + fetchData() { + this.loading = false; this.headerService.setHeader("Enregistrement d'un courrier"); this.route.params.subscribe(params => {