cleanup and i18n

This commit is contained in:
Timo Bejan 2022-01-11 17:23:08 +02:00
parent f31917cdd5
commit 509db85b89
3 changed files with 19 additions and 14 deletions

View File

@ -72,7 +72,7 @@
(pageChanged)="viewerPageChanged($event)"
(viewerReady)="viewerReady($event)"
*ngIf="displayPdfViewer"
[annotations]="annotations"
[annotations]="visibleAnnotations"
[canPerformActions]="canPerformAnnotationActions$ | async"
[class.hidden]="!ready"
[dossier]="dossier"
@ -107,7 +107,7 @@
[(shouldDeselectAnnotationsOnPageChange)]="shouldDeselectAnnotationsOnPageChange"
[activeViewerPage]="activeViewerPage"
[annotationActionsTemplate]="annotationActionsTemplate"
[annotations]="annotations"
[annotations]="visibleAnnotations"
[dialogRef]="dialogRef"
[file]="file"
[hideSkipped]="hideSkipped"

View File

@ -132,10 +132,14 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
});
}
get annotations(): AnnotationWrapper[] {
get visibleAnnotations(): AnnotationWrapper[] {
return this.fileData ? this.fileData.getVisibleAnnotations(this.viewModeService.viewMode) : [];
}
get allAnnotations(): AnnotationWrapper[] {
return this.fileData ? this.fileData.allAnnotations : [];
}
get activeViewer(): WebViewerInstance {
return this._instance;
}
@ -244,7 +248,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}
const processStartTime = new Date().getTime();
const annotationFilters = this._annotationProcessingService.getAnnotationFilter(this.annotations);
const annotationFilters = this._annotationProcessingService.getAnnotationFilter(this.visibleAnnotations);
const primaryFilters = this._filterService.getGroup('primaryFilters')?.filters;
this._filterService.addFilterGroup({
slug: 'primaryFilters',
@ -265,7 +269,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
handleAnnotationSelected(annotationIds: string[]) {
// TODO: use includes() here
this.selectedAnnotations = annotationIds
.map(id => this.annotations.find(annotationWrapper => annotationWrapper.id === id))
.map(id => this.visibleAnnotations.find(annotationWrapper => annotationWrapper.id === id))
.filter(ann => ann !== undefined);
if (this.selectedAnnotations.length > 1) {
this.multiSelectService.activate();
@ -552,11 +556,12 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
private async _reloadAnnotations() {
this.fileData.redactionLog = await this._fileDownloadService.loadRedactionLogFor(this.dossierId, this.fileId).toPromise();
await this._cleanupAndRedrawAnnotations(this.annotations);
this._instance.Core.annotationManager.deleteAnnotations(this._instance.Core.annotationManager.getAnnotationsList());
await this._cleanupAndRedrawAnnotations();
}
private async _reloadAnnotationsForPage(page: number) {
const currentPageAnnotations = this.annotations.filter(a => a.pageNumber === page);
const currentPageAnnotations = this.visibleAnnotations.filter(a => a.pageNumber === page);
this.fileData.file = await this._filesService.reload(this.dossierId, this.fileId).toPromise();
this.fileData.redactionLog = await this._fileDownloadService.loadRedactionLogFor(this.dossierId, this.fileId).toPromise();
@ -565,7 +570,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}
private async _cleanupAndRedrawAnnotations(
annotationsToDelete: AnnotationWrapper[],
annotationsToDelete?: AnnotationWrapper[],
newAnnotationsFilter?: (annotation: AnnotationWrapper) => boolean,
) {
this.rebuildFilters();
@ -575,7 +580,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
annotationsToDelete?.forEach(annotation => {
this._findAndDeleteAnnotation(annotation.id);
});
const newAnnotations = newAnnotationsFilter ? this.annotations.filter(newAnnotationsFilter) : this.annotations;
const newAnnotations = newAnnotationsFilter ? this.allAnnotations.filter(newAnnotationsFilter) : this.allAnnotations;
this._handleDeltaAnnotationFilters(annotationsToDelete ?? [], newAnnotations);
await this._redrawAnnotations(newAnnotations);
console.log(
@ -584,7 +589,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}
}
private _redrawAnnotations(annotations = this.fileData.allAnnotations) {
private _redrawAnnotations(annotations = this.allAnnotations) {
return this._annotationDrawService.drawAnnotations(
this._instance,
annotations,

View File

@ -355,10 +355,10 @@
"to": "to"
},
"auth-error": {
"heading": "Your user doesn't have the required RED-* roles to access this application. Please contact your admin for access!",
"heading-with-link": "Your user doesn't have the required RED-* roles to access this application. Please contact <a href={adminUrl} target=_blank >your admin</a> for access!",
"heading-with-name": "Your user doesn't have the required RED-* roles to access this application. Please contact {adminName} for access!",
"heading-with-name-and-link": "Your user doesn't have the required RED-* roles to access this application. Please contact <a href={adminUrl} target=_blank >{adminName}</a> for access!",
"heading": "Your user is successfully logged in but has no role assigned yet. Please contact your RedactManager administrator to assign appropriate roles.",
"heading-with-link": "Your user is successfully logged in but has no role assigned yet. Please contact <a href={adminUrl} target=_blank >your RedactManager administrator</a> to assign appropriate roles!",
"heading-with-name": "Your user is successfully logged in but has no role assigned yet. Please contact {adminName} to assign appropriate roles.",
"heading-with-name-and-link": "Your user is successfully logged in but has no role assigned yet. Please contact <a href={adminUrl} target=_blank >{adminName}</a> to assign appropriate roles.",
"logout": "Logout"
},
"by": "by",