fixed bugs
This commit is contained in:
parent
d7d07380b3
commit
a13317d839
@ -19,7 +19,7 @@
|
||||
<div class="red-input-group required w-400" *ngIf="!isDictionaryRequest">
|
||||
<label translate="manual-annotation.dialog.content.reason"></label>
|
||||
<mat-select formControlName="reason" class="full-width" [placeholder]="'manual-annotation.dialog.content.reason-placeholder' | translate">
|
||||
<mat-option *ngFor="let option of legalOptions" [value]="option" [matTooltip]="option.description">
|
||||
<mat-option *ngFor="let option of legalOptions" [value]="option" [matTooltip]="option.description" matTooltipPosition="after">
|
||||
{{ option.label }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
||||
@ -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'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user