mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	automatically refresh tasks on file socket messages too
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -85,23 +85,23 @@ | ||||
| </ng-template> | ||||
|  | ||||
| <ul ngbNav #nav="ngbNav" [(activeId)]="activeTab" class="nav-tabs"> | ||||
|   <li ngbNavItem="incomplete"> | ||||
|     <a ngbNavLink i18n>Incomplete <span class="badge bg-secondary ms-1">{{tasksService.incompleteFileTasks.length}}</span></a> | ||||
|     <ng-template ngbNavContent> | ||||
|       <ng-container [ngTemplateOutlet]="tasksTemplate" [ngTemplateOutletContext]="{tasks:tasksService.incompleteFileTasks}"></ng-container> | ||||
|     </ng-template> | ||||
|   </li> | ||||
|   <li ngbNavItem="completed"> | ||||
|     <a ngbNavLink i18n>Complete <span class="badge bg-secondary ms-1">{{tasksService.completedFileTasks.length}}</span></a> | ||||
|     <ng-template ngbNavContent> | ||||
|       <ng-container [ngTemplateOutlet]="tasksTemplate" [ngTemplateOutletContext]="{tasks:tasksService.completedFileTasks}"></ng-container> | ||||
|     </ng-template> | ||||
|   </li> | ||||
|   <li ngbNavItem="failed"> | ||||
|     <a ngbNavLink i18n>Failed <span class="badge bg-danger ms-1">{{tasksService.failedFileTasks.length}}</span></a> | ||||
|     <a ngbNavLink i18n>Failed <span *ngIf="tasksService.failedFileTasks.length > 0" class="badge bg-danger ms-1">{{tasksService.failedFileTasks.length}}</span></a> | ||||
|     <ng-template ngbNavContent> | ||||
|       <ng-container [ngTemplateOutlet]="tasksTemplate" [ngTemplateOutletContext]="{tasks:tasksService.failedFileTasks}"></ng-container> | ||||
|     </ng-template> | ||||
|   </li> | ||||
|   <li ngbNavItem="completed"> | ||||
|     <a ngbNavLink i18n>Complete <span *ngIf="tasksService.completedFileTasks.length > 0" class="badge bg-secondary ms-1">{{tasksService.completedFileTasks.length}}</span></a> | ||||
|     <ng-template ngbNavContent> | ||||
|       <ng-container [ngTemplateOutlet]="tasksTemplate" [ngTemplateOutletContext]="{tasks:tasksService.completedFileTasks}"></ng-container> | ||||
|     </ng-template> | ||||
|   </li> | ||||
|   <li ngbNavItem="incomplete"> | ||||
|     <a ngbNavLink i18n>Incomplete <span *ngIf="tasksService.incompleteFileTasks.length > 0" class="badge bg-secondary ms-1">{{tasksService.incompleteFileTasks.length}}</span></a> | ||||
|     <ng-template ngbNavContent> | ||||
|       <ng-container [ngTemplateOutlet]="tasksTemplate" [ngTemplateOutletContext]="{tasks:tasksService.incompleteFileTasks}"></ng-container> | ||||
|     </ng-template> | ||||
|   </li> | ||||
| </ul> | ||||
| <div [ngbNavOutlet]="nav"></div> | ||||
|   | ||||
| @@ -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() | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon