merged backfixes into main

This commit is contained in:
Bamboo 2021-05-18 08:35:13 +02:00 committed by Timo
parent 3cdbd2a5ba
commit c4cddca5d8
11 changed files with 60 additions and 63 deletions

View File

@ -29,10 +29,6 @@ export class FileDataModel {
public viewedPages?: ViewedPages public viewedPages?: ViewedPages
) {} ) {}
get redactionLogEntry(): RedactionLogEntry[] {
return this.redactionLog.redactionLogEntry;
}
getAnnotations( getAnnotations(
dictionaryData: { [p: string]: TypeValueWrapper }, dictionaryData: { [p: string]: TypeValueWrapper },
currentUser: UserWrapper, currentUser: UserWrapper,

View File

@ -193,11 +193,7 @@ export class FileStatusWrapper {
return this.status === 'UNDER_REVIEW' || this.status === 'UNDER_APPROVAL'; return this.status === 'UNDER_REVIEW' || this.status === 'UNDER_APPROVAL';
} }
get newestDate() { get cacheIdentifier() {
const uploadedDate = new Date(this.fileStatus.lastUploaded); return btoa(this.fileStatus.lastUploaded + this.fileStatus.lastOCRTime);
const updatedDate = new Date(this.fileStatus.lastUpdated);
return updatedDate && updatedDate.getTime() > uploadedDate.getTime()
? updatedDate
: uploadedDate;
} }
} }

View File

@ -117,7 +117,7 @@
<redaction-circle-button <redaction-circle-button
(action)="ocrFile($event)" (action)="ocrFile($event)"
*ngIf="canOcr" *ngIf="canOcr && screen === 'project-overview'"
[tooltipPosition]="tooltipPosition" [tooltipPosition]="tooltipPosition"
[type]="buttonType" [type]="buttonType"
icon="red:ocr" icon="red:ocr"

View File

@ -127,6 +127,7 @@
.annotation-wrapper { .annotation-wrapper {
display: flex; display: flex;
width: 100%;
border-bottom: 1px solid $separator; border-bottom: 1px solid $separator;
.active-bar-marker { .active-bar-marker {

View File

@ -283,7 +283,6 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
} }
private _configureAnnotationSpecificActions(viewerAnnotations: Annotations.Annotation[]) { private _configureAnnotationSpecificActions(viewerAnnotations: Annotations.Annotation[]) {
console.log('configure actions', viewerAnnotations);
if (!this.canPerformActions) { if (!this.canPerformActions) {
return; return;
} }

View File

@ -264,6 +264,7 @@
<div class="quick-navigation"> <div class="quick-navigation">
<mat-icon svgIcon="red:pages"></mat-icon> <mat-icon svgIcon="red:pages"></mat-icon>
{{ fileStatus.numberOfPages }} {{ fileStatus.numberOfPages }}
{{ fileStatus.fileId }}
</div> </div>
</div> </div>

View File

@ -102,10 +102,6 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
reviewer: [this.appStateService.activeFile.currentReviewer] reviewer: [this.appStateService.activeFile.currentReviewer]
}); });
this._loadFileData().subscribe(() => {
this._updateCanPerformActions();
});
document.documentElement.addEventListener('fullscreenchange', () => { document.documentElement.addEventListener('fullscreenchange', () => {
if (!document.fullscreenElement) { if (!document.fullscreenElement) {
this.fullScreen = false; this.fullScreen = false;
@ -218,19 +214,22 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
this._unsubscribeFromFileUpdates(); this._unsubscribeFromFileUpdates();
} }
ngOnAttach(previousRoute: ActivatedRouteSnapshot) { async ngOnAttach(previousRoute: ActivatedRouteSnapshot) {
this.ngOnInit(); await this.ngOnInit();
this._lastPage = previousRoute.queryParams.page; this._lastPage = previousRoute.queryParams.page;
} }
ngOnInit(): void { async ngOnInit() {
await this._loadFileData(false);
this.displayPDFViewer = true; this.displayPDFViewer = true;
this._updateCanPerformActions();
const key = 'Dossier-Recent-' + this.dossierId; try {
this._userPreferenceControllerService const key = 'Dossier-Recent-' + this.dossierId;
.savePreferences([this.fileId], key) await this._userPreferenceControllerService
.toPromise() .savePreferences([this.fileId], key)
.then(); .toPromise();
} catch (error) {}
this._subscribeToFileUpdates(); this._subscribeToFileUpdates();
} }
@ -242,13 +241,15 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
rebuildFilters(deletePreviousAnnotations: boolean = false) { rebuildFilters(deletePreviousAnnotations: boolean = false) {
const startTime = new Date().getTime(); const startTime = new Date().getTime();
if (deletePreviousAnnotations) { if (deletePreviousAnnotations) {
this.activeViewer.annotManager.deleteAnnotations( const annotationsToDelete = this.activeViewer?.annotManager?.getAnnotationsList() || [];
this.activeViewer.annotManager.getAnnotationsList(), try {
{ this.activeViewer?.annotManager?.deleteAnnotations(annotationsToDelete, {
imported: true, imported: true,
force: true force: true
} });
); } catch (error) {
// nothing
}
} }
console.log( console.log(
'[REDACTION] Delete previous annotations time: ' + '[REDACTION] Delete previous annotations time: ' +
@ -433,7 +434,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
this.viewReady = false; this.viewReady = false;
this._startAnalysisTimer(); this._startAnalysisTimer();
this.loadingMessage = 'file-preview.reanalyse-file'; this.loadingMessage = 'file-preview.reanalyse-file';
await this._loadFileData().toPromise(); await this._loadFileData();
this._updateCanPerformActions(); this._updateCanPerformActions();
await this.appStateService.reloadActiveDossierFiles(); await this.appStateService.reloadActiveDossierFiles();
return; return;
@ -536,15 +537,14 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
) )
.subscribe(); .subscribe();
this.fileReanalysedSubscription = this.appStateService.fileReanalysed.subscribe( this.fileReanalysedSubscription = this.appStateService.fileReanalysed.subscribe(
(fileStatus: FileStatusWrapper) => { async (fileStatus: FileStatusWrapper) => {
if (fileStatus.fileId === this.fileId) { if (fileStatus.fileId === this.fileId) {
this._loadFileData(true).subscribe(() => { await this._loadFileData(true);
this.viewReady = true; this.viewReady = true;
this.loadingMessage = null; this.loadingMessage = null;
this._stopAnalysisTimer(); this._stopAnalysisTimer();
this._updateCanPerformActions(); this._updateCanPerformActions();
this._cleanupAndRedrawManualAnnotations(); this._cleanupAndRedrawManualAnnotations();
});
} }
} }
); );
@ -561,30 +561,33 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
} }
private _loadFileData(performUpdate: boolean = false) { private _loadFileData(performUpdate: boolean = false) {
return this._fileDownloadService.loadActiveFileData().pipe( return this._fileDownloadService
tap(fileDataModel => { .loadActiveFileData()
if (fileDataModel.fileStatus.isWorkable) { .pipe(
if (performUpdate) { tap(fileDataModel => {
this.fileData.redactionLog = fileDataModel.redactionLog; if (fileDataModel.fileStatus.isWorkable) {
this.fileData.redactionChangeLog = fileDataModel.redactionChangeLog; if (performUpdate) {
this.fileData.fileStatus = fileDataModel.fileStatus; this.fileData.redactionLog = fileDataModel.redactionLog;
this.fileData.manualRedactions = fileDataModel.manualRedactions; this.fileData.redactionChangeLog = fileDataModel.redactionChangeLog;
this.rebuildFilters(true); this.fileData.fileStatus = fileDataModel.fileStatus;
this.fileData.manualRedactions = fileDataModel.manualRedactions;
this.rebuildFilters(true);
} else {
this.fileData = fileDataModel;
this.rebuildFilters();
}
} else { } else {
this.fileData = fileDataModel; if (fileDataModel.fileStatus.isError) {
this.rebuildFilters(); this._router.navigate([
'/main/dossiers/' + this.appStateService.activeDossierId
]);
} else {
this.loadingMessage = 'file-preview.reanalyse-file';
}
} }
} else { })
if (fileDataModel.fileStatus.isError) { )
this._router.navigate([ .toPromise();
'/main/dossiers/' + this.appStateService.activeDossierId
]);
} else {
this.loadingMessage = 'file-preview.reanalyse-file';
}
}
})
);
} }
@debounce() @debounce()

View File

@ -78,7 +78,7 @@ export class PdfViewerDataService {
fileStatus.dossierId, fileStatus.dossierId,
fileStatus.fileId, fileStatus.fileId,
true, true,
fileStatus.lastUploaded, fileStatus.cacheIdentifier,
'body' 'body'
); );
} }

View File

@ -29,7 +29,7 @@ export class FileDownloadService {
) { ) {
interval(5000).subscribe(() => { interval(5000).subscribe(() => {
if (_permissionsService.isUser()) { if (_permissionsService.isUser()) {
this.getDownloadStatus().subscribe(() => {}); // this.getDownloadStatus().subscribe(() => {});
} }
}); });
} }

View File

@ -5,8 +5,8 @@
<output-test url="file://$MODULE_DIR$/target/test-classes" /> <output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" /> <excludeFolder url="file://$MODULE_DIR$/target" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />

View File

@ -4,6 +4,7 @@ export const DYNAMIC_CACHES = [
{ {
urls: ['/assets/icons', '/assets/wv-resources'], urls: ['/assets/icons', '/assets/wv-resources'],
name: 'cached-assets', name: 'cached-assets',
clearOnLogout: false,
maxAge: 24 * 3600, maxAge: 24 * 3600,
maxSize: 1000, maxSize: 1000,
methods: ['GET'] methods: ['GET']