mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	added a status summary line
This commit is contained in:
		| @@ -1414,25 +1414,46 @@ | |||||||
|           <context context-type="linenumber">4</context> |           <context context-type="linenumber">4</context> | ||||||
|         </context-group> |         </context-group> | ||||||
|       </trans-unit> |       </trans-unit> | ||||||
|  |       <trans-unit id="6443586946875325554" datatype="html"> | ||||||
|  |         <source>Processing: <x id="PH" equiv-text="countUploadingAndProcessing"/></source> | ||||||
|  |         <context-group purpose="location"> | ||||||
|  |           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts</context> | ||||||
|  |           <context context-type="linenumber">32</context> | ||||||
|  |         </context-group> | ||||||
|  |       </trans-unit> | ||||||
|  |       <trans-unit id="9182918211699394982" datatype="html"> | ||||||
|  |         <source>Failed: <x id="PH" equiv-text="countFailed"/></source> | ||||||
|  |         <context-group purpose="location"> | ||||||
|  |           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts</context> | ||||||
|  |           <context context-type="linenumber">35</context> | ||||||
|  |         </context-group> | ||||||
|  |       </trans-unit> | ||||||
|  |       <trans-unit id="534116346205124059" datatype="html"> | ||||||
|  |         <source>Added: <x id="PH" equiv-text="countSuccess"/></source> | ||||||
|  |         <context-group purpose="location"> | ||||||
|  |           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts</context> | ||||||
|  |           <context context-type="linenumber">38</context> | ||||||
|  |         </context-group> | ||||||
|  |       </trans-unit> | ||||||
|       <trans-unit id="3852289441366561594" datatype="html"> |       <trans-unit id="3852289441366561594" datatype="html"> | ||||||
|         <source>Connecting...</source> |         <source>Connecting...</source> | ||||||
|         <context-group purpose="location"> |         <context-group purpose="location"> | ||||||
|           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts</context> |           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts</context> | ||||||
|           <context context-type="linenumber">93</context> |           <context context-type="linenumber">118</context> | ||||||
|         </context-group> |         </context-group> | ||||||
|       </trans-unit> |       </trans-unit> | ||||||
|       <trans-unit id="1245343823699368872" datatype="html"> |       <trans-unit id="1245343823699368872" datatype="html"> | ||||||
|         <source>Uploading...</source> |         <source>Uploading...</source> | ||||||
|         <context-group purpose="location"> |         <context-group purpose="location"> | ||||||
|           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts</context> |           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts</context> | ||||||
|           <context context-type="linenumber">98</context> |           <context context-type="linenumber">123</context> | ||||||
|         </context-group> |         </context-group> | ||||||
|       </trans-unit> |       </trans-unit> | ||||||
|       <trans-unit id="3994065460580948013" datatype="html"> |       <trans-unit id="3994065460580948013" datatype="html"> | ||||||
|         <source>Waiting for consumer...</source> |         <source>Waiting for consumer...</source> | ||||||
|         <context-group purpose="location"> |         <context-group purpose="location"> | ||||||
|           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts</context> |           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts</context> | ||||||
|           <context context-type="linenumber">101</context> |           <context context-type="linenumber">126</context> | ||||||
|         </context-group> |         </context-group> | ||||||
|       </trans-unit> |       </trans-unit> | ||||||
|       <trans-unit id="e022072b3e4dd77e3f09960817ef3359a49963b3" datatype="html"> |       <trans-unit id="e022072b3e4dd77e3f09960817ef3359a49963b3" datatype="html"> | ||||||
| @@ -1463,18 +1484,18 @@ | |||||||
|           <context context-type="linenumber">4</context> |           <context context-type="linenumber">4</context> | ||||||
|         </context-group> |         </context-group> | ||||||
|       </trans-unit> |       </trans-unit> | ||||||
|       <trans-unit id="7cf3abd55bf1d2095435a050325927f083e6034e" datatype="html"> |       <trans-unit id="1fc4e0a1e93fdda0ed3c9e590971d283afb68265" datatype="html"> | ||||||
|         <source><x id="INTERPOLATION" equiv-text="{{getStatusesHidden().length}}"/> more hidden</source> |         <source><x id="INTERPOLATION" equiv-text="{{getStatusHidden().length}}"/> more hidden</source> | ||||||
|         <context-group purpose="location"> |         <context-group purpose="location"> | ||||||
|           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html</context> |           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html</context> | ||||||
|           <context context-type="linenumber">23</context> |           <context context-type="linenumber">24</context> | ||||||
|         </context-group> |         </context-group> | ||||||
|       </trans-unit> |       </trans-unit> | ||||||
|       <trans-unit id="710254a196a2649674438edf8a15b7ab1f48271b" datatype="html"> |       <trans-unit id="710254a196a2649674438edf8a15b7ab1f48271b" datatype="html"> | ||||||
|         <source>Open document</source> |         <source>Open document</source> | ||||||
|         <context-group purpose="location"> |         <context-group purpose="location"> | ||||||
|           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html</context> |           <context context-type="sourcefile">src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html</context> | ||||||
|           <context context-type="linenumber">40</context> |           <context context-type="linenumber">41</context> | ||||||
|         </context-group> |         </context-group> | ||||||
|       </trans-unit> |       </trans-unit> | ||||||
|       <trans-unit id="45854ddec74086b271e62be6a363f4fa5036f7fc" datatype="html"> |       <trans-unit id="45854ddec74086b271e62be6a363f4fa5036f7fc" datatype="html"> | ||||||
|   | |||||||
| @@ -12,17 +12,18 @@ | |||||||
|     <form> |     <form> | ||||||
|       <ngx-file-drop dropZoneLabel="Drop documents here or" browseBtnLabel="Browse files" (onFileDrop)="dropped($event)" |       <ngx-file-drop dropZoneLabel="Drop documents here or" browseBtnLabel="Browse files" (onFileDrop)="dropped($event)" | ||||||
|         (onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)" dropZoneClassName="bg-light card" |         (onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)" dropZoneClassName="bg-light card" | ||||||
|         multiple="true" contentClassName="justify-content-center d-flex align-items-center p-5" [showBrowseBtn]=true |         multiple="true" contentClassName="justify-content-center d-flex align-items-center py-5 px-2" [showBrowseBtn]=true | ||||||
|         browseBtnClassName="btn btn-sm btn-outline-primary ml-2" i18n-dropZoneLabel i18n-browseBtnLabel> |         browseBtnClassName="btn btn-sm btn-outline-primary ml-2" i18n-dropZoneLabel i18n-browseBtnLabel> | ||||||
|       </ngx-file-drop> |       </ngx-file-drop> | ||||||
|     </form> |     </form> | ||||||
|  |     <p class="mt-3" *ngIf="getStatus().length > 0">{{getStatusSummary()}}</p> | ||||||
|     <div *ngFor="let status of getStatus()"> |     <div *ngFor="let status of getStatus()"> | ||||||
|       <ng-container [ngTemplateOutlet]="consumerAlert" [ngTemplateOutletContext]="{ $implicit: status }"></ng-container> |       <ng-container [ngTemplateOutlet]="consumerAlert" [ngTemplateOutletContext]="{ $implicit: status }"></ng-container> | ||||||
|     </div> |     </div> | ||||||
|     <div *ngIf="getStatusesHidden().length" class="alerts-hidden"> |     <div *ngIf="getStatusHidden().length" class="alerts-hidden"> | ||||||
|       <p *ngIf="!alertsExpanded" class="mt-3 mb-0 text-center"><span i18n>{{getStatusesHidden().length}} more hidden</span> <button class="btn btn-sm btn-link py-0" (click)="alertsExpanded = !alertsExpanded" aria-controls="hiddenAlerts" [attr.aria-expanded]="alertsExpanded" i18n>Show all</button></p> |       <p *ngIf="!alertsExpanded" class="mt-3 mb-0 text-center"><span i18n>{{getStatusHidden().length}} more hidden</span> <button class="btn btn-sm btn-link py-0" (click)="alertsExpanded = !alertsExpanded" aria-controls="hiddenAlerts" [attr.aria-expanded]="alertsExpanded" i18n>Show all</button></p> | ||||||
|       <div #hiddenAlerts="ngbCollapse" [(ngbCollapse)]="!alertsExpanded"> |       <div #hiddenAlerts="ngbCollapse" [(ngbCollapse)]="!alertsExpanded"> | ||||||
|         <div *ngFor="let status of getStatusesHidden()"> |         <div *ngFor="let status of getStatusHidden()"> | ||||||
|           <ng-container [ngTemplateOutlet]="consumerAlert" [ngTemplateOutletContext]="{ $implicit: status }"></ng-container> |           <ng-container [ngTemplateOutlet]="consumerAlert" [ngTemplateOutletContext]="{ $implicit: status }"></ng-container> | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|   | |||||||
| @@ -23,7 +23,24 @@ export class UploadFileWidgetComponent implements OnInit { | |||||||
|     return this.consumerStatusService.getConsumerStatus().slice(0, MAX_ALERTS) |     return this.consumerStatusService.getConsumerStatus().slice(0, MAX_ALERTS) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   getStatusesHidden() { |   getStatusSummary() { | ||||||
|  |     let strings = [] | ||||||
|  |     let countUploadingAndProcessing =  this.consumerStatusService.getConsumerStatusNotCompleted().length | ||||||
|  |     let countFailed = this.getStatusFailed().length | ||||||
|  |     let countSuccess = this.getStatusSuccess().length | ||||||
|  |     if (countUploadingAndProcessing > 0) { | ||||||
|  |       strings.push($localize`Processing: ${countUploadingAndProcessing}`) | ||||||
|  |     } | ||||||
|  |     if (countFailed > 0) { | ||||||
|  |       strings.push($localize`Failed: ${countFailed}`) | ||||||
|  |     } | ||||||
|  |     if (countSuccess > 0) { | ||||||
|  |       strings.push($localize`Added: ${countSuccess}`) | ||||||
|  |     } | ||||||
|  |     return strings.join($localize`:this string is used to separate processing, failed and added on the file upload widget:, `) | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   getStatusHidden() { | ||||||
|     if (this.consumerStatusService.getConsumerStatus().length < MAX_ALERTS) return [] |     if (this.consumerStatusService.getConsumerStatus().length < MAX_ALERTS) return [] | ||||||
|     else return this.consumerStatusService.getConsumerStatus().slice(MAX_ALERTS) |     else return this.consumerStatusService.getConsumerStatus().slice(MAX_ALERTS) | ||||||
|   } |   } | ||||||
| @@ -32,6 +49,14 @@ export class UploadFileWidgetComponent implements OnInit { | |||||||
|     return this.consumerStatusService.getConsumerStatus(FileStatusPhase.UPLOADING) |     return this.consumerStatusService.getConsumerStatus(FileStatusPhase.UPLOADING) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   getStatusFailed() { | ||||||
|  |     return this.consumerStatusService.getConsumerStatus(FileStatusPhase.FAILED) | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   getStatusSuccess() { | ||||||
|  |     return this.consumerStatusService.getConsumerStatus(FileStatusPhase.SUCCESS) | ||||||
|  |   } | ||||||
|  |  | ||||||
|   getStatusCompleted() { |   getStatusCompleted() { | ||||||
|     return this.consumerStatusService.getConsumerStatusCompleted() |     return this.consumerStatusService.getConsumerStatusCompleted() | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -90,13 +90,17 @@ export class ConsumerStatusService { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   getConsumerStatus(phase?: FileStatusPhase) { |   getConsumerStatus(phase?: FileStatusPhase) { | ||||||
|     if (phase) { |     if (phase != null) { | ||||||
|       return this.consumerStatus.filter(s => s.phase == phase) |       return this.consumerStatus.filter(s => s.phase == phase) | ||||||
|     } else { |     } else { | ||||||
|       return this.consumerStatus |       return this.consumerStatus | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   getConsumerStatusNotCompleted() { | ||||||
|  |     return this.consumerStatus.filter(s => s.phase < FileStatusPhase.SUCCESS) | ||||||
|  |   } | ||||||
|  |  | ||||||
|   getConsumerStatusCompleted() { |   getConsumerStatusCompleted() { | ||||||
|     return this.consumerStatus.filter(s => s.phase == FileStatusPhase.FAILED || s.phase == FileStatusPhase.SUCCESS) |     return this.consumerStatus.filter(s => s.phase == FileStatusPhase.FAILED || s.phase == FileStatusPhase.SUCCESS) | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler