From 24e793582db1fb4b20c4bf321ac0f8e9e7fb8f8a Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Wed, 4 Sep 2024 13:29:36 +0300 Subject: [PATCH] RED-9937: made preview tab available & trigger reanalysis when required. --- .../components/view-switch/view-switch.component.ts | 2 +- .../file-preview/file-preview-screen.component.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/components/view-switch/view-switch.component.ts b/apps/red-ui/src/app/modules/file-preview/components/view-switch/view-switch.component.ts index 21cc039be..d7a593c9c 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/view-switch/view-switch.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/view-switch/view-switch.component.ts @@ -27,7 +27,7 @@ export class ViewSwitchComponent { }); protected readonly canSwitchToRedactedView = computed(() => { const file = this._state.file(); - return !file.analysisRequired && !file.excluded && !file.isError; + return !file.excluded && !file.isError; }); protected readonly canSwitchToEarmarksView = computed(() => { const file = this._state.file(); diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index 565b97eec..958ee18f9 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -152,6 +152,13 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni this._fileDataService.loadAnnotations(file).then(); }); + effect(() => { + const file = this.state.file(); + if (file.analysisRequired && !file.excludedFromAutomaticAnalysis) { + this._reanalysisService.reanalyzeFilesForDossier([file], file.dossierId, { force: true }).then(); + } + }); + effect( () => { if (this._documentViewer.loaded()) { @@ -350,10 +357,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni this.userPreferenceService.saveLastOpenedFileForDossier(this.dossierId, this.fileId).then(); this.#subscribeToFileUpdates(); - if (file?.analysisRequired && !file.excludedFromAutomaticAnalysis) { - await this._reanalysisService.reanalyzeFilesForDossier([file], this.dossierId, { force: true }); - } - this.pdfProxyService.configureElements(); this.#restoreOldFilters(); this.pdf.instance.UI.hotkeys.on('esc', this.handleEscInsideViewer);