mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	post-merge changes
This commit is contained in:
		| @@ -45,6 +45,7 @@ import { SavedViewWidgetComponent } from './components/dashboard/widgets/saved-v | ||||
| import { StatisticsWidgetComponent } from './components/dashboard/widgets/statistics-widget/statistics-widget.component'; | ||||
| import { UploadFileWidgetComponent } from './components/dashboard/widgets/upload-file-widget/upload-file-widget.component'; | ||||
| import { WidgetFrameComponent } from './components/dashboard/widgets/widget-frame/widget-frame.component'; | ||||
| import { ConsumerStatusWidgetComponent } from './components/dashboard/widgets/consumer-status-widget/consumer-status-widget.component'; | ||||
|  | ||||
| @NgModule({ | ||||
|   declarations: [ | ||||
| @@ -82,6 +83,7 @@ import { WidgetFrameComponent } from './components/dashboard/widgets/widget-fram | ||||
|     SavedViewWidgetComponent, | ||||
|     StatisticsWidgetComponent, | ||||
|     UploadFileWidgetComponent, | ||||
|     ConsumerStatusWidgetComponent, | ||||
|     WidgetFrameComponent | ||||
|   ], | ||||
|   imports: [ | ||||
|   | ||||
| @@ -1,10 +1,10 @@ | ||||
| <h4 class="mt-3">Document consumer status</h4> | ||||
|  | ||||
| <div class="mb-2 border-bottom" *ngFor="let s of getStatus()"> | ||||
|   <div class="mb-1"><strong>{{s.filename}}:</strong> {{s.message}}</div> | ||||
|   <ngb-progressbar [type]="getType(s.status)" [value]="s.current_progress" [max]="s.max_progress" class="mb-2"></ngb-progressbar> | ||||
|   <div *ngIf="isFinished(s)" class="mb-2"> | ||||
|     <button *ngIf="s.document_id" class="btn btn-sm btn-outline-primary mr-2" routerLink="/documents/{{s.document_id}}" (click)="dismiss(s)">Open document</button> | ||||
|     <button class="btn btn-sm btn-outline-secondary" (click)="dismiss(s)">Dismiss</button> | ||||
| <app-widget-frame title="Document consumer status"> | ||||
|   <div class="mb-2 border-bottom" *ngFor="let s of getStatus()"> | ||||
|     <div class="mb-1"><strong>{{s.filename}}:</strong> {{s.message}}</div> | ||||
|     <ngb-progressbar [type]="getType(s.status)" [value]="s.current_progress" [max]="s.max_progress" class="mb-2"></ngb-progressbar> | ||||
|     <div *ngIf="isFinished(s)" class="mb-2"> | ||||
|       <button *ngIf="s.document_id" class="btn btn-sm btn-outline-primary mr-2" routerLink="/documents/{{s.document_id}}" (click)="dismiss(s)">Open document</button> | ||||
|       <button class="btn btn-sm btn-outline-secondary" (click)="dismiss(s)">Dismiss</button> | ||||
|     </div> | ||||
|   </div> | ||||
| </div> | ||||
| </app-widget-frame> | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import { ConsumerStatusService, FileStatus } from 'src/app/services/consumer-sta | ||||
| @Component({ | ||||
|   selector: 'app-consumer-status-widget', | ||||
|   templateUrl: './consumer-status-widget.component.html', | ||||
|   styleUrls: ['./consumer-status-widget.component.css'] | ||||
|   styleUrls: ['./consumer-status-widget.component.scss'] | ||||
| }) | ||||
| export class ConsumerStatusWidgetComponent implements OnInit { | ||||
|  | ||||
|   | ||||
| @@ -1,11 +0,0 @@ | ||||
| <h4>Upload new Document</h4> | ||||
| <form> | ||||
|   <ngx-file-drop | ||||
|     dropZoneLabel="Drop documents here" | ||||
|     (onFileDrop)="dropped($event)" | ||||
|     (onFileOver)="fileOver($event)" | ||||
|     (onFileLeave)="fileLeave($event)" | ||||
|     dropZoneClassName="bg-light mt-4 card"> | ||||
|  | ||||
|   </ngx-file-drop> | ||||
| </form> | ||||
| @@ -1,25 +0,0 @@ | ||||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||||
|  | ||||
| import { FileUploadWidgetComponent } from './file-upload-widget.component'; | ||||
|  | ||||
| describe('FileUploadWidgetComponent', () => { | ||||
|   let component: FileUploadWidgetComponent; | ||||
|   let fixture: ComponentFixture<FileUploadWidgetComponent>; | ||||
|  | ||||
|   beforeEach(async () => { | ||||
|     await TestBed.configureTestingModule({ | ||||
|       declarations: [ FileUploadWidgetComponent ] | ||||
|     }) | ||||
|     .compileComponents(); | ||||
|   }); | ||||
|  | ||||
|   beforeEach(() => { | ||||
|     fixture = TestBed.createComponent(FileUploadWidgetComponent); | ||||
|     component = fixture.componentInstance; | ||||
|     fixture.detectChanges(); | ||||
|   }); | ||||
|  | ||||
|   it('should create', () => { | ||||
|     expect(component).toBeTruthy(); | ||||
|   }); | ||||
| }); | ||||
| @@ -1,44 +0,0 @@ | ||||
| import { Component, OnInit } from '@angular/core'; | ||||
| import { FileSystemFileEntry, NgxFileDropEntry } from 'ngx-file-drop'; | ||||
| import { DocumentService } from 'src/app/services/rest/document.service'; | ||||
| import { ToastService } from 'src/app/services/toast.service'; | ||||
|  | ||||
| @Component({ | ||||
|   selector: 'app-file-upload-widget', | ||||
|   templateUrl: './file-upload-widget.component.html', | ||||
|   styleUrls: ['./file-upload-widget.component.css'] | ||||
| }) | ||||
| export class FileUploadWidgetComponent implements OnInit { | ||||
|  | ||||
|   constructor(private documentService: DocumentService, private toastService: ToastService) { } | ||||
|  | ||||
|   ngOnInit(): void { | ||||
|   } | ||||
|  | ||||
|   public fileOver(event){ | ||||
|     console.log(event); | ||||
|   } | ||||
|   | ||||
|   public fileLeave(event){ | ||||
|     console.log(event); | ||||
|   } | ||||
|   | ||||
|   public dropped(files: NgxFileDropEntry[]) { | ||||
|     for (const droppedFile of files) { | ||||
|       if (droppedFile.fileEntry.isFile) { | ||||
|         const fileEntry = droppedFile.fileEntry as FileSystemFileEntry; | ||||
|         console.log(fileEntry) | ||||
|         fileEntry.file((file: File) => { | ||||
|           console.log(file) | ||||
|           const formData = new FormData() | ||||
|           formData.append('document', file, file.name) | ||||
|           this.documentService.uploadDocument(formData).subscribe(result => { | ||||
|             this.toastService.showInfo("The document has been uploaded and will be processed by the consumer shortly.") | ||||
|           }, error => { | ||||
|             this.toastService.showError("An error has occured while uploading the document. Sorry!") | ||||
|           }) | ||||
|         }); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -33,9 +33,9 @@ export class UploadFileWidgetComponent implements OnInit { | ||||
|           const formData = new FormData() | ||||
|           formData.append('document', file, file.name) | ||||
|           this.documentService.uploadDocument(formData).subscribe(result => { | ||||
|             this.toastService.showToast(Toast.make("Information", "The document has been uploaded and will be processed by the consumer shortly.")) | ||||
|             this.toastService.showInfo("The document has been uploaded and will be processed by the consumer shortly.") | ||||
|           }, error => { | ||||
|             this.toastService.showToast(Toast.makeError("An error has occured while uploading the document. Sorry!")) | ||||
|             this.toastService.showError("An error has occured while uploading the document. Sorry!") | ||||
|           }) | ||||
|         }); | ||||
|       } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jonas Winkler
					Jonas Winkler