This commit is contained in:
Timo Bejan 2020-11-11 11:12:57 +02:00
parent f3e7ed6b3b
commit b962f08301
4 changed files with 28 additions and 12 deletions

View File

@ -21,7 +21,6 @@ import { tap } from 'rxjs/operators';
import { NotificationService } from '../../../notification/notification.service';
import { TranslateService } from '@ngx-translate/core';
import { FileStatusWrapper } from '../model/file-status.wrapper';
import { MatTooltip } from '@angular/material/tooltip';
import { PermissionsService } from '../../../common/service/permissions.service';
const KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
@ -97,7 +96,7 @@ export class FilePreviewScreenComponent implements OnInit {
}
get canNotSwitchToRedactedView() {
return this.permissionsService.fileRequiresReanalysis();
return this.permissionsService.fileRequiresReanalysis() || !this.fileData?.redactedFileData;
}
ngOnInit(): void {
@ -367,7 +366,7 @@ export class FilePreviewScreenComponent implements OnInit {
}
}
private _cleanupAndRedrawManualAnnotations(singleAnnotation: AnnotationWrapper) {
private _cleanupAndRedrawManualAnnotations(singleAnnotation?: AnnotationWrapper) {
this._fileDownloadService.loadActiveFileManualAnnotations().subscribe((manualRedactions) => {
this.fileData.manualRedactions = manualRedactions;
this._rebuildFilters();

View File

@ -11,10 +11,11 @@ export interface AnnotationPair {
}
export class FileDataModel {
redactedFileData: Blob;
constructor(
public fileStatus: FileStatusWrapper,
public annotatedFileData: Blob,
public redactedFileData: Blob,
public redactionLog: RedactionLog,
public manualRedactions: ManualRedactions,
public viewedPages?: ViewedPages

View File

@ -32,11 +32,23 @@ export class AnnotationDrawService {
}
private _getColor(activeViewer: WebViewerInstance, annotationWrapper: AnnotationWrapper) {
const color =
annotationWrapper.superType === 'suggestion' || annotationWrapper.superType === 'suggestion-remove'
? this._appStateService.getDictionaryColor(annotationWrapper.superType)
: this._appStateService.getDictionaryColor(annotationWrapper.dictionary);
let color;
switch (annotationWrapper.superType) {
case 'suggestion':
case 'suggestion-remove':
color = annotationWrapper.modifyDictionary ? '#5B97DB' : this._appStateService.getDictionaryColor(annotationWrapper.superType);
break;
case 'hint':
case 'redaction':
color = this._appStateService.getDictionaryColor(annotationWrapper.dictionary);
break;
case 'ignore':
color = this._appStateService.getDictionaryColor('ignore');
break;
default:
color = this._appStateService.getDictionaryColor('default');
break;
}
const rgbColor = hexToRgb(color);
return new activeViewer.Annotations.Color(rgbColor.r, rgbColor.g, rgbColor.b);
}

View File

@ -31,7 +31,6 @@ export class FileDownloadService {
public loadActiveFileData(): Observable<FileDataModel> {
const annotatedObs = this.loadFile('ORIGINAL', this._appStateService.activeFileId);
const redactedObs = this.loadFile('REDACTED', this._appStateService.activeFileId);
const reactionLogObs = this._redactionLogControllerService.getRedactionLog(this._appStateService.activeFileId);
const manualRedactionsObs = this._manualRedactionControllerService.getManualRedaction(
this._appStateService.activeProjectId,
@ -39,8 +38,13 @@ export class FileDownloadService {
);
const viewedPagesObs = this.getViewedPagesForActiveFile();
return forkJoin([annotatedObs, redactedObs, reactionLogObs, manualRedactionsObs, viewedPagesObs]).pipe(
map((data) => new FileDataModel(this._appStateService.activeFile, ...data))
return forkJoin([annotatedObs, reactionLogObs, manualRedactionsObs, viewedPagesObs]).pipe(
map((data) => {
const fileData = new FileDataModel(this._appStateService.activeFile, ...data);
// lazy load redacted data
this.loadFile('REDACTED', this._appStateService.activeFileId).subscribe((redactedFileData) => (fileData.redactedFileData = redactedFileData));
return fileData;
})
);
}