diff --git a/apps/red-ui/src/app/models/file/file-status.wrapper.ts b/apps/red-ui/src/app/models/file/file-status.wrapper.ts index 0b43d0b05..2711b3195 100644 --- a/apps/red-ui/src/app/models/file/file-status.wrapper.ts +++ b/apps/red-ui/src/app/models/file/file-status.wrapper.ts @@ -1,23 +1,55 @@ import { FileAttributesConfig, FileStatus } from '@redaction/red-ui-http'; import { StatusSorter } from '@utils/sorters/status-sorter'; -export class FileStatusWrapper { +const processingStatuses = [ + FileStatus.StatusEnum.REPROCESS, + FileStatus.StatusEnum.FULLREPROCESS, + FileStatus.StatusEnum.OCRPROCESSING, + FileStatus.StatusEnum.INDEXING, + FileStatus.StatusEnum.PROCESSING +] as const; + +export class FileStatusWrapper implements FileStatus { + readonly added = this.fileStatus.added; + readonly allManualRedactionsApplied = this.fileStatus.allManualRedactionsApplied; + readonly analysisDuration = this.fileStatus.analysisDuration; + readonly analysisRequired = this.fileStatus.analysisRequired && !this.fileStatus.excluded; + readonly approvalDate = this.fileStatus.approvalDate; + currentReviewer = this.fileStatus.currentReviewer; + readonly dictionaryVersion = this.fileStatus.dictionaryVersion; + readonly dossierDictionaryVersion = this.fileStatus.dossierDictionaryVersion; + readonly dossierId = this.fileStatus.dossierId; + readonly excluded = this.fileStatus.excluded; + readonly fileAttributes = this.fileStatus.fileAttributes; + readonly fileId = this.fileStatus.fileId; + readonly filename = this.fileStatus.filename; + readonly hasAnnotationComments = this.fileStatus.hasAnnotationComments; + readonly hasHints = this.fileStatus.hasHints; + readonly hasImages = this.fileStatus.hasImages; + readonly hasRedactions = this.fileStatus.hasRedactions; + readonly hasRequests = this.fileStatus.hasRequests; + readonly hasUpdates = this.fileStatus.hasUpdates; + readonly lastOCRTime = this.fileStatus.lastOCRTime; + readonly lastProcessed = this.fileStatus.lastProcessed; + readonly lastReviewer = this.fileStatus.lastReviewer; + readonly lastUpdated = this.fileStatus.lastUpdated; + readonly lastUploaded = this.fileStatus.lastUploaded; + readonly legalBasisVersion = this.fileStatus.legalBasisVersion; + readonly numberOfAnalyses = this.fileStatus.numberOfAnalyses; + readonly numberOfPages = this.fileStatus.numberOfPages; + readonly rulesVersion = this.fileStatus.rulesVersion; + readonly status = this._status; + readonly uploader = this.fileStatus.uploader; + readonly excludedPages = this.fileStatus.excludedPages; + primaryAttribute: string; - searchField: string; - - constructor( - public fileStatus: FileStatus, - public reviewerName: string, - public dossierTemplateId: string, - fileAttributesConfig?: FileAttributesConfig - ) { - this.searchField = fileStatus.filename; + constructor(readonly fileStatus: FileStatus, public reviewerName: string, fileAttributesConfig?: FileAttributesConfig) { if (fileAttributesConfig) { const primary = fileAttributesConfig.fileAttributeConfigs?.find(c => c.primaryAttribute); if (primary && fileStatus.fileAttributes?.attributeIdToValue) { this.primaryAttribute = fileStatus.fileAttributes?.attributeIdToValue[primary.id]; - this.searchField += ' ' + this.primaryAttribute; + this.filename += ' ' + this.primaryAttribute; } if (!this.primaryAttribute) { @@ -27,178 +59,40 @@ export class FileStatusWrapper { } } - get analysisDuration() { - return this.fileStatus.analysisDuration; + readonly excludedPagesCount = this.excludedPages?.length ?? 0; + readonly statusSort = StatusSorter[this.status]; + readonly pages = this._pages; + readonly cacheIdentifier = btoa(this.lastUploaded + this.lastOCRTime); + + readonly hasUnappliedSuggestions = !this.allManualRedactionsApplied; + readonly hintsOnly = this.hasHints && !this.hasRedactions; + readonly hasNone = !this.hasRedactions && !this.hasHints && !this.hasRequests; + + readonly isError = this.status === FileStatus.StatusEnum.ERROR; + readonly isProcessing = processingStatuses.includes(this.status); + readonly isApproved = this.status === FileStatus.StatusEnum.APPROVED; + readonly isPending = this.status === FileStatus.StatusEnum.UNPROCESSED; + readonly isUnderReview = this.status === FileStatus.StatusEnum.UNDERREVIEW; + readonly isUnderApproval = this.status === FileStatus.StatusEnum.UNDERAPPROVAL; + readonly canBeApproved = !this.analysisRequired && !this.hasRequests; + readonly canBeOpened = !this.isError && !this.isPending; + readonly isWorkable = !this.isProcessing && this.canBeOpened; + readonly canBeOCRed = !this.excluded && !this.lastOCRTime && ['UNASSIGNED', 'UNDER_REVIEW', 'UNDER_APPROVAL'].includes(this.status); + + get isUnassigned() { + return !this.currentReviewer; } - get lastProcessed() { - return this.fileStatus.lastProcessed; - } - - get added() { - return this.fileStatus.added; - } - - get lastUploaded() { - return this.fileStatus.lastUploaded; - } - - get hasImages() { - return this.fileStatus.hasImages; - } - - get hasUpdates() { - return this.fileStatus.hasUpdates && !this.hasRequests; - } - - get hasUnappliedSuggestions() { - return !this.fileStatus.allManualRedactionsApplied; - } - - get currentReviewer() { - return this.fileStatus.currentReviewer; - } - - set currentReviewer(value: string) { - this.fileStatus.currentReviewer = value; - } - - get fileId() { - return this.fileStatus.fileId; - } - - get filename() { - return this.fileStatus.filename; - } - - get hasAnnotationComments() { - // return this.fileStatus.hasAnnotationComments; - // TODO remove this once backend works properly - return false; - } - - get ocrTime() { - return this.fileStatus.lastOCRTime; - } - - get hasHints() { - return this.fileStatus.hasHints; - } - - get hintsOnly() { - return this.fileStatus.hasHints && !this.fileStatus.hasRedactions; - } - - get hasRedactions() { - return this.fileStatus.hasRedactions; - } - - get hasRequests() { - return this.fileStatus.hasRequests || this.hasUnappliedSuggestions; - } - - get hasNone() { - return !this.hasRedactions && !this.hasHints && !this.hasRequests; - } - - get lastUpdated() { - return this.fileStatus.lastUpdated; - } - - get numberOfAnalyses() { - return this.fileStatus.numberOfAnalyses; - } - - get dossierId() { - return this.fileStatus.dossierId; - } - - get isExcluded() { - return this.fileStatus.excluded; - } - - get status() { - return this.fileStatus.status === 'REPROCESS' || this.fileStatus.status === 'FULLREPROCESS' ? 'PROCESSING' : this.fileStatus.status; - } - - get numberOfPages() { - return this.fileStatus.numberOfPages; - } - - get numberOfExcludedPages() { - return this.fileStatus.excludedPages?.length || 0; - } - - get uploader() { - return this.fileStatus.uploader; - } - - get isPending() { - return this.status === FileStatus.StatusEnum.UNPROCESSED; - } - - get isProcessing() { - return [ - FileStatus.StatusEnum.REPROCESS, - FileStatus.StatusEnum.FULLREPROCESS, - FileStatus.StatusEnum.OCRPROCESSING, - FileStatus.StatusEnum.INDEXING, - FileStatus.StatusEnum.PROCESSING - ].includes(this.status); - } - - get analysisRequired() { - return this.fileStatus.analysisRequired && !this.fileStatus.excluded; - } - - get statusSort() { - return StatusSorter[this.status]; - } - - get isWorkable() { - return !this.isProcessing && !this.isPending && !this.isError; - } - - get isApproved() { - return this.fileStatus.status === 'APPROVED'; - } - - get isError() { - return this.fileStatus.status === 'ERROR'; - } - - get pages() { + private get _pages() { if (this.fileStatus.status === 'ERROR') { return -1; } return this.fileStatus.numberOfPages ? this.fileStatus.numberOfPages : 0; } - get isApprovedOrUnderApproval() { - return this.status === 'APPROVED' || this.status === 'UNDER_APPROVAL'; - } - - get isUnassigned() { - return !this.currentReviewer; - } - - get isUnderReview() { - return this.fileStatus.status === 'UNDER_REVIEW'; - } - - get isUnderApproval() { - return this.fileStatus.status === 'UNDER_APPROVAL'; - } - - get canApprove() { - return this.status === 'UNDER_REVIEW' || this.status === 'UNDER_APPROVAL'; - } - - get cacheIdentifier() { - return btoa(this.fileStatus.lastUploaded + this.fileStatus.lastOCRTime); - } - - get excludedPages(): number[] { - return this.fileStatus.excludedPages; + private get _status(): FileStatus.StatusEnum { + return this.fileStatus.status === FileStatus.StatusEnum.REPROCESS || this.fileStatus.status === FileStatus.StatusEnum.FULLREPROCESS + ? FileStatus.StatusEnum.PROCESSING + : this.fileStatus.status; } } diff --git a/apps/red-ui/src/app/modules/admin/components/dossier-template-actions/dossier-template-actions.component.html b/apps/red-ui/src/app/modules/admin/components/dossier-template-actions/dossier-template-actions.component.html index 255cfba5a..18ad21167 100644 --- a/apps/red-ui/src/app/modules/admin/components/dossier-template-actions/dossier-template-actions.component.html +++ b/apps/red-ui/src/app/modules/admin/components/dossier-template-actions/dossier-template-actions.component.html @@ -1,7 +1,7 @@
(); constructor( - private readonly _dialogService: AdminDialogService, - private readonly _appStateService: AppStateService, - private readonly _dossierTemplateControllerService: DossierTemplateControllerService, - private readonly _loadingService: LoadingService, private readonly _router: Router, - readonly permissionsService: PermissionsService - ) { - if (!this.dossierTemplateId) { - this.dossierTemplateId = this._appStateService.activeDossierTemplateId; - } + private readonly _userService: UserService, + private readonly _loadingService: LoadingService, + private readonly _appStateService: AppStateService, + private readonly _dialogService: AdminDialogService, + private readonly _dossierTemplateControllerService: DossierTemplateControllerService + ) {} + + ngOnInit() { + this.dossierTemplateId ??= this._appStateService.activeDossierTemplateId; } get dossierTemplate() { @@ -48,9 +49,7 @@ export class DossierTemplateActionsComponent { await this._appStateService.loadAllDossierTemplates(); await this._appStateService.loadDictionaryData(); await this._router.navigate(['main', 'admin']); - if (this.loadDossierTemplatesData) { - this.loadDossierTemplatesData.emit(); - } + this.loadDossierTemplatesData?.emit(); }); } } diff --git a/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.html index 808f064d6..f12111140 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.html @@ -5,7 +5,7 @@
diff --git a/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.ts index 7b1279a95..5b1a1c4e8 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.ts @@ -1,7 +1,6 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; import { DictionaryControllerService } from '@redaction/red-ui-http'; import { AppStateService } from '@state/app-state.service'; -import { PermissionsService } from '@services/permissions.service'; import { ActivatedRoute, Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { saveAs } from 'file-saver'; @@ -12,6 +11,7 @@ import { DictionarySaveService } from '@shared/services/dictionary-save.service' import { TypeValueWrapper } from '@models/file/type-value.wrapper'; import { LoadingService } from '@services/loading.service'; import { CircleButtonTypes } from '@iqser/common-ui'; +import { UserService } from '@services/user.service'; @Component({ templateUrl: './dictionary-overview-screen.component.html', @@ -19,33 +19,32 @@ import { CircleButtonTypes } from '@iqser/common-ui'; }) export class DictionaryOverviewScreenComponent extends ComponentHasChanges implements OnInit { readonly circleButtonTypes = CircleButtonTypes; + readonly currentUser = this._userService.currentUser; entries: string[] = []; + dictionary: TypeValueWrapper; @ViewChild('dictionaryManager', { static: false }) private readonly _dictionaryManager: DictionaryManagerComponent; @ViewChild('fileInput') private readonly _fileInput: ElementRef; constructor( - readonly permissionsService: PermissionsService, + private readonly _router: Router, + private readonly _userService: UserService, + private readonly _activatedRoute: ActivatedRoute, + private readonly _loadingService: LoadingService, + private readonly _appStateService: AppStateService, + private readonly _dialogService: AdminDialogService, protected readonly _translateService: TranslateService, private readonly _dictionarySaveService: DictionarySaveService, - private readonly _dictionaryControllerService: DictionaryControllerService, - private readonly _dialogService: AdminDialogService, - private readonly _router: Router, - private readonly _activatedRoute: ActivatedRoute, - private readonly _appStateService: AppStateService, - private readonly _loadingService: LoadingService + private readonly _dictionaryControllerService: DictionaryControllerService ) { super(_translateService); this._appStateService.activateDictionary( this._activatedRoute.snapshot.params.type, this._activatedRoute.snapshot.params.dossierTemplateId ); - } - - get dictionary(): TypeValueWrapper { - return this._appStateService.activeDictionary; + this.dictionary = this._appStateService.activeDictionary; } get hasChanges() { @@ -67,6 +66,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple async () => { this._loadingService.start(); await this._appStateService.loadDictionaryData(); + this.dictionary = this._appStateService.activeDictionary; this._loadingService.stop(); } ); diff --git a/apps/red-ui/src/app/modules/dossier/components/bulk-actions/dossier-overview-bulk-actions.component.ts b/apps/red-ui/src/app/modules/dossier/components/bulk-actions/dossier-overview-bulk-actions.component.ts index bb42177ab..8a99f5303 100644 --- a/apps/red-ui/src/app/modules/dossier/components/bulk-actions/dossier-overview-bulk-actions.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/bulk-actions/dossier-overview-bulk-actions.component.ts @@ -89,7 +89,7 @@ export class DossierOverviewBulkActionsComponent { } get canOcr() { - return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canOcrFile(file), true); + return this.selectedFiles.reduce((acc, file) => acc && file.canBeOCRed, true); } get fileStatuses() { @@ -112,7 +112,7 @@ export class DossierOverviewBulkActionsComponent { } get canApprove() { - return this.selectedFiles.reduce((acc, file) => acc && this._permissionsService.canApprove(file), true); + return this.selectedFiles.reduce((acc, file) => acc && file.canBeApproved, true); } // Undo approval @@ -163,7 +163,7 @@ export class DossierOverviewBulkActionsComponent { } async reanalyse() { - const fileIds = this.selectedFiles.filter(file => this._permissionsService.fileRequiresReanalysis(file)).map(file => file.fileId); + const fileIds = this.selectedFiles.filter(file => file.analysisRequired).map(file => file.fileId); this._performBulkAction( this._reanalysisControllerService.reanalyzeFilesForDossier(fileIds, this._appStateService.activeDossier.dossierId) ); diff --git a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html index f0051f62e..084cdbdb8 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html +++ b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html @@ -88,9 +88,11 @@ @@ -107,7 +109,7 @@ (id => ({ diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html index f1b1bdaf8..1f81ef2ba 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html @@ -57,9 +57,9 @@
@@ -93,15 +93,15 @@
- {{ fileStatus.numberOfExcludedPages }} + {{ fileStatus.excludedPagesCount }}
- {{ fileStatus.ocrTime | date: 'mediumDate' }} + {{ fileStatus.lastOCRTime | date: 'mediumDate' }}
diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts index f962aacb5..d90dfa51c 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts @@ -144,7 +144,7 @@ export class DossierOverviewScreenComponent extends ListingComponent
- + @@ -148,7 +148,7 @@
0 && !this.fileData.fileStatus.isExcluded; + return this.fileData?.redactionChangeLog?.redactionLogEntry?.length > 0 && !this.fileData.fileStatus.excluded; } get canAssign(): boolean { @@ -231,7 +231,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni } async ngOnAttach(previousRoute: ActivatedRouteSnapshot) { - if (!this.permissionsService.canOpenFile(this.appStateService.activeFile)) { + if (!this.appStateService.activeFile.canBeOpened) { await this._router.navigate(['/main/dossiers/' + this.dossierId]); return; } diff --git a/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts b/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts index 81c3ac828..1741957ad 100644 --- a/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts +++ b/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts @@ -38,7 +38,7 @@ export class FileActionService { return this._reanalysisControllerService.toggleAnalysis( fileStatusWrapper.dossierId, fileStatusWrapper.fileId, - !fileStatusWrapper.isExcluded + !fileStatusWrapper.excluded ); } diff --git a/apps/red-ui/src/app/modules/shared/components/filters/popup-filter/utils/filter-utils.ts b/apps/red-ui/src/app/modules/shared/components/filters/popup-filter/utils/filter-utils.ts index a99cc03f1..7fbd2a3d5 100644 --- a/apps/red-ui/src/app/modules/shared/components/filters/popup-filter/utils/filter-utils.ts +++ b/apps/red-ui/src/app/modules/shared/components/filters/popup-filter/utils/filter-utils.ts @@ -1,6 +1,5 @@ import { FileStatusWrapper } from '@models/file/file-status.wrapper'; import { DossierWrapper } from '@state/model/dossier.wrapper'; -import { PermissionsService } from '@services/permissions.service'; import { handleCheckedValue, NestedFilter } from '@iqser/common-ui'; export function handleFilterDelta(oldFilters: NestedFilter[], newFilters: NestedFilter[], allFilters: NestedFilter[]) { @@ -46,17 +45,13 @@ export function handleFilterDelta(oldFilters: NestedFilter[], newFilters: Nested }); } -export const annotationFilterChecker = ( - input: FileStatusWrapper | DossierWrapper, - filter: NestedFilter, - permissionsService: PermissionsService -) => { +export const annotationFilterChecker = (input: FileStatusWrapper | DossierWrapper, filter: NestedFilter) => { switch (filter.key) { case 'analysis': { if (input instanceof DossierWrapper) { - return permissionsService.dossierReanalysisRequired(input); + return input.reanalysisRequired; } else { - return permissionsService.fileRequiresReanalysis(input); + return input.analysisRequired; } } case 'suggestion': { diff --git a/apps/red-ui/src/app/services/permissions.service.ts b/apps/red-ui/src/app/services/permissions.service.ts index c39714027..67acfd59c 100644 --- a/apps/red-ui/src/app/services/permissions.service.ts +++ b/apps/red-ui/src/app/services/permissions.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { AppStateService } from '@state/app-state.service'; -import { UserService, UserWrapper } from './user.service'; +import { UserService } from './user.service'; import { FileStatusWrapper } from '@models/file/file-status.wrapper'; import { Comment } from '@redaction/red-ui-http'; import { DossierWrapper } from '@state/model/dossier.wrapper'; @@ -23,16 +23,8 @@ export class PermissionsService { return this.isFileReviewer(fileStatus) || this.isApprover(); } - dossierReanalysisRequired(dossier: DossierWrapper): boolean { - for (const file of dossier.files) if (this.fileRequiresReanalysis(file)) return true; - } - - fileRequiresReanalysis(fileStatus = this._activeFile): boolean { - return fileStatus.analysisRequired; - } - displayReanalyseBtn(dossier = this._activeDossier): boolean { - return this.isApprover(dossier) && dossier.files.filter(file => this.fileRequiresReanalysis(file)).length > 0; + return this.isApprover(dossier) && dossier.files.filter(file => file.analysisRequired).length > 0; } canToggleAnalysis(fileStatus: FileStatusWrapper): boolean { @@ -41,7 +33,7 @@ export class PermissionsService { canReanalyseFile(fileStatus = this._activeFile): boolean { return ( - (this.fileRequiresReanalysis(fileStatus) && (this.isReviewerOrApprover(fileStatus) || fileStatus.isUnassigned)) || + (fileStatus.analysisRequired && (this.isReviewerOrApprover(fileStatus) || fileStatus.isUnassigned)) || (fileStatus.isError && fileStatus.isUnassigned) ); } @@ -54,10 +46,6 @@ export class PermissionsService { return this.isOwner(dossier) || fileStatus.isUnassigned; } - isApprovedOrUnderApproval(fileStatus = this._activeFile): boolean { - return fileStatus.isApprovedOrUnderApproval; - } - canAssignToSelf(fileStatus = this._activeFile): boolean { const precondition = this.isDossierMember() && !fileStatus.isProcessing && !fileStatus.isError && !fileStatus.isApproved; @@ -96,10 +84,6 @@ export class PermissionsService { return this.canSetUnderReview(fileStatus); } - canApprove(fileStatus = this._activeFile): boolean { - return !fileStatus?.analysisRequired && !fileStatus.hasRequests; - } - canSetUnderApproval(fileStatus = this._activeFile): boolean { return fileStatus?.isUnderReview && this.isReviewerOrApprover(fileStatus); } @@ -124,18 +108,10 @@ export class PermissionsService { return ['UNDER_REVIEW', 'UNDER_APPROVAL'].includes(fileStatus?.status) && this.isFileReviewer(fileStatus); } - canOpenFile(fileStatus = this._activeFile): boolean { - return !fileStatus?.isError && !fileStatus?.isPending; - } - canUndoApproval(fileStatus = this._activeFile): boolean { return fileStatus?.isApproved && this.isApprover(); } - canUndoUnderApproval(fileStatus = this._activeFile): boolean { - return fileStatus?.isUnderApproval && this.isDossierMember(); - } - canMarkPagesAsViewed(fileStatus = this._activeFile): boolean { return ['UNDER_REVIEW', 'UNDER_APPROVAL'].includes(fileStatus?.status) && this.isFileReviewer(fileStatus); } @@ -155,16 +131,6 @@ export class PermissionsService { return user.isAdmin; } - canOcrFile(fileStatus = this._activeFile): boolean { - return ( - !fileStatus.isExcluded && !fileStatus.ocrTime && ['UNASSIGNED', 'UNDER_REVIEW', 'UNDER_APPROVAL'].includes(fileStatus.status) - ); - } - - canManageUsers(user: UserWrapper = this._userService.currentUser): boolean { - return user.isUserAdmin; - } - canAddComment(fileStatus = this._activeFile): boolean { return (this.isFileReviewer(fileStatus) || this.isApprover()) && !fileStatus.isApproved; } diff --git a/apps/red-ui/src/app/state/app-state.service.ts b/apps/red-ui/src/app/state/app-state.service.ts index 88b8d674b..06655441f 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -243,7 +243,6 @@ export class AppStateService { const activeFileWrapper = new FileStatusWrapper( activeFile, this._userService.getNameForId(activeFile.currentReviewer), - this.activeDossierTemplateId, this._appState.fileAttributesConfig[this.activeDossierTemplateId] ); this.activeDossier.files = this.activeDossier?.files.map(file => @@ -669,7 +668,6 @@ export class AppStateService { const fileStatusWrapper = new FileStatusWrapper( file, this._userService.getNameForId(file.currentReviewer), - dossier.dossierTemplateId, this._appState.fileAttributesConfig[dossier.dossierTemplateId] ); if (JSON.stringify(oldFile) !== JSON.stringify(fileStatusWrapper)) { @@ -687,7 +685,6 @@ export class AppStateService { const fsw = new FileStatusWrapper( file, this._userService.getNameForId(file.currentReviewer), - dossier.dossierTemplateId, this._appState.fileAttributesConfig[dossier.dossierTemplateId] ); fileStatusChangedEvent.push(fsw); @@ -699,7 +696,6 @@ export class AppStateService { new FileStatusWrapper( f, this._userService.getNameForId(f.currentReviewer), - dossier.dossierTemplateId, this._appState.fileAttributesConfig[dossier.dossierTemplateId] ) ); diff --git a/apps/red-ui/src/app/state/model/dossier.wrapper.ts b/apps/red-ui/src/app/state/model/dossier.wrapper.ts index a982d0868..28f00575f 100644 --- a/apps/red-ui/src/app/state/model/dossier.wrapper.ts +++ b/apps/red-ui/src/app/state/model/dossier.wrapper.ts @@ -24,6 +24,7 @@ export class DossierWrapper implements Dossier { readonly hasMoreThanOneReviewer = this.memberIds.length > 1; readonly memberCount = this.memberIds.length; + reanalysisRequired = this._files.some(file => file.analysisRequired); hasFiles = this._files.length > 0; filesLength = this._files.length; @@ -81,5 +82,6 @@ export class DossierWrapper implements Dossier { this.hasNone = !this.hasRequests && !this.hasRedactions && !this.hintsOnly; this.hasFiles = this._files.length > 0; this.filesLength = this._files.length; + this.reanalysisRequired = this._files.some(file => file.analysisRequired); } } diff --git a/libs/red-ui-http/src/lib/model/fileStatus.ts b/libs/red-ui-http/src/lib/model/fileStatus.ts index 40fe392e3..357d21c31 100644 --- a/libs/red-ui-http/src/lib/model/fileStatus.ts +++ b/libs/red-ui-http/src/lib/model/fileStatus.ts @@ -169,5 +169,5 @@ export namespace FileStatus { UNDERREVIEW: 'UNDER_REVIEW' as StatusEnum, UNPROCESSED: 'UNPROCESSED' as StatusEnum, INDEXING: 'INDEXING' as StatusEnum - }; + } as const; }