diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-details/project-details.component.scss b/apps/red-ui/src/app/screens/project-overview-screen/project-details/project-details.component.scss index b8e66b45a..cb4f0bd9e 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-details/project-details.component.scss +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-details/project-details.component.scss @@ -5,6 +5,10 @@ flex-direction: row; position: relative; + .heading-xl { + max-width: 88%; + } + redaction-circle-button { position: absolute; top: -5px; diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts index c8554c986..7d3f65853 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts @@ -225,7 +225,7 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { @HostListener('drop', ['$event']) onDrop(event: DragEvent) { - handleFileDrop(event, this.appStateService.activeProjectId, this._uploadFiles.bind(this)); + handleFileDrop(event, this.appStateService.activeProject, this._uploadFiles.bind(this)); } @HostListener('dragover', ['$event']) @@ -235,7 +235,7 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { } async uploadFiles(files: File[] | FileList) { - await this._uploadFiles(convertFiles(files, this.appStateService.activeProjectId)); + await this._uploadFiles(convertFiles(files, this.appStateService.activeProject)); } private async _uploadFiles(files: FileUploadModel[]) { diff --git a/apps/red-ui/src/app/upload-download/file-drop/file-drop.component.ts b/apps/red-ui/src/app/upload-download/file-drop/file-drop.component.ts index fc2fa014e..af1ef5946 100644 --- a/apps/red-ui/src/app/upload-download/file-drop/file-drop.component.ts +++ b/apps/red-ui/src/app/upload-download/file-drop/file-drop.component.ts @@ -35,7 +35,7 @@ export class FileDropComponent implements OnInit { @HostListener('drop', ['$event']) onDrop(event: DragEvent) { - handleFileDrop(event, this._appStateService.activeProjectId, this.uploadFiles.bind(this)); + handleFileDrop(event, this._appStateService.activeProject, this.uploadFiles.bind(this)); } @HostListener('dragover', ['$event']) diff --git a/apps/red-ui/src/app/upload-download/file-upload.service.ts b/apps/red-ui/src/app/upload-download/file-upload.service.ts index 60b9bb18d..bf628c6aa 100644 --- a/apps/red-ui/src/app/upload-download/file-upload.service.ts +++ b/apps/red-ui/src/app/upload-download/file-upload.service.ts @@ -14,6 +14,7 @@ import { DialogService } from '../dialogs/dialog.service'; export class FileUploadService { static readonly MAX_PARALLEL_UPLOADS = 5; files: FileUploadModel[] = []; + groupedFiles: { [key: string]: FileUploadModel[] } = {}; activeUploads = 0; private _pendingUploads: FileUploadModel[] = []; @@ -73,13 +74,39 @@ export class FileUploadService { } this.files.push(...files); files.forEach((newFile) => { + this._addFileToGroup(newFile); this.scheduleUpload(newFile); }); return files.length; } + private _addFileToGroup(file: FileUploadModel) { + if (!this.groupedFiles[file.projectId]) { + this.groupedFiles[file.projectId] = []; + } + this.groupedFiles[file.projectId].push(file); + } + + public filterFiles() { + for (const file of this.files) { + if (file.completed && !file.error) { + this.removeFile(file); + } + } + } + + private _removeFileFromGroup(file: FileUploadModel) { + const index = this.groupedFiles[file.projectId].indexOf(file); + this.groupedFiles[file.projectId].splice(index, 1); + } + + public get activeProjectKeys() { + return Object.keys(this.groupedFiles).filter((projectId) => this.groupedFiles[projectId].length > 0); + } + stopAllUploads() { this.files = []; + this.groupedFiles = {}; } private _handleUploads() { @@ -143,6 +170,7 @@ export class FileUploadService { removeFile(item: FileUploadModel) { const index = this.files.indexOf(item); if (index > -1) { + this._removeFileFromGroup(item); this.files.splice(index, 1); } } diff --git a/apps/red-ui/src/app/upload-download/model/file-upload.model.ts b/apps/red-ui/src/app/upload-download/model/file-upload.model.ts index 750f92b02..bdf33a0f9 100644 --- a/apps/red-ui/src/app/upload-download/model/file-upload.model.ts +++ b/apps/red-ui/src/app/upload-download/model/file-upload.model.ts @@ -7,4 +7,5 @@ export interface FileUploadModel { size: number; sizeError: any; projectId?: string; + projectName?: string; } diff --git a/apps/red-ui/src/app/upload-download/upload-status-overlay/upload-status-overlay.component.html b/apps/red-ui/src/app/upload-download/upload-status-overlay/upload-status-overlay.component.html index f0975a2fd..ac06bfc03 100644 --- a/apps/red-ui/src/app/upload-download/upload-status-overlay/upload-status-overlay.component.html +++ b/apps/red-ui/src/app/upload-download/upload-status-overlay/upload-status-overlay.component.html @@ -15,46 +15,53 @@