diff --git a/apps/red-ui/src/app/components/document-info/document-info.component.html b/apps/red-ui/src/app/components/document-info/document-info.component.html index 69608ee31..aafddbd4f 100644 --- a/apps/red-ui/src/app/components/document-info/document-info.component.html +++ b/apps/red-ui/src/app/components/document-info/document-info.component.html @@ -2,7 +2,7 @@
@@ -17,7 +17,10 @@
- 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 +
+
{{ attr.label }}:
+
{{ file.fileAttributes.attributeIdToValue[attr.id] || '-' }}
+
diff --git a/apps/red-ui/src/app/components/document-info/document-info.component.scss b/apps/red-ui/src/app/components/document-info/document-info.component.scss index ee9825e39..0a3a68fc2 100644 --- a/apps/red-ui/src/app/components/document-info/document-info.component.scss +++ b/apps/red-ui/src/app/components/document-info/document-info.component.scss @@ -46,3 +46,13 @@ border-bottom: 1px solid $separator; } } + +.attribute { + > .small-label { + margin-bottom: 6px; + } + + &:not(:last-child) { + margin-bottom: 16px; + } +} diff --git a/apps/red-ui/src/app/components/document-info/document-info.component.ts b/apps/red-ui/src/app/components/document-info/document-info.component.ts index d17f725ce..aea583951 100644 --- a/apps/red-ui/src/app/components/document-info/document-info.component.ts +++ b/apps/red-ui/src/app/components/document-info/document-info.component.ts @@ -1,6 +1,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; -import { FileStatus } from '@redaction/red-ui-http'; +import { FileAttributeConfig, FileAttributesControllerService, FileStatus } from '@redaction/red-ui-http'; import { AppStateService } from '../../state/app-state.service'; +import { DialogService } from '../../dialogs/dialog.service'; @Component({ selector: 'redaction-document-info', @@ -11,11 +12,23 @@ export class DocumentInfoComponent implements OnInit { @Input() file: FileStatus; @Output() closeDocumentInfoView = new EventEmitter(); - constructor(private _appStateService: AppStateService) {} + public fileAttributesConfig: FileAttributeConfig[]; + + constructor( + private readonly _appStateService: AppStateService, + private readonly _fileAttributesService: FileAttributesControllerService, + private readonly _dialogService: DialogService + ) { + this.fileAttributesConfig = this._appStateService.fileAttributesConfig.filter((attr) => attr.visible); + } ngOnInit(): void {} public get project() { return this._appStateService.getProjectById(this.file.projectId); } + + public edit() { + this._dialogService.openDocumentInfoDialog(this.file); + } } diff --git a/apps/red-ui/src/app/components/project-details/project-details.component.html b/apps/red-ui/src/app/components/project-details/project-details.component.html index 035acb908..6c27d7bc5 100644 --- a/apps/red-ui/src/app/components/project-details/project-details.component.html +++ b/apps/red-ui/src/app/components/project-details/project-details.component.html @@ -58,7 +58,7 @@
-
+
{{ 'project-overview.project-details.stats.documents' | translate: { count: appStateService.activeProject.files.length } }} diff --git a/apps/red-ui/src/app/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.html b/apps/red-ui/src/app/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.html index 1f407e450..52179a7da 100644 --- a/apps/red-ui/src/app/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.html +++ b/apps/red-ui/src/app/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.html @@ -10,9 +10,23 @@
+
+ + +
+
{{ 'add-edit-file-attribute.form.read-only' | translate }}
+ +
+ {{ 'add-edit-file-attribute.form.visible' | translate }} +
- + rs.ruleSetId === id); } + public get fileAttributesConfig(): FileAttributeConfig[] { + return this._appState.activeFileAttributesConfig; + } + get activeDictionaryType(): string { return this._appState.activeDictionaryType; } @@ -306,8 +315,16 @@ export class AppStateService { this._appState.activeProjectId = projectId; if (!this.activeProject) { this._appState.activeProjectId = null; + this._appState.activeFileAttributesConfig = []; this._router.navigate(['/ui/projects']); + return; } + this._fileAttributesService + .getFileAttributesConfiguration(this.getProjectById(projectId).ruleSetId) + .toPromise() + .then((data) => { + this._appState.activeFileAttributesConfig = data.fileAttributeConfigs; + }); } activateFile(projectId: string, fileId: string) { diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 07b4df286..f2fd499d4 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -604,7 +604,10 @@ "form": { "name": "Attribute Name", "name-placeholder": "Enter Name", - "read-only": "Make Read-Only" + "column-header": "CSV Column Header", + "column-header-placeholder": "Enter CSV Column Header", + "read-only": "Make Read-Only", + "visible": "Visible in Document Info" }, "save": "Save Attribute" }, @@ -746,7 +749,7 @@ "checkbox-2": "All inputted details on the documents will be lost" }, "document-info": { - "title": "Introduce Document Info", + "title": "Introduce File Attributes", "save": "Save Document Info", "save-approval": "Save and Send for Approval" }, diff --git a/libs/red-ui-http/src/lib/model/fileStatus.ts b/libs/red-ui-http/src/lib/model/fileStatus.ts index 3ca542465..4429e4a45 100644 --- a/libs/red-ui-http/src/lib/model/fileStatus.ts +++ b/libs/red-ui-http/src/lib/model/fileStatus.ts @@ -9,15 +9,12 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ +import { FileAttributes } from './fileAttributes'; /** * Object containing information on a specific file. */ export interface FileStatus { - /** - * Time of last analysis - */ - analysisDuration?: number; /** * Date and time when the file was added to the system. */ @@ -26,6 +23,10 @@ export interface FileStatus { * Shows if all manual changes have been applied by a reanalysis. */ allManualRedactionsApplied?: boolean; + /** + * Shows how long the last analysis took + */ + analysisDuration?: number; /** * Shows the date of approval, if approved. */ @@ -38,6 +39,7 @@ export interface FileStatus { * Shows which dictionary versions was used during the analysis. */ dictionaryVersion?: number; + fileAttributes?: FileAttributes; /** * The ID of the file. */ @@ -50,6 +52,10 @@ export interface FileStatus { * Shows if any hints were found during the analysis. */ hasHints?: boolean; + /** + * Shows if any images were found during the analysis. + */ + hasImages?: boolean; /** * Shows if any redactions were found during the analysis. */ @@ -58,6 +64,10 @@ export interface FileStatus { * Shows if any requests were found during the analysis. */ hasRequests?: boolean; + /** + * Shows if there is any change between the previous and current analysis. + */ + hasUpdates?: boolean; /** * Shows the last date of a successful analysis. */ @@ -78,14 +88,6 @@ export interface FileStatus { * The number of times the file has been analyzed. */ numberOfAnalyses?: number; - /** - * Shows if any images were found during the analysis. - */ - hasImages?: boolean; - /** - * Shows if there is any change between the previous and current analysis. - */ - hasUpdates?: boolean; /** * The number of pages of the file. */