mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Enhancement: display current ASN in statistics (#6692)
This commit is contained in:
		| @@ -15,6 +15,12 @@ | ||||
|         <ng-container i18n>Total characters</ng-container>: | ||||
|         <span class="badge bg-secondary text-light rounded-pill">{{statistics?.character_count | number}}</span> | ||||
|       </div> | ||||
|       @if (statistics?.current_asn) { | ||||
|         <div class="list-group-item d-flex justify-content-between align-items-center" routerLink="/documents/"> | ||||
|           <ng-container i18n>Current ASN</ng-container>: | ||||
|           <span class="badge bg-secondary text-light rounded-pill">{{statistics?.current_asn | number}}</span> | ||||
|         </div> | ||||
|       } | ||||
|       @if (statistics?.document_file_type_counts?.length > 1) { | ||||
|         <div class="list-group-item filetypes"> | ||||
|           <div class="d-flex justify-content-between align-items-center my-2"> | ||||
|   | ||||
| @@ -189,4 +189,38 @@ describe('StatisticsWidgetComponent', () => { | ||||
|       'Other(0.9%)' | ||||
|     ) | ||||
|   }) | ||||
|  | ||||
|   it('should display the current ASN', () => { | ||||
|     const mockStats = { | ||||
|       current_asn: 122, | ||||
|     } | ||||
|  | ||||
|     const req = httpTestingController.expectOne( | ||||
|       `${environment.apiBaseUrl}statistics/` | ||||
|     ) | ||||
|  | ||||
|     req.flush(mockStats) | ||||
|     fixture.detectChanges() | ||||
|  | ||||
|     expect(fixture.nativeElement.textContent.replace(/\s/g, '')).toContain( | ||||
|       'CurrentASN:122' | ||||
|     ) | ||||
|   }) | ||||
|  | ||||
|   it('should not display the current ASN if it is not available', () => { | ||||
|     const mockStats = { | ||||
|       current_asn: 0, | ||||
|     } | ||||
|  | ||||
|     const req = httpTestingController.expectOne( | ||||
|       `${environment.apiBaseUrl}statistics/` | ||||
|     ) | ||||
|  | ||||
|     req.flush(mockStats) | ||||
|     fixture.detectChanges() | ||||
|  | ||||
|     expect(fixture.nativeElement.textContent.replace(/\s/g, '')).not.toContain( | ||||
|       'CurrentASN:' | ||||
|     ) | ||||
|   }) | ||||
| }) | ||||
|   | ||||
| @@ -18,6 +18,7 @@ export interface Statistics { | ||||
|   correspondent_count?: number | ||||
|   document_type_count?: number | ||||
|   storage_path_count?: number | ||||
|   current_asn?: number | ||||
| } | ||||
|  | ||||
| interface DocumentFileType { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Daniel
					Daniel