From 09efd199b337904c97282bc6aff7c4bce3ec5fa0 Mon Sep 17 00:00:00 2001 From: Alex Orluc <alex.orluc@maarch.org> Date: Wed, 15 Jan 2020 20:07:53 +0100 Subject: [PATCH] FEAT #10633 TIME 0:30 load badges --- .../attachments/attachments-list.component.ts | 2 ++ src/frontend/app/process/process.component.ts | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/frontend/app/attachments/attachments-list.component.ts b/src/frontend/app/attachments/attachments-list.component.ts index 25f63bb52be..f94f3d03a8b 100644 --- a/src/frontend/app/attachments/attachments-list.component.ts +++ b/src/frontend/app/attachments/attachments-list.component.ts @@ -190,6 +190,7 @@ export class AttachmentsListComponent implements OnInit { filter((data: string) => data === 'success'), tap(() => { this.loadAttachments(this.resId); + this.afterActionAttachment.emit('setInSendAttachment'); }), catchError((err: any) => { this.notify.handleErrors(err); @@ -206,6 +207,7 @@ export class AttachmentsListComponent implements OnInit { exhaustMap(() => this.http.delete(`../../rest/attachments/${attachment.resId}`)), tap(() => { this.loadAttachments(this.resId); + this.afterActionAttachment.emit('setInSendAttachment'); this.notify.success(this.lang.attachmentDeleted); }), catchError((err: any) => { diff --git a/src/frontend/app/process/process.component.ts b/src/frontend/app/process/process.component.ts index fe21410da07..f6d81b3f386 100755 --- a/src/frontend/app/process/process.component.ts +++ b/src/frontend/app/process/process.component.ts @@ -187,7 +187,7 @@ export class ProcessComponent implements OnInit { }; this.lockResource(); - + this.loadBadges(); this.loadResource(); this.http.get(`../../rest/resources/${this.currentResourceInformations.resId}/users/${this.currentUserId}/groups/${this.currentGroupId}/baskets/${this.currentBasketId}/processingData`).pipe( @@ -239,7 +239,6 @@ export class ProcessComponent implements OnInit { tap((data: any) => { this.currentResourceInformations = data; this.resourceFollowed = data.followed; - this.loadBadges(); this.loadSenders(); this.headerService.setHeader(this.lang.eventProcessDoc, this.lang[this.currentResourceInformations.categoryId]); }), @@ -252,9 +251,17 @@ export class ProcessComponent implements OnInit { } loadBadges() { - this.processTool.forEach(element => { - element.count = this.currentResourceInformations[element.id] !== undefined ? this.currentResourceInformations[element.id] : 0; - }); + this.http.get(`../../rest/resources/${this.currentResourceInformations.resId}/items`).pipe( + tap((data: any) => { + this.processTool.forEach(element => { + element.count = data[element.id] !== undefined ? data[element.id] : 0; + }); + }), + catchError((err: any) => { + this.notify.handleSoftErrors(err); + return of(false); + }) + ).subscribe(); } loadSenders() { @@ -520,14 +527,17 @@ export class ProcessComponent implements OnInit { async saveTool() { if (this.currentTool === 'info' && this.indexingForm !== undefined) { await this.indexingForm.saveData(this.currentUserId, this.currentGroupId, this.currentBasketId); + this.loadResource(); } else if (this.currentTool === 'diffusionList' && this.appDiffusionsList !== undefined) { await this.appDiffusionsList.saveListinstance(); + this.loadBadges(); } else if (this.currentTool === 'visaCircuit' && this.appVisaWorkflow !== undefined) { await this.appVisaWorkflow.saveVisaWorkflow(); + this.loadBadges(); } else if (this.currentTool === 'opinionCircuit' && this.appAvisWorkflow !== undefined) { await this.appAvisWorkflow.saveAvisWorkflow(); + this.loadBadges(); } - this.loadResource(); } empty(value: string) { -- GitLab