From 1adb4f72e47d2a547c1e3f962a11a32d53f3b2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Tue, 12 Jan 2021 13:41:13 +0200 Subject: [PATCH] Added success/error notification for project reanalysis --- .../project-overview-screen.component.ts | 20 +++++++++++++++++-- apps/red-ui/src/assets/i18n/en.json | 4 ++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts index bf8d37810..ba2cb8055 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectorRef, Component, HostListener, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { NotificationService } from '../../notification/notification.service'; +import { NotificationService, NotificationType } from '../../notification/notification.service'; import { AppStateService } from '../../state/app-state.service'; import { FileDropOverlayService } from '../../upload/file-drop/service/file-drop-overlay.service'; import { FileUploadModel } from '../../upload/model/file-upload.model'; @@ -114,7 +114,23 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { } public reanalyseProject() { - return this.appStateService.reanalyzeProject().then(() => this.reloadProjects()); + return this.appStateService + .reanalyzeProject() + .then(() => { + this.reloadProjects(); + this._notificationService.showToastNotification( + this._translateService.instant('project-overview.reanalyse-project.success'), + null, + NotificationType.SUCCESS + ); + }) + .catch(() => { + this._notificationService.showToastNotification( + this._translateService.instant('project-overview.reanalyse-project.error'), + null, + NotificationType.ERROR + ); + }); } public isPending(fileStatusWrapper: FileStatusWrapper) { diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index d546729e5..3bacef518 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -260,6 +260,10 @@ "assign": "Assign Reviewer", "reanalyse": "Analyze Documents", "reanalyse-error-outdated": "Not all selected documents can be analyzed, some may not be assigned to you or are already analyzed." + }, + "reanalyse-project": { + "success": "Files scheduled for reanalysis.", + "error": "Failed to schedule files for reanalysis. Please try again." } }, "file-preview": {