From f6506e80df1dd036534359aaeb9c2a2c934d96f4 Mon Sep 17 00:00:00 2001 From: "hamza.hramchi" <hamza.hramchi@xelians.fr> Date: Wed, 31 Mar 2021 12:11:29 +0200 Subject: [PATCH] FEAT #16648 TIME 0:10 refresh docs list after indexation --- .../app/indexation/indexation.component.ts | 4 +++- src/frontend/app/sidebar/sidebar.component.ts | 16 +++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/frontend/app/indexation/indexation.component.ts b/src/frontend/app/indexation/indexation.component.ts index 1a80cd0793..1f2e755458 100644 --- a/src/frontend/app/indexation/indexation.component.ts +++ b/src/frontend/app/indexation/indexation.component.ts @@ -178,7 +178,9 @@ export class IndexationComponent implements OnInit { const objTosend = this.formatData(data.note); for (let index = 0; index < objTosend.length; index++) { await this.saveDocument(objTosend[index], index); - this.actionsService.setEvent(objTosend[0].workflow); + if (objTosend[0].workflow[0].userId === this.authService.user.id) { + this.actionsService.setEvent('refreshList'); + } } load.dismiss(); if (this.errors.length === 0) { diff --git a/src/frontend/app/sidebar/sidebar.component.ts b/src/frontend/app/sidebar/sidebar.component.ts index e19f31dba2..99e83eeff6 100755 --- a/src/frontend/app/sidebar/sidebar.component.ts +++ b/src/frontend/app/sidebar/sidebar.component.ts @@ -28,7 +28,6 @@ export class SidebarComponent implements OnInit, AfterViewInit { loadingList: boolean = false; searchMode: boolean = false; - indexed: boolean = false; searchTerm: FormControl = new FormControl(); @@ -56,11 +55,10 @@ export class SidebarComponent implements OnInit, AfterViewInit { this.loadingList = false; }); - this.subscription = this.actionsService.catchEvent().subscribe((result: any[]) => { - let mode: any = result.filter((item: any) => item.userId === this.authService.user.id).map((el: any) => el.mode); - mode = [... new Set(mode)].toString(); - this.indexed = true; - this.filter(mode); + this.subscription = this.actionsService.catchEvent().subscribe((result: any) => { + if (result === 'refreshList') { + this.filter(''); + } }); } @@ -122,11 +120,7 @@ export class SidebarComponent implements OnInit, AfterViewInit { } this.loadingList = true; - if (this.indexed) { - this.signaturesService.mode = mode; - } else { - this.signaturesService.mode === mode ? this.signaturesService.mode = '' : this.signaturesService.mode = mode; - } + this.signaturesService.mode === mode ? this.signaturesService.mode = '' : this.signaturesService.mode = mode; this.filterService.offset = 0; this.http.get('../rest/documents?limit=' + this.filterService.limit + '&offset=' + this.filterService.offset + '&mode=' + this.signaturesService.mode) .pipe( -- GitLab