From 96601f9c809fc47a9d927c371e3584b73375bd33 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Wed, 26 Jan 2022 11:48:32 +0200 Subject: [PATCH 1/2] RED-3272 primary attr fix --- .../screen-header.component.html | 2 +- .../screen-header/screen-header.component.ts | 53 ++++++++++--------- .../file-name-column.component.ts | 16 ++---- .../primary-file-attribute.service.ts | 29 ++++++++++ libs/red-domain/src/lib/files/file.model.ts | 1 - 5 files changed, 61 insertions(+), 40 deletions(-) create mode 100644 apps/red-ui/src/app/services/primary-file-attribute.service.ts diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/screen-header/screen-header.component.html b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/screen-header/screen-header.component.html index 279dc475f..4a3050292 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/screen-header/screen-header.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/screen-header/screen-header.component.html @@ -12,7 +12,7 @@ > this.sortingService.defaultSort(entities))); sortedEntities$.pipe(take(1)).subscribe(entities => { const fileName = this.dossier.dossierName + '.export.csv'; - saveAsCSV( - fileName, - entities, - [ - 'dossierId', - 'fileId', - 'filename', - 'primaryAttribute', - 'numberOfPages', - 'assignee', - 'workflowStatus', - 'processingStatus', - 'lastUpdated', - 'lastUploaded', - 'lastProcessed', - 'hasHints', - 'hasImages', - 'hasRedactions', - 'hasUpdates', - 'excluded', - ], - fsv => ({ ...fsv, assignee: this._userService.getNameForId(fsv.assignee) }), - ); + const mapper = (file?: IFile) => ({ + ...file, + assignee: this._userService.getNameForId(file.assignee), + primaryAttribute: this._primaryFileAttributeService.getPrimaryFileAttributeValue(file, this.dossier.dossierTemplateId), + }); + const fileFields = [ + 'dossierId', + 'fileId', + 'filename', + 'primaryAttribute', + 'numberOfPages', + 'assignee', + 'workflowStatus', + 'processingStatus', + 'lastUpdated', + 'lastUploaded', + 'lastProcessed', + 'hasHints', + 'hasImages', + 'hasRedactions', + 'hasUpdates', + 'excluded', + ]; + saveAsCSV(fileName, entities, fileFields, mapper); }); } } diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.ts index dbb49eea1..4b205542e 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core'; import { File } from '@red/domain'; -import { FileAttributesService } from '@services/entity-services/file-attributes.service'; +import { PrimaryFileAttributeService } from '../../../../../../../services/primary-file-attribute.service'; @Component({ selector: 'redaction-file-name-column', @@ -13,19 +13,9 @@ export class FileNameColumnComponent implements OnChanges { @Input() dossierTemplateId: string; primaryAttribute: string; - constructor(private readonly _fileAttributesService: FileAttributesService) {} + constructor(private readonly _primaryFileAttributeService: PrimaryFileAttributeService) {} ngOnChanges() { - const fileAttributesConfig = this._fileAttributesService.getFileAttributeConfig(this.dossierTemplateId); - if (fileAttributesConfig) { - const primary = fileAttributesConfig.fileAttributeConfigs?.find(c => c.primaryAttribute); - if (primary && this.file.fileAttributes?.attributeIdToValue) { - this.primaryAttribute = this.file.fileAttributes?.attributeIdToValue[primary.id]; - } - - if (!this.primaryAttribute) { - this.primaryAttribute = '-'; - } - } + this.primaryAttribute = this._primaryFileAttributeService.getPrimaryFileAttributeValue(this.file, this.dossierTemplateId); } } diff --git a/apps/red-ui/src/app/services/primary-file-attribute.service.ts b/apps/red-ui/src/app/services/primary-file-attribute.service.ts new file mode 100644 index 000000000..5a8acdc18 --- /dev/null +++ b/apps/red-ui/src/app/services/primary-file-attribute.service.ts @@ -0,0 +1,29 @@ +import { Injectable } from '@angular/core'; +import { FileAttributesService } from './entity-services/file-attributes.service'; +import { IFile } from '@red/domain'; + +@Injectable({ + providedIn: 'root', +}) +export class PrimaryFileAttributeService { + constructor(private readonly _fileAttributesService: FileAttributesService) {} + + getPrimaryFileAttributeValue(file: IFile, dossierTemplateId: string) { + const fileAttributesConfig = this._fileAttributesService.getFileAttributeConfig(dossierTemplateId); + + let primaryAttribute; + + if (fileAttributesConfig) { + const primary = fileAttributesConfig.fileAttributeConfigs?.find(c => c.primaryAttribute); + if (primary && file.fileAttributes?.attributeIdToValue) { + primaryAttribute = file.fileAttributes?.attributeIdToValue[primary.id]; + } + } + + if (!primaryAttribute) { + primaryAttribute = '-'; + } + + return primaryAttribute; + } +} diff --git a/libs/red-domain/src/lib/files/file.model.ts b/libs/red-domain/src/lib/files/file.model.ts index aa3f705da..f57b0131a 100644 --- a/libs/red-domain/src/lib/files/file.model.ts +++ b/libs/red-domain/src/lib/files/file.model.ts @@ -39,7 +39,6 @@ export class File extends Entity implements IFile { readonly processingStatus: ProcessingFileStatus; readonly workflowStatus: WorkflowFileStatus; - readonly primaryAttribute?: string; readonly statusSort: number; readonly cacheIdentifier?: string; readonly hintsOnly: boolean; From 81d63116eb0272ca2038454553537bd1d0ce21e8 Mon Sep 17 00:00:00 2001 From: Atlassian Bamboo Date: Wed, 26 Jan 2022 10:54:47 +0100 Subject: [PATCH 2/2] chore(release) --- package.json | 2 +- paligo-theme.tar.gz | Bin 3215 -> 3213 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 16bf6f08e..ee649da5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redaction", - "version": "3.181.0", + "version": "3.182.0", "private": true, "license": "MIT", "scripts": { diff --git a/paligo-theme.tar.gz b/paligo-theme.tar.gz index 1e4bf8c682ffe5ef3855de0024d43ea06cb20103..201430c56ac9a2082179c4eb66a4488469c5752e 100644 GIT binary patch literal 3213 zcmV;8407`yiwFP!000001MM5ha^$vk&iV>OuB0TV+2Y#WYLzErSM21HO2u}POD-S@ zHW9H&ng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