diff --git a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html index d6004e929..392827321 100644 --- a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html +++ b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html @@ -19,7 +19,7 @@
- + {{ option.label }} diff --git a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts index 6550239ee..382623e6f 100644 --- a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts @@ -182,7 +182,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { 'rotateClockwiseButton', 'rotateCounterClockwiseButton', 'annotationStyleEditButton', - 'annotationGroupButton1' + 'annotationGroupButton' ]); this.instance.setHeaderItems((header) => { @@ -330,15 +330,23 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { } private _handleCustomActions() { + this.instance.setToolMode('AnnotationEdit'); if (this.canPerformActions) { this.instance.enableTools(['AnnotationCreateRectangle']); - this.instance.enableElements(['add-redaction', 'add-rectangle', 'add-false-positive', 'shapeToolGroupButton']); + this.instance.enableElements(['add-redaction', 'add-rectangle', 'add-false-positive', 'shapeToolGroupButton', 'annotationPopup']); if (this._selectedText.length > 2) { this.instance.enableElements(['add-dictionary', 'add-false-positive']); } } else { this.instance.disableTools(['AnnotationCreateRectangle']); - this.instance.disableElements(['add-redaction', 'add-dictionary', 'add-false-positive', 'add-rectangle', 'shapeToolGroupButton']); + this.instance.disableElements([ + 'add-redaction', + 'add-dictionary', + 'add-false-positive', + 'add-rectangle', + 'shapeToolGroupButton', + 'annotationPopup' + ]); } } 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 bf628c6aa..0bc4fc6ca 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 @@ -8,6 +8,11 @@ import { AppConfigKey, AppConfigService } from '../app-config/app-config.service import { TranslateService } from '@ngx-translate/core'; import { DialogService } from '../dialogs/dialog.service'; +export interface ActiveUpload { + subscription: Subscription; + fileUploadModel: FileUploadModel; +} + @Injectable({ providedIn: 'root' }) @@ -18,7 +23,7 @@ export class FileUploadService { activeUploads = 0; private _pendingUploads: FileUploadModel[] = []; - private _activeUploads: Subscription[] = []; + private _activeUploads: ActiveUpload[] = []; constructor( private readonly _appStateService: AppStateService, @@ -114,10 +119,10 @@ export class FileUploadService { let cnt = FileUploadService.MAX_PARALLEL_UPLOADS - this._activeUploads.length; while (cnt > 0) { cnt--; - const popped = this._pendingUploads.shift(); - if (popped) { - const sub = this._createSubscription(popped); - this._activeUploads.push(sub); + const poppedFileUploadModel = this._pendingUploads.shift(); + if (poppedFileUploadModel) { + const subscription = this._createSubscription(poppedFileUploadModel); + this._activeUploads.push({ subscription: subscription, fileUploadModel: poppedFileUploadModel }); } else { return; } @@ -142,14 +147,14 @@ export class FileUploadService { uploadFile.completed = true; uploadFile.error = { message: this._translateService.instant('upload-status.error.generic') }; } - this._removeUpload(subscription); + this._removeUpload(uploadFile); await this._appStateService.reloadActiveProjectFiles(); } }, - (error) => { + () => { uploadFile.completed = true; uploadFile.error = { message: this._translateService.instant('upload-status.error.generic') }; - this._removeUpload(subscription); + this._removeUpload(uploadFile); if (uploadFile.retryCount < 5) { uploadFile.retryCount += 1; this.scheduleUpload(uploadFile); @@ -159,19 +164,27 @@ export class FileUploadService { return subscription; } - private _removeUpload(subscription: Subscription) { - const index = this._activeUploads.indexOf(subscription); - if (index > -1) { - this._activeUploads.splice(index, 1); - this.activeUploads--; - } - } - removeFile(item: FileUploadModel) { + this._removeUpload(item); + const index = this.files.indexOf(item); if (index > -1) { this._removeFileFromGroup(item); this.files.splice(index, 1); } } + + private _removeUpload(fileUploadModel: FileUploadModel) { + const index = this._activeUploads.findIndex((au) => au.fileUploadModel === fileUploadModel); + if (index > -1) { + const subscription = this._activeUploads[index].subscription; + if (subscription) { + try { + subscription.unsubscribe(); + } catch (e) {} + } + this._activeUploads.splice(index, 1); + this.activeUploads--; + } + } }