diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts b/apps/red-ui/src/app/modules/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts
index 77b2802d1..dfa7e203b 100644
--- a/apps/red-ui/src/app/modules/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts
+++ b/apps/red-ui/src/app/modules/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts
@@ -182,7 +182,7 @@ export class DossierOverviewBulkActionsComponent implements OnChanges {
this.#canDelete = this._permissionsService.canDeleteFile(this.selectedFiles);
- this.#canReanalyse = this._permissionsService.canReanalyseFile(this.selectedFiles);
+ this.#canReanalyse = this._permissionsService.canReanalyseFile(this.selectedFiles, this.dossier);
this.#canDisableAutoAnalysis = this._permissionsService.canDisableAutoAnalysis(this.selectedFiles);
@@ -196,7 +196,7 @@ export class DossierOverviewBulkActionsComponent implements OnChanges {
this.#canSetToUnderReview = this._permissionsService.canSetUnderReview(this.selectedFiles) && !isWorkflow;
- this.#canSetToUnderApproval = this._permissionsService.canSetUnderApproval(this.selectedFiles) && !isWorkflow;
+ this.#canSetToUnderApproval = this._permissionsService.canSetUnderApproval(this.selectedFiles, this.dossier) && !isWorkflow;
this.#isReadyForApproval = this._permissionsService.isReadyForApproval(this.selectedFiles) && !isWorkflow;
diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/table-item/table-item.component.html b/apps/red-ui/src/app/modules/dossier-overview/components/table-item/table-item.component.html
index 57dd7229a..5e8f03903 100644
--- a/apps/red-ui/src/app/modules/dossier-overview/components/table-item/table-item.component.html
+++ b/apps/red-ui/src/app/modules/dossier-overview/components/table-item/table-item.component.html
@@ -56,5 +56,11 @@
>
-
+
diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/table-item/table-item.component.ts b/apps/red-ui/src/app/modules/dossier-overview/components/table-item/table-item.component.ts
index 33df01b32..657dead78 100644
--- a/apps/red-ui/src/app/modules/dossier-overview/components/table-item/table-item.component.ts
+++ b/apps/red-ui/src/app/modules/dossier-overview/components/table-item/table-item.component.ts
@@ -1,15 +1,15 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
-import { File, IFileAttributeConfig } from '@red/domain';
-import { Required } from '@iqser/common-ui';
+import { Dossier, File, IFileAttributeConfig } from '@red/domain';
@Component({
- selector: 'redaction-table-item',
+ selector: 'redaction-table-item [file] [dossier] [displayedAttributes] [dossierTemplateId]',
templateUrl: './table-item.component.html',
styleUrls: ['./table-item.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TableItemComponent {
- @Input() @Required() file!: File;
- @Input() @Required() displayedAttributes!: IFileAttributeConfig[];
+ @Input() file: File;
+ @Input() dossier: Dossier;
+ @Input() displayedAttributes: IFileAttributeConfig[];
@Input() dossierTemplateId: string;
}
diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/workflow-item/workflow-item.component.html b/apps/red-ui/src/app/modules/dossier-overview/components/workflow-item/workflow-item.component.html
index 4e00dde19..1d1b2c4fa 100644
--- a/apps/red-ui/src/app/modules/dossier-overview/components/workflow-item/workflow-item.component.html
+++ b/apps/red-ui/src/app/modules/dossier-overview/components/workflow-item/workflow-item.component.html
@@ -25,6 +25,7 @@
{
+ workflowConfig(dossier: Dossier): WorkflowConfig {
return {
columnIdentifierFn: entity => entity.workflowStatus,
itemVersionFn: (entity: File) => `${entity.lastUpdated}-${entity.numberOfAnalyses}`,
@@ -83,7 +83,7 @@ export class ConfigService {
label: workflowFileStatusTranslations[WorkflowFileStatuses.UNDER_APPROVAL],
enterFn: (files: File[]) => this._bulkActionsService.setToUnderApproval(files),
enterPredicate: (files: File[]) =>
- this._permissionsService.canSetUnderApproval(files) || this._permissionsService.canUndoApproval(files),
+ this._permissionsService.canSetUnderApproval(files, dossier) || this._permissionsService.canUndoApproval(files),
key: WorkflowFileStatuses.UNDER_APPROVAL,
color: '#374C81',
entities: new BehaviorSubject([]),
diff --git a/apps/red-ui/src/app/modules/dossier-overview/screen/dossier-overview-screen.component.html b/apps/red-ui/src/app/modules/dossier-overview/screen/dossier-overview-screen.component.html
index 020770b34..e7cae904d 100644
--- a/apps/red-ui/src/app/modules/dossier-overview/screen/dossier-overview-screen.component.html
+++ b/apps/red-ui/src/app/modules/dossier-overview/screen/dossier-overview-screen.component.html
@@ -67,6 +67,7 @@
@@ -79,5 +80,9 @@
-
+
diff --git a/apps/red-ui/src/app/modules/dossier-overview/screen/dossier-overview-screen.component.ts b/apps/red-ui/src/app/modules/dossier-overview/screen/dossier-overview-screen.component.ts
index 29244ba09..5b3a1f9d1 100644
--- a/apps/red-ui/src/app/modules/dossier-overview/screen/dossier-overview-screen.component.ts
+++ b/apps/red-ui/src/app/modules/dossier-overview/screen/dossier-overview-screen.component.ts
@@ -69,11 +69,11 @@ export class DossierOverviewScreenComponent extends ListingComponent imple
tableColumnConfigs: readonly TableColumnConfig[];
displayedInFileListAttributes: IFileAttributeConfig[] = [];
displayedAttributes: IFileAttributeConfig[] = [];
- readonly workflowConfig: WorkflowConfig = this.configService.workflowConfig;
+ readonly workflowConfig: WorkflowConfig;
readonly dossier$: Observable;
readonly dossierId: string;
- currentDossier: Dossier;
dossierTemplateId: string;
+ #currentDossier: Dossier;
@ViewChild('needsWorkFilterTemplate', { read: TemplateRef, static: true })
private readonly _needsWorkFilterTemplate: TemplateRef;
@ViewChild('fileInput', { static: true }) private readonly _fileInput: ElementRef;
@@ -101,11 +101,15 @@ export class DossierOverviewScreenComponent extends ListingComponent imple
) {
super(_injector);
this.dossierId = _route.snapshot.paramMap.get(DOSSIER_ID);
- this.dossier$ = this._dossiersService
- .getEntityChanged$(this.dossierId)
- .pipe(tap(dossier => (this.dossierTemplateId = dossier.dossierTemplateId)));
- this.currentDossier = this._dossiersService.find(this.dossierId);
+ this.dossier$ = this._dossiersService.getEntityChanged$(this.dossierId).pipe(
+ tap(dossier => {
+ this.dossierTemplateId = dossier.dossierTemplateId;
+ this.#currentDossier = this._dossiersService.find(this.dossierId);
+ }),
+ );
+ this.#currentDossier = this._dossiersService.find(this.dossierId);
this._updateFileAttributes();
+ this.workflowConfig = this.configService.workflowConfig(this.#currentDossier);
}
get checkedRequiredFilters(): NestedFilter[] {
@@ -121,7 +125,7 @@ export class DossierOverviewScreenComponent extends ListingComponent imple
lastOpenedFn = (file: File) => this._userPreferenceService.getLastOpenedFileForDossier(file.dossierId) === file.id;
async ngOnInit(): Promise {
- this._loadEntitiesFromState();
+ this._computeAllFilters();
this._setRemovableSubscriptions();
@@ -133,7 +137,7 @@ export class DossierOverviewScreenComponent extends ListingComponent imple
)
.subscribe();
- if (this.currentDossier.isActive) {
+ if (this.#currentDossier.isActive) {
this._fileDropOverlayService.initFileDropHandling(this.dossierId);
}
@@ -149,7 +153,7 @@ export class DossierOverviewScreenComponent extends ListingComponent imple
.subscribe();
this.addSubscription = this._dossierTemplatesService
- .getEntityChanged$(this.currentDossier.dossierTemplateId)
+ .getEntityChanged$(this.#currentDossier.dossierTemplateId)
.pipe(
skip(1),
tap(() => {
@@ -159,7 +163,7 @@ export class DossierOverviewScreenComponent extends ListingComponent imple
.subscribe();
try {
- this.dossierAttributes = await this._dossierAttributesService.getWithValues(this.currentDossier);
+ this.dossierAttributes = await this._dossierAttributesService.getWithValues(this.#currentDossier);
} catch (e) {
console.log('Error from dossier overview screen: ', e);
}
@@ -180,8 +184,7 @@ export class DossierOverviewScreenComponent extends ListingComponent imple
@HostListener('drop', ['$event'])
onDrop(event: DragEvent): void {
- const currentDossier = this._dossiersService.find(this.dossierId);
- handleFileDrop(event, currentDossier, this._uploadFiles.bind(this));
+ handleFileDrop(event, this.#currentDossier, this._uploadFiles.bind(this));
}
@HostListener('dragover', ['$event'])
@@ -191,7 +194,7 @@ export class DossierOverviewScreenComponent extends ListingComponent imple
}
async uploadFiles(files: Files): Promise {
- await this._uploadFiles(convertFiles(files, this.currentDossier));
+ await this._uploadFiles(convertFiles(files, this.#currentDossier));
(this._fileInput as any).nativeElement.value = null;
}
@@ -210,18 +213,13 @@ export class DossierOverviewScreenComponent extends ListingComponent imple
private _updateFileAttributes(): void {
this._fileAttributeConfigs =
- this._fileAttributesService.getFileAttributeConfig(this.currentDossier.dossierTemplateId)?.fileAttributeConfigs || [];
+ this._fileAttributesService.getFileAttributeConfig(this.#currentDossier.dossierTemplateId)?.fileAttributeConfigs || [];
this.displayedInFileListAttributes = this._fileAttributeConfigs.filter(config => config.displayedInFileList);
this.displayedAttributes = this.displayedInFileListAttributes.filter(c => c.displayedInFileList);
this.tableColumnConfigs = this.configService.tableConfig(this.displayedAttributes);
this._computeAllFilters();
}
- private _loadEntitiesFromState() {
- this.currentDossier = this._dossiersService.find(this.dossierId);
- this._computeAllFilters();
- }
-
private async _uploadFiles(files: FileUploadModel[]) {
const fileCount = await this._fileUploadService.uploadFiles(files, this.dossierId);
if (fileCount) {
diff --git a/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.ts b/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.ts
index afc999a51..508e8d097 100644
--- a/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.ts
+++ b/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.ts
@@ -12,7 +12,7 @@ import {
ViewChild,
} from '@angular/core';
import { PermissionsService } from '@services/permissions.service';
-import { Action, ActionTypes, File } from '@red/domain';
+import { Action, ActionTypes, Dossier, File } from '@red/domain';
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
import {
AutoUnsubscribe,
@@ -42,7 +42,7 @@ import { RedactionImportService } from '../../services/redaction-import.service'
import { PageRotationService } from '../../../../file-preview/services/page-rotation.service';
@Component({
- selector: 'redaction-file-actions [file] [type]',
+ selector: 'redaction-file-actions [file] [type] [dossier]',
templateUrl: './file-actions.component.html',
styleUrls: ['./file-actions.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -52,6 +52,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
readonly currentUser = this._userService.currentUser;
@Input() file: File;
+ @Input() dossier: Dossier;
@Input() type: 'file-preview' | 'dossier-overview-list' | 'dossier-overview-workflow';
@Input() maxWidth: number;
@Input() fileActionsHelpModeKey: 'document_features' | 'editor_document_features' = 'document_features';
@@ -438,14 +439,14 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
this.showSetToNew = this._permissionsService.canSetToNew(this.file) && !this.isDossierOverviewWorkflow;
this.showUndoApproval = this._permissionsService.canUndoApproval(this.file) && !this.isDossierOverviewWorkflow;
this.showUnderReview = this._permissionsService.canSetUnderReview(this.file) && !this.isDossierOverviewWorkflow;
- this.showUnderApproval = this._permissionsService.canSetUnderApproval(this.file) && !this.isDossierOverviewWorkflow;
+ this.showUnderApproval = this._permissionsService.canSetUnderApproval(this.file, this.dossier) && !this.isDossierOverviewWorkflow;
this.showApprove = this._permissionsService.isReadyForApproval(this.file) && !this.isDossierOverviewWorkflow;
this.canToggleAnalysis = this._permissionsService.canToggleAnalysis(this.file);
this.showToggleAnalysis = this._permissionsService.showToggleAnalysis(this.file);
this.showDelete = this._permissionsService.canDeleteFile(this.file);
this.showOCR = this._permissionsService.canOcrFile(this.file);
- this.canReanalyse = this._permissionsService.canReanalyseFile(this.file);
+ this.canReanalyse = this._permissionsService.canReanalyseFile(this.file, this.dossier);
this.canDisableAutoAnalysis = this._permissionsService.canDisableAutoAnalysis([this.file]);
this.canEnableAutoAnalysis = this._permissionsService.canEnableAutoAnalysis([this.file]);
diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-details/annotation-details.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotation-details/annotation-details.component.ts
index 7d01f50dc..594d0b0ee 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/annotation-details/annotation-details.component.ts
+++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-details/annotation-details.component.ts
@@ -4,6 +4,7 @@ import { TranslateService } from '@ngx-translate/core';
import { annotationChangesTranslations } from '../../../../translations/annotation-changes-translations';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { MultiSelectService } from '../../services/multi-select.service';
+import { KeysOf } from '@iqser/common-ui';
interface Engine {
readonly icon: string;
@@ -46,12 +47,13 @@ export class AnnotationDetailsComponent implements OnChanges {
}
private _updateChanges(): void {
- const changesProperties = [
+ const changesProperties: KeysOf[] = [
'hasBeenResized',
'hasBeenRecategorized',
'hasLegalBasisChanged',
- 'hasBeenForced',
'hasBeenRemovedByManualOverride',
+ 'hasBeenForcedRedaction',
+ 'hasBeenForcedHint',
];
const changes = changesProperties.filter(key => this.annotation[key]);
const header = this._translateService.instant(_('annotation-changes.header'));
diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.html b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.html
index 8f1822104..5a078278f 100644
--- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.html
+++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.html
@@ -19,6 +19,7 @@
this._canReanalyseFile(_file) && acc, true);
+ return files.reduce((acc, _file) => this._canReanalyseFile(_file, dossier) && acc, true);
}
canEnableAutoAnalysis(files: File[]): boolean {
@@ -133,9 +132,9 @@ export class PermissionsService {
return this.canSetUnderReview(files);
}
- canSetUnderApproval(file: File | File[]): boolean {
+ canSetUnderApproval(file: File | File[], dossier: Dossier): boolean {
const files = file instanceof File ? [file] : file;
- return files.reduce((acc, _file) => this._canSetUnderApproval(_file) && acc, true);
+ return files.reduce((acc, _file) => this._canSetUnderApproval(_file, dossier) && acc, true);
}
isOwner(dossier: Dossier, user = this._userService.currentUser): boolean {
@@ -146,10 +145,6 @@ export class PermissionsService {
return dossier.approverIds.indexOf(user.id) >= 0;
}
- isDossierReviewer(dossier: Dossier, user = this._userService.currentUser): boolean {
- return this.isDossierMember(dossier, user) && !this.isApprover(dossier, user);
- }
-
isDossierMember(dossier: Dossier, user = this._userService.currentUser): boolean {
return dossier.memberIds.includes(user.id);
}
@@ -253,8 +248,8 @@ export class PermissionsService {
);
}
- private _canReanalyseFile(file: File): boolean {
- return this._isActive(file) && this.isReviewerOrApprover(file) && file.analysisRequired;
+ private _canReanalyseFile(file: File, dossier: Dossier): boolean {
+ return this._isActive(file) && this.isReviewerOrApprover(file, dossier) && file.analysisRequired;
}
private _canEnableAutoAnalysis(file: File): boolean {
@@ -281,8 +276,8 @@ export class PermissionsService {
return precondition && (file.isNew || file.isUnderReview || (file.isUnderApproval && this.isApprover(dossier)));
}
- private _canSetUnderApproval(file: File): boolean {
- return this._isActive(file) && file.isUnderReview && this.isReviewerOrApprover(file);
+ private _canSetUnderApproval(file: File, dossier: Dossier): boolean {
+ return this._isActive(file) && file.isUnderReview && this.isReviewerOrApprover(file, dossier);
}
private _canUndoApproval(file: File, dossier: Dossier): boolean {