added reload single active file

This commit is contained in:
Timo Bejan 2020-11-11 21:31:44 +02:00
parent 0e35fb25ef
commit 57826e891d
2 changed files with 19 additions and 2 deletions

View File

@ -164,8 +164,9 @@ export class FilePreviewScreenComponent implements OnInit {
openManualRedactionDialog($event: ManualRedactionEntryWrapper) {
this.ngZone.run(() => {
this._dialogRef = this._dialogService.openManualRedactionDialog($event, (response: ManualAnnotationResponse) => {
this._dialogRef = this._dialogService.openManualRedactionDialog($event, async (response: ManualAnnotationResponse) => {
if (response?.annotationId) {
this.fileData.fileStatus = await this.appStateService.reloadActiveFile();
this._cleanupAndRedrawManualAnnotations(response.annotationId);
}
});
@ -381,11 +382,12 @@ export class FilePreviewScreenComponent implements OnInit {
});
}
annotationsChangedByReviewAction(annotation: AnnotationWrapper) {
async annotationsChangedByReviewAction(annotation: AnnotationWrapper) {
const viewerAnnotation = this.activeViewer.annotManager.getAnnotationById(annotation.id);
if (viewerAnnotation) {
this.activeViewer.annotManager.deleteAnnotation(viewerAnnotation, true, true);
}
this.fileData.fileStatus = await this.appStateService.reloadActiveFile();
this._cleanupAndRedrawManualAnnotations(annotation.id);
}

View File

@ -186,6 +186,21 @@ export class AppStateService {
return found ? found.files : [];
}
async reloadActiveFile() {
const oldProcessedDate = this.activeFile.lastProcessed;
const activeFile = await this._statusControllerService.getFileStatus(this.activeProjectId, this.activeFileId).toPromise();
const activeFileWrapper = new FileStatusWrapper(activeFile, this._userService.getNameForId(activeFile.currentReviewer));
this.activeProject.files = this.activeProject.files.map((file) => (file.fileId === activeFileWrapper.fileId ? activeFileWrapper : file));
this._computeStats();
if (activeFileWrapper.lastProcessed !== oldProcessedDate) {
this.fileReanalysed.emit(activeFileWrapper);
}
this.fileChanged.emit(activeFileWrapper);
return activeFileWrapper;
}
async getFiles(project?: ProjectWrapper) {
if (!project) {
project = this.activeProject;