diff --git a/apps/red-ui/src/app/models/file/file-data.model.ts b/apps/red-ui/src/app/models/file/file-data.model.ts index 10ce0ec5c..16727d14b 100644 --- a/apps/red-ui/src/app/models/file/file-data.model.ts +++ b/apps/red-ui/src/app/models/file/file-data.model.ts @@ -2,33 +2,45 @@ import { Dictionary, File, IRedactionLog, IRedactionLogEntry, IViewedPage, ViewM import { AnnotationWrapper } from './annotation.wrapper'; import { RedactionLogEntryWrapper } from './redaction-log-entry.wrapper'; import * as moment from 'moment'; +import { BehaviorSubject } from 'rxjs'; export class FileDataModel { static readonly DELTA_VIEW_TIME = 10 * 60 * 1000; // 10 minutes; - - hasChangeLog: boolean; allAnnotations: AnnotationWrapper[]; + readonly hasChangeLog$ = new BehaviorSubject(false); + readonly blob$ = new BehaviorSubject(undefined); + readonly file$ = new BehaviorSubject(undefined); constructor( - public file: File, - public fileData: Blob, + private readonly _file: File, + private readonly _blob: Blob, private _redactionLog: IRedactionLog, public viewedPages?: IViewedPage[], private _dictionaryData?: { [p: string]: Dictionary }, private _areDevFeaturesEnabled?: boolean, ) { + this.file$.next(_file); + this.blob$.next(_blob); this._buildAllAnnotations(); } + get file(): File { + return this.file$.value; + } + + set file(file: File) { + this.file$.next(file); + } + + get redactionLog(): IRedactionLog { + return this._redactionLog; + } + set redactionLog(redactionLog: IRedactionLog) { this._redactionLog = redactionLog; this._buildAllAnnotations(); } - get redactionLog() { - return this._redactionLog; - } - getVisibleAnnotations(viewMode: ViewMode) { return this.allAnnotations.filter(annotation => { if (viewMode === 'STANDARD') { @@ -47,7 +59,7 @@ export class FileDataModel { const previousAnnotations = this.allAnnotations || []; this.allAnnotations = entries .map(entry => AnnotationWrapper.fromData(entry)) - .filter(ann => ann.manual || !this.file.excludedPages.includes(ann.pageNumber)); + .filter(ann => ann.manual || !this._file.excludedPages.includes(ann.pageNumber)); if (!this._areDevFeaturesEnabled) { this.allAnnotations = this.allAnnotations.filter(annotation => !annotation.isFalsePositive); @@ -121,8 +133,8 @@ export class FileDataModel { } private _isChangeLogEntry(redactionLogEntry: IRedactionLogEntry, wrapper: RedactionLogEntryWrapper) { - if (this.file.numberOfAnalyses > 1) { - var viableChanges = redactionLogEntry.changes.filter(c => c.analysisNumber > 1); + if (this._file.numberOfAnalyses > 1) { + const viableChanges = redactionLogEntry.changes.filter(c => c.analysisNumber > 1); viableChanges.sort((a, b) => moment(a.dateTime).valueOf() - moment(b.dateTime).valueOf()); const lastChange = viableChanges.length >= 1 ? viableChanges[viableChanges.length - 1] : undefined; @@ -141,7 +153,7 @@ export class FileDataModel { wrapper.changeLogType = relevantChanges[relevantChanges.length - 1].type; wrapper.isChangeLogEntry = true; viewedPage.showAsUnseen = moment(viewedPage.viewedTime).valueOf() < moment(lastChange.dateTime).valueOf(); - this.hasChangeLog = true; + this.hasChangeLog$.next(true); } else { // no relevant changes - hide removed anyway wrapper.isChangeLogEntry = false; diff --git a/apps/red-ui/src/app/modules/dossier/dossiers.module.ts b/apps/red-ui/src/app/modules/dossier/dossiers.module.ts index 140fe64c1..9fd58b8cb 100644 --- a/apps/red-ui/src/app/modules/dossier/dossiers.module.ts +++ b/apps/red-ui/src/app/modules/dossier/dossiers.module.ts @@ -10,7 +10,6 @@ import { SharedModule } from '@shared/shared.module'; import { DossiersRoutingModule } from './dossiers-routing.module'; import { FileUploadDownloadModule } from '@upload-download/file-upload-download.module'; import { DossiersDialogService } from './services/dossiers-dialog.service'; -import { PdfViewerDataService } from './services/pdf-viewer-data.service'; import { ManualAnnotationService } from './services/manual-annotation.service'; import { AnnotationProcessingService } from './services/annotation-processing.service'; import { EditDossierDialogComponent } from './dialogs/edit-dossier-dialog/edit-dossier-dialog.component'; @@ -54,7 +53,7 @@ const components = [ ...dialogs, ]; -const services = [DossiersDialogService, ManualAnnotationService, PdfViewerDataService, AnnotationProcessingService]; +const services = [DossiersDialogService, ManualAnnotationService, AnnotationProcessingService]; @NgModule({ declarations: [...components], diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html index 720716f51..71c41366d 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html @@ -96,7 +96,6 @@ [file]="file" [number]="pageNumber" [showDottedIcon]="hasOnlyManualRedactionsAndIsExcluded(pageNumber)" - [viewedPages]="viewedPages" > diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.ts index e6afc8d32..584a25e84 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.ts @@ -28,7 +28,7 @@ import { PermissionsService } from '@services/permissions.service'; import { WebViewerInstance } from '@pdftron/webviewer'; import { BehaviorSubject, combineLatest, Observable } from 'rxjs'; import { map, tap } from 'rxjs/operators'; -import { File, IViewedPage } from '@red/domain'; +import { File } from '@red/domain'; import { ExcludedPagesService } from '../../services/excluded-pages.service'; import { MultiSelectService } from '../../services/multi-select.service'; import { DocumentInfoService } from '../../services/document-info.service'; @@ -52,7 +52,6 @@ export class FileWorkloadComponent { @Input() activeViewerPage: number; @Input() shouldDeselectAnnotationsOnPageChange: boolean; @Input() dialogRef: MatDialogRef; - @Input() viewedPages: IViewedPage[]; @Input() file!: File; @Input() annotationActionsTemplate: TemplateRef; @Input() viewer: WebViewerInstance; @@ -225,7 +224,7 @@ export class FileWorkloadComponent { scrollAnnotationsToPage(page: number, mode: 'always' | 'if-needed' = 'if-needed'): void { if (this._annotationsElement) { - const elements = this._annotationsElement.nativeElement.querySelectorAll(`div[anotation-page-header="${page}"]`); + const elements: HTMLElement[] = this._annotationsElement.nativeElement.querySelectorAll(`div[anotation-page-header="${page}"]`); FileWorkloadComponent._scrollToFirstElement(elements, mode); } } @@ -235,7 +234,7 @@ export class FileWorkloadComponent { if (!this.selectedAnnotations || this.selectedAnnotations.length === 0 || !this._annotationsElement) { return; } - const elements = this._annotationsElement.nativeElement.querySelectorAll( + const elements: HTMLElement[] = this._annotationsElement.nativeElement.querySelectorAll( `div[annotation-id="${this._firstSelectedAnnotation?.id}"].active`, ); FileWorkloadComponent._scrollToFirstElement(elements); @@ -412,7 +411,7 @@ export class FileWorkloadComponent { private _scrollQuickNavigationToPage(page: number) { if (this._quickNavigationElement) { - const elements = this._quickNavigationElement.nativeElement.querySelectorAll(`#quick-nav-page-${page}`); + const elements: HTMLElement[] = this._quickNavigationElement.nativeElement.querySelectorAll(`#quick-nav-page-${page}`); FileWorkloadComponent._scrollToFirstElement(elements); } } diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-indicator/page-indicator.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-indicator/page-indicator.component.ts index 922dd5516..785a6153f 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-indicator/page-indicator.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-indicator/page-indicator.component.ts @@ -6,6 +6,7 @@ import { ViewedPagesService } from '@services/entity-services/viewed-pages.servi import { File, IViewedPage } from '@red/domain'; import { AutoUnsubscribe } from '@iqser/common-ui'; import { FilesMapService } from '@services/entity-services/files-map.service'; +import { FilePreviewStateService } from '../../services/file-preview-state.service'; @Component({ selector: 'redaction-page-indicator', @@ -18,7 +19,6 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy @Input() active = false; @Input() showDottedIcon = false; @Input() number: number; - @Input() viewedPages: IViewedPage[]; @Input() activeSelection = false; @Output() readonly pageSelected = new EventEmitter(); @@ -33,25 +33,17 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy private readonly _configService: ConfigService, private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _permissionService: PermissionsService, + private readonly _stateService: FilePreviewStateService, ) { super(); } get activePage() { - return this.viewedPages?.find(p => p.page === this.number); + return this._viewedPages.find(p => p.page === this.number); } - private _setReadState() { - const readBefore = this.read; - const activePage = this.activePage; - if (!activePage) { - this.read = false; - } else { - // console.log('setting read to',activePage.showAsUnseen, !activePage.showAsUnseen); - this.read = !activePage.showAsUnseen; - } - // console.log(this.number, readBefore, activePage, this.read); - this._changeDetectorRef.detectChanges(); + private get _viewedPages(): IViewedPage[] { + return this._stateService.fileData?.viewedPages || []; } ngOnChanges() { @@ -87,20 +79,33 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy } } + private _setReadState() { + const readBefore = this.read; + const activePage = this.activePage; + if (!activePage) { + this.read = false; + } else { + // console.log('setting read to',activePage.showAsUnseen, !activePage.showAsUnseen); + this.read = !activePage.showAsUnseen; + } + // console.log(this.number, readBefore, activePage, this.read); + this._changeDetectorRef.detectChanges(); + } + private async _markPageRead() { await this._viewedPagesService.addPage({ page: this.number }, this.file.dossierId, this.file.fileId).toPromise(); if (this.activePage) { this.activePage.showAsUnseen = false; } else { - this.viewedPages?.push({ page: this.number, fileId: this.file.fileId }); + this._viewedPages.push({ page: this.number, fileId: this.file.fileId }); } this._setReadState(); } private async _markPageUnread() { await this._viewedPagesService.removePage(this.file.dossierId, this.file.fileId, this.number).toPromise(); - this.viewedPages?.splice( - this.viewedPages?.findIndex(p => p.page === this.number), + this._viewedPages.splice( + this._viewedPages.findIndex(p => p.page === this.number), 1, ); this._setReadState(); diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/pdf-viewer/pdf-viewer.component.ts index a60280479..f0c0968a4 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/pdf-viewer/pdf-viewer.component.ts @@ -27,7 +27,7 @@ import { AnnotationActionsService } from '../../services/annotation-actions.serv import { UserPreferenceService } from '@services/user-preference.service'; import { BASE_HREF } from '../../../../../../tokens'; import { ConfigService } from '@services/config.service'; -import { ConfirmationDialogInput, LoadingService } from '@iqser/common-ui'; +import { AutoUnsubscribe, ConfirmationDialogInput, LoadingService, shareDistinctLast } from '@iqser/common-ui'; import { DossiersDialogService } from '../../../../services/dossiers-dialog.service'; import { loadCompareDocumentWrapper } from '../../../../utils/compare-mode.utils'; import { PdfViewerUtils } from '../../../../utils/pdf-viewer.utils'; @@ -36,11 +36,13 @@ import { ActivatedRoute } from '@angular/router'; import { toPosition } from '../../../../utils/pdf-calculation.utils'; import { ViewModeService } from '../../services/view-mode.service'; import { MultiSelectService } from '../../services/multi-select.service'; +import { FilePreviewStateService } from '../../services/file-preview-state.service'; +import { filter, switchMap, tap } from 'rxjs/operators'; import Tools = Core.Tools; import TextTool = Tools.TextTool; import Annotation = Core.Annotations.Annotation; -const ALLOWED_KEYBOARD_SHORTCUTS = ['+', '-', 'p', 'r', 'Escape'] as const; +const ALLOWED_KEYBOARD_SHORTCUTS: readonly string[] = ['+', '-', 'p', 'r', 'Escape'] as const; const dataElements = { ADD_REDACTION: 'add-redaction', ADD_DICTIONARY: 'add-dictionary', @@ -61,8 +63,7 @@ const dataElements = { templateUrl: './pdf-viewer.component.html', styleUrls: ['./pdf-viewer.component.scss'], }) -export class PdfViewerComponent implements OnInit, OnChanges { - @Input() fileData: Blob; +export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnChanges { @Input() file: File; @Input() dossier: Dossier; @Input() canPerformActions = false; @@ -95,9 +96,12 @@ export class PdfViewerComponent implements OnInit, OnChanges { private readonly _annotationActionsService: AnnotationActionsService, private readonly _configService: ConfigService, private readonly _loadingService: LoadingService, + private readonly _stateService: FilePreviewStateService, readonly viewModeService: ViewModeService, readonly multiSelectService: MultiSelectService, - ) {} + ) { + super(); + } private get _toggleTooltipsBtnTitle(): string { return this._translateService.instant(_('pdf-viewer.toggle-tooltips'), { @@ -115,7 +119,17 @@ export class PdfViewerComponent implements OnInit, OnChanges { async ngOnInit() { this._setReadyAndInitialState = this._setReadyAndInitialState.bind(this); - await this.loadViewer(); + await this._loadViewer(); + + this.addActiveScreenSubscription = this._stateService.fileData$ + .pipe( + filter(fileData => !!fileData), + switchMap(fileData => fileData.blob$), + // Skip document reload if file content hasn't changed + shareDistinctLast(), + tap(() => this._loadDocument()), + ) + .subscribe(); } ngOnChanges(changes: SimpleChanges): void { @@ -123,16 +137,12 @@ export class PdfViewerComponent implements OnInit, OnChanges { return; } - if (changes.fileData) { - this._loadDocument(); - } - if (changes.canPerformActions) { this._handleCustomActions(); } } - uploadFile(files: any) { + uploadFile(files: FileList) { const fileToCompare = files[0]; this.compareFileInput.nativeElement.value = null; @@ -148,7 +158,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { await pdfNet.initialize(environment.licenseKey ? atob(environment.licenseKey) : null); const compareDocument = await pdfNet.PDFDoc.createFromBuffer(fileReader.result as ArrayBuffer); - const currentDocument = await pdfNet.PDFDoc.createFromBuffer(await this.fileData.arrayBuffer()); + const currentDocument = await pdfNet.PDFDoc.createFromBuffer(await this._stateService.fileData.blob$.value.arrayBuffer()); const loadCompareDocument = async () => { this._loadingService.start(); @@ -201,7 +211,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { this.viewModeService.compareMode = false; const pdfNet = this.instance.Core.PDFNet; await pdfNet.initialize(environment.licenseKey ? atob(environment.licenseKey) : null); - const currentDocument = await pdfNet.PDFDoc.createFromBuffer(await this.fileData.arrayBuffer()); + const currentDocument = await pdfNet.PDFDoc.createFromBuffer(await this._stateService.fileData.blob$.value.arrayBuffer()); this.instance.UI.loadDocument(currentDocument, { filename: this.file ? this.file.filename : 'document.pdf', }); @@ -210,7 +220,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { this.utils.navigateToPage(1); } - async loadViewer() { + private async _loadViewer() { this.instance = await WebViewer( { licenseKey: environment.licenseKey ? atob(environment.licenseKey) : null, @@ -219,7 +229,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { css: this._convertPath('/assets/pdftron/stylesheet.css'), backendType: 'ems', }, - this.viewer.nativeElement, + this.viewer.nativeElement as HTMLElement, ); this.documentViewer = this.instance.Core.documentViewer; @@ -231,7 +241,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { this.utils.disableHotkeys(); this._configureTextPopup(); - this.annotationManager.addEventListener('annotationSelected', (annotations, action) => { + this.annotationManager.addEventListener('annotationSelected', (annotations: Annotation[], action) => { this.annotationSelected.emit(this.annotationManager.getSelectedAnnotations().map(ann => ann.Id)); if (action === 'deselected') { this._toggleRectangleAnnotationAction(true); @@ -241,7 +251,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { } }); - this.annotationManager.addEventListener('annotationChanged', annotations => { + this.annotationManager.addEventListener('annotationChanged', (annotations: Annotation[]) => { // when a rectangle is drawn, // it returns one annotation with tool name 'AnnotationCreateRectangle; // this will auto select rectangle after drawing @@ -251,7 +261,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { } }); - this.documentViewer.addEventListener('pageNumberUpdated', pageNumber => { + this.documentViewer.addEventListener('pageNumberUpdated', (pageNumber: number) => { if (this.shouldDeselectAnnotationsOnPageChange) { this.utils.deselectAllAnnotations(); } @@ -261,9 +271,9 @@ export class PdfViewerComponent implements OnInit, OnChanges { this.documentViewer.addEventListener('documentLoaded', this._setReadyAndInitialState); - this.documentViewer.addEventListener('keyUp', $event => { + this.documentViewer.addEventListener('keyUp', ($event: KeyboardEvent) => { // arrows and full-screen - if ($event.target?.tagName?.toLowerCase() !== 'input') { + if (($event.target as HTMLElement)?.tagName?.toLowerCase() !== 'input') { if ($event.key.startsWith('Arrow') || $event.key === 'f') { this._ngZone.run(() => { this.keyUp.emit($event); @@ -273,7 +283,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { } } - if (ALLOWED_KEYBOARD_SHORTCUTS.indexOf($event.key) < 0) { + if (!ALLOWED_KEYBOARD_SHORTCUTS.includes($event.key)) { $event.preventDefault(); $event.stopPropagation(); } @@ -301,8 +311,6 @@ export class PdfViewerComponent implements OnInit, OnChanges { } } }); - - this._loadDocument(); } private _setInitialDisplayMode() { @@ -568,7 +576,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { } private _addManualRedactionOfType(type: ManualRedactionEntryType) { - const selectedQuads = this.documentViewer.getSelectedTextQuads(); + const selectedQuads: Readonly> = this.documentViewer.getSelectedTextQuads(); const text = this.documentViewer.getSelectedText(); const manualRedaction = this._getManualRedaction(selectedQuads, text, true); this.manualAnnotationRequested.emit(new ManualRedactionEntryWrapper(selectedQuads, manualRedaction, type)); @@ -624,7 +632,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { for (const quad of quads[key]) { const page = parseInt(key, 10); const pageHeight = this.documentViewer.getPageHeight(page); - entry.positions.push(toPosition(page, pageHeight, convertQuads ? this.utils.translateQuads(page, quad) : quad)); + entry.positions.push(toPosition(page, pageHeight, convertQuads ? this.utils.translateQuad(page, quad) : quad)); } } @@ -634,11 +642,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { } private _loadDocument() { - if (!this.fileData) { - return; - } - - this.instance.UI.loadDocument(this.fileData, { + this.instance.UI.loadDocument(this._stateService.fileData.blob$.value, { filename: this.file ? this.file.filename : 'document.pdf', }); } @@ -647,7 +651,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { this._ngZone.run(() => { this.utils.ready = true; this.viewerReady.emit(this.instance); - const routePageNumber = this._activatedRoute.snapshot.queryParams.page; + const routePageNumber: number = this._activatedRoute.snapshot.queryParams.page; this.pageChanged.emit(routePageNumber || 1); this._setInitialDisplayMode(); this._updateTooltipsVisibility(); diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/view-switch/view-switch.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/view-switch/view-switch.component.html index 4daf4a4ee..c99ce4ba5 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/view-switch/view-switch.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/view-switch/view-switch.component.html @@ -1,5 +1,5 @@ -
{{ 'file-preview.standard' | translate }} -
+ -
{{ 'file-preview.delta' | translate }} -
+ -
{{ 'file-preview.redacted' | translate }} -
+
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/view-switch/view-switch.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/view-switch/view-switch.component.ts index 283aa7f62..b069922d9 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/view-switch/view-switch.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/view-switch/view-switch.component.ts @@ -1,10 +1,12 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { File, ViewMode } from '@red/domain'; import { ViewModeService } from '../../services/view-mode.service'; -import { FileDataModel } from '@models/file/file-data.model'; +import { FilePreviewStateService } from '../../services/file-preview-state.service'; +import { Observable } from 'rxjs'; +import { filter, switchMap } from 'rxjs/operators'; @Component({ - selector: 'redaction-view-switch [file] [fileData]', + selector: 'redaction-view-switch [file]', templateUrl: './view-switch.component.html', styleUrls: ['./view-switch.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, @@ -12,19 +14,18 @@ import { FileDataModel } from '@models/file/file-data.model'; export class ViewSwitchComponent implements OnChanges { @Output() readonly switchView = new EventEmitter(); @Input() file: File; - @Input() fileData: FileDataModel; - canSwitchToDeltaView = false; + readonly canSwitchToDeltaView$: Observable; canSwitchToRedactedView = false; - constructor(readonly viewModeService: ViewModeService) {} + constructor(readonly viewModeService: ViewModeService, private readonly _stateService: FilePreviewStateService) { + this.canSwitchToDeltaView$ = this._stateService.fileData$.pipe( + filter(fileData => !!fileData), + switchMap(fileData => fileData?.hasChangeLog$), + ); + } ngOnChanges(changes: SimpleChanges) { - if (changes.fileData) { - const fileData = changes.fileData.currentValue as FileDataModel; - this.canSwitchToDeltaView = fileData?.hasChangeLog; - } - if (changes.file) { const file = changes?.file.currentValue as File; this.canSwitchToRedactedView = !file.analysisRequired && !file.excluded; diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html index ccc7b9f21..b90dd8d93 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html @@ -1,9 +1,9 @@ - +