From d4a5376f731d534f97d500c8353407293f57f61f Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 26 May 2022 23:20:57 -0700 Subject: [PATCH] automatically refresh tasks on file socket messages too --- src-ui/src/app/app.component.ts | 7 ++++- .../manage/tasks/tasks.component.html | 26 +++++++++---------- .../manage/tasks/tasks.component.ts | 4 ++- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src-ui/src/app/app.component.ts b/src-ui/src/app/app.component.ts index c7954e3a6..b1ba49c3a 100644 --- a/src-ui/src/app/app.component.ts +++ b/src-ui/src/app/app.component.ts @@ -7,6 +7,7 @@ import { ConsumerStatusService } from './services/consumer-status.service' import { ToastService } from './services/toast.service' import { NgxFileDropEntry } from 'ngx-file-drop' import { UploadDocumentsService } from './services/upload-documents.service' +import { TasksService } from './services/tasks.service' @Component({ selector: 'app-root', @@ -27,7 +28,8 @@ export class AppComponent implements OnInit, OnDestroy { private consumerStatusService: ConsumerStatusService, private toastService: ToastService, private router: Router, - private uploadDocumentsService: UploadDocumentsService + private uploadDocumentsService: UploadDocumentsService, + private tasksService: TasksService ) { let anyWindow = window as any anyWindow.pdfWorkerSrc = 'assets/js/pdf.worker.min.js' @@ -65,6 +67,7 @@ export class AppComponent implements OnInit, OnDestroy { this.successSubscription = this.consumerStatusService .onDocumentConsumptionFinished() .subscribe((status) => { + this.tasksService.reload() if ( this.showNotification(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_SUCCESS) ) { @@ -83,6 +86,7 @@ export class AppComponent implements OnInit, OnDestroy { this.failedSubscription = this.consumerStatusService .onDocumentConsumptionFailed() .subscribe((status) => { + this.tasksService.reload() if ( this.showNotification(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_FAILED) ) { @@ -95,6 +99,7 @@ export class AppComponent implements OnInit, OnDestroy { this.newDocumentSubscription = this.consumerStatusService .onDocumentDetected() .subscribe((status) => { + this.tasksService.reload() if ( this.showNotification( SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_NEW_DOCUMENT diff --git a/src-ui/src/app/components/manage/tasks/tasks.component.html b/src-ui/src/app/components/manage/tasks/tasks.component.html index cc17b289d..646781108 100644 --- a/src-ui/src/app/components/manage/tasks/tasks.component.html +++ b/src-ui/src/app/components/manage/tasks/tasks.component.html @@ -85,23 +85,23 @@
diff --git a/src-ui/src/app/components/manage/tasks/tasks.component.ts b/src-ui/src/app/components/manage/tasks/tasks.component.ts index 864df9e95..4c4bfc090 100644 --- a/src-ui/src/app/components/manage/tasks/tasks.component.ts +++ b/src-ui/src/app/components/manage/tasks/tasks.component.ts @@ -55,9 +55,11 @@ export class TasksComponent implements OnInit, OnDestroy { modal.componentInstance.buttonsEnabled = false modal.close() this.tasksService.dismissTasks(tasks) + this.selectedTasks.clear() }) } else { this.tasksService.dismissTasks(tasks) + this.selectedTasks.clear() } } @@ -94,6 +96,6 @@ export class TasksComponent implements OnInit, OnDestroy { } clearSelection() { - this.selectedTasks = new Set() + this.selectedTasks.clear() } }