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
) {}
get redactionLogEntry(): RedactionLogEntry[] {
return this.redactionLog.redactionLogEntry;
}
getAnnotations(
dictionaryData: { [p: string]: TypeValueWrapper },
currentUser: UserWrapper,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,8 +5,8 @@
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<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/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />

View File

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