From 8b1d63a6757b13a3acd2adfeb5df2808bf79181e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Thu, 17 Feb 2022 19:55:18 +0200 Subject: [PATCH] RED-3411: list indicator --- ...rm-delete-dossier-state-dialog.component.ts | 3 ++- .../file-name-column.component.html | 8 +++++++- .../file-name-column.component.scss | 8 ++++++++ .../table-item/table-item.component.html | 8 +++----- .../workflow-item/workflow-item.component.html | 9 +-------- .../file-preview-screen.component.html | 9 +-------- .../file-preview-screen.component.ts | 2 +- .../file-actions/file-actions.component.html | 9 +-------- .../file-actions/file-actions.component.ts | 2 +- .../translations/file-status-translations.ts | 2 ++ .../processing-indicator.component.html | 3 +++ .../processing-indicator.component.scss | 3 +++ .../processing-indicator.component.ts | 18 ++++++++++++++++++ .../src/app/modules/shared/shared.module.ts | 2 ++ apps/red-ui/src/assets/i18n/en.json | 10 +++++++--- libs/red-domain/src/lib/files/file.model.ts | 8 +++++--- libs/red-domain/src/lib/files/types.ts | 6 +++++- 17 files changed, 70 insertions(+), 40 deletions(-) create mode 100644 apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.html create mode 100644 apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.scss create mode 100644 apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.ts diff --git a/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-dossier-state-dialog/confirm-delete-dossier-state-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-dossier-state-dialog/confirm-delete-dossier-state-dialog.component.ts index 6088cb114..387160092 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-dossier-state-dialog/confirm-delete-dossier-state-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-dossier-state-dialog/confirm-delete-dossier-state-dialog.component.ts @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, Inject } from '@angular/core'; import { IDossierState } from '@red/domain'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { FormBuilder, FormGroup } from '@angular/forms'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; interface DialogData { readonly toBeDeletedState: IDossierState; @@ -38,7 +39,7 @@ export class ConfirmDeleteDossierStateDialogComponent { } get label(): string { - return this.replaceDossierStatusId ? 'confirm-delete-dossier-state.delete-replace' : 'confirm-delete-dossier-state.delete'; + return this.replaceDossierStatusId ? _('confirm-delete-dossier-state.delete-replace') : _('confirm-delete-dossier-state.delete'); } get afterCloseValue(): string | true { diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.html b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.html index 3c6f12950..f6b15ff1b 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.html @@ -1,5 +1,11 @@
-
+
{{ file.filename }}
diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.scss b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.scss index bcbf74f08..6d6ea372d 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.scss +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/file-name-column/file-name-column.component.scss @@ -2,6 +2,14 @@ .table-item-title { max-width: 25vw; + + &.error { + color: var(--iqser-red-1); + } + + &.initial-processing { + color: var(--iqser-disabled); + } } .primary-attribute { diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/table-item.component.html b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/table-item.component.html index 23d443a1f..ac30d92cd 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/table-item.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/table-item/table-item.component.html @@ -40,15 +40,13 @@
-
+
-
- -
+
-
- -
+
-
- -
+ diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts index ff7186de9..6fdff7a0d 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts @@ -566,7 +566,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni return this._router.navigate([this._dossiersService.find(this.dossierId).routerLink]); } - if (file.isPending) { + if (file.isUnprocessed) { return; } diff --git a/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.html b/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.html index a65863042..94b795272 100644 --- a/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.html +++ b/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.html @@ -1,13 +1,6 @@
-
- -
+
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 8b4d73884..cf73d8661 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 @@ -373,7 +373,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy, this.canDisableAutoAnalysis = this._permissionsService.canDisableAutoAnalysis([this.file]); this.canEnableAutoAnalysis = this._permissionsService.canEnableAutoAnalysis([this.file]); - this.showStatusBar = !this.file.isError && !this.file.isPending && this.isDossierOverviewList; + this.showStatusBar = !this.file.isError && !this.file.isUnprocessed && this.isDossierOverviewList; this.showAssignToSelf = this._permissionsService.canAssignToSelf(this.file) && this.isDossierOverview; this.showAssign = diff --git a/apps/red-ui/src/app/modules/dossier/translations/file-status-translations.ts b/apps/red-ui/src/app/modules/dossier/translations/file-status-translations.ts index 4649a8f47..1e413fccd 100644 --- a/apps/red-ui/src/app/modules/dossier/translations/file-status-translations.ts +++ b/apps/red-ui/src/app/modules/dossier/translations/file-status-translations.ts @@ -10,6 +10,8 @@ export const workflowFileStatusTranslations: { [key in WorkflowFileStatus]: stri }; export const processingFileStatusTranslations: { [key in ProcessingFileStatus]: string } = { + ANALYSE: _('file-status.analyse'), + NER_ANALYZING: _('file-status.ner-analyzing'), PROCESSED: _('file-status.processed'), DELETED: _('file-status.deleted'), ERROR: _('file-status.error'), diff --git a/apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.html b/apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.html new file mode 100644 index 000000000..b7f2967c8 --- /dev/null +++ b/apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.scss b/apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.scss new file mode 100644 index 000000000..7f26ddcb5 --- /dev/null +++ b/apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.scss @@ -0,0 +1,3 @@ +:host { + display: block; +} diff --git a/apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.ts b/apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.ts new file mode 100644 index 000000000..c70b5a778 --- /dev/null +++ b/apps/red-ui/src/app/modules/shared/components/processing-indicator/processing-indicator.component.ts @@ -0,0 +1,18 @@ +import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core'; +import { File } from '@red/domain'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; + +@Component({ + selector: 'redaction-processing-indicator [file]', + templateUrl: './processing-indicator.component.html', + styleUrls: ['./processing-indicator.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class ProcessingIndicatorComponent implements OnChanges { + tooltip: string; + @Input() file: File; + + ngOnChanges() { + this.tooltip = this.file.isInitialProcessing ? _('file-status.initial-processing') : _('file-status.re-processing'); + } +} diff --git a/apps/red-ui/src/app/modules/shared/shared.module.ts b/apps/red-ui/src/app/modules/shared/shared.module.ts index 4f606ceb9..939fd0eb7 100644 --- a/apps/red-ui/src/app/modules/shared/shared.module.ts +++ b/apps/red-ui/src/app/modules/shared/shared.module.ts @@ -26,6 +26,7 @@ import { TypeFilterComponent } from './components/type-filter/type-filter.compon import { TeamMembersComponent } from './components/team-members/team-members.component'; import { EditorComponent } from './components/editor/editor.component'; import { ExpandableFileActionsComponent } from './components/expandable-file-actions/expandable-file-actions.component'; +import { ProcessingIndicatorComponent } from '@shared/components/processing-indicator/processing-indicator.component'; const buttons = [FileDownloadBtnComponent, UserButtonComponent]; @@ -41,6 +42,7 @@ const components = [ TypeFilterComponent, TeamMembersComponent, ExpandableFileActionsComponent, + ProcessingIndicatorComponent, ...buttons, ]; diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index df128effe..735fca3da 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -410,8 +410,8 @@ "configurations": "Configurations", "confirm-delete-dossier-state": { "cancel": "Cancel", - "delete-replace": "Delete and Replace", "delete": "Delete only", + "delete-replace": "Delete and Replace", "form": { "status": "Replace Status", "status-placeholder": "Choose another status" @@ -910,12 +910,12 @@ }, "download-type": { "annotated": "Annotated PDF", + "delta-preview": "Delta PDF", "flatten": "Flatten PDF", "label": "{length} document {length, plural, one{version} other{versions}}", "original": "Optimized PDF", "preview": "Preview PDF", - "redacted": "Redacted PDF", - "delta-preview": "Delta PDF" + "redacted": "Redacted PDF" }, "downloads-list": { "actions": { @@ -1248,16 +1248,20 @@ } }, "file-status": { + "analyse": "Analyzing", "approved": "Approved", "deleted": "Deleted", "error": "Re-processing required", "full-reprocess": "Processing", "image-analyzing": "Image Analyzing", "indexing": "Processing", + "initial-processing": "Initial processing...", + "ner-analyzing": "NER Analyzing", "new": "New", "ocr-processing": "OCR Processing", "processed": "Processed", "processing": "Processing...", + "re-processing": "Re-processing...", "reprocess": "Processing", "unassigned": "Unassigned", "under-approval": "Under Approval", diff --git a/libs/red-domain/src/lib/files/file.model.ts b/libs/red-domain/src/lib/files/file.model.ts index d1168ffa2..2c4f19da3 100644 --- a/libs/red-domain/src/lib/files/file.model.ts +++ b/libs/red-domain/src/lib/files/file.model.ts @@ -48,8 +48,9 @@ export class File extends Entity implements IFile { readonly isNew: boolean; readonly isError: boolean; readonly isProcessing: boolean; + readonly isInitialProcessing: boolean; readonly isApproved: boolean; - readonly isPending: boolean; + readonly isUnprocessed: boolean; readonly isUnderReview: boolean; readonly isUnderApproval: boolean; readonly canBeApproved: boolean; @@ -89,6 +90,7 @@ export class File extends Entity implements IFile { this.processingStatus = file.processingStatus; this.workflowStatus = file.workflowStatus; this.isError = this.processingStatus === ProcessingFileStatuses.ERROR; + this.isUnprocessed = this.processingStatus === ProcessingFileStatuses.UNPROCESSED; this.numberOfPages = this.isError ? 0 : file.numberOfPages ?? 0; this.rulesVersion = file.rulesVersion; this.uploader = file.uploader; @@ -99,14 +101,14 @@ export class File extends Entity implements IFile { this.cacheIdentifier = btoa((this.lastUploaded ?? '') + (this.lastOCRTime ?? '')); this.hintsOnly = this.hasHints && !this.hasRedactions; this.hasNone = !this.hasRedactions && !this.hasHints && !this.hasSuggestions; - this.isPending = this.processingStatus === ProcessingFileStatuses.UNPROCESSED; this.isProcessing = isProcessingStatuses.includes(this.processingStatus); + this.isInitialProcessing = this.isProcessing && this.numberOfAnalyses === 0; this.isApproved = this.workflowStatus === WorkflowFileStatuses.APPROVED; this.isNew = this.workflowStatus === WorkflowFileStatuses.NEW; this.isUnderReview = this.workflowStatus === WorkflowFileStatuses.UNDER_REVIEW; this.isUnderApproval = this.workflowStatus === WorkflowFileStatuses.UNDER_APPROVAL; this.canBeApproved = !this.analysisRequired && !this.hasSuggestions && !this.isProcessing && !this.isError; - this.canBeOpened = !this.isError && !this.isPending && this.numberOfAnalyses > 0; + this.canBeOpened = !this.isError && !this.isUnprocessed && this.numberOfAnalyses > 0; this.canBeOCRed = !this.excluded && !this.lastOCRTime && (this.isNew || this.isUnderReview || this.isUnderApproval); if (!this.fileAttributes || !this.fileAttributes.attributeIdToValue) { diff --git a/libs/red-domain/src/lib/files/types.ts b/libs/red-domain/src/lib/files/types.ts index 70155c11f..bce6a1566 100644 --- a/libs/red-domain/src/lib/files/types.ts +++ b/libs/red-domain/src/lib/files/types.ts @@ -11,16 +11,18 @@ export const WorkflowFileStatuses = { export type WorkflowFileStatus = keyof typeof WorkflowFileStatuses; export const ProcessingFileStatuses = { + ANALYSE: 'ANALYSE', DELETED: 'DELETED', ERROR: 'ERROR', FULLREPROCESS: 'FULLREPROCESS', IMAGE_ANALYZING: 'IMAGE_ANALYZING', - SURROUNDING_TEXT_PROCESSING: 'SURROUNDING_TEXT_PROCESSING', INDEXING: 'INDEXING', + NER_ANALYZING: 'NER_ANALYZING', OCR_PROCESSING: 'OCR_PROCESSING', PROCESSED: 'PROCESSED', PROCESSING: 'PROCESSING', REPROCESS: 'REPROCESS', + SURROUNDING_TEXT_PROCESSING: 'SURROUNDING_TEXT_PROCESSING', UNPROCESSED: 'UNPROCESSED', } as const; @@ -32,8 +34,10 @@ export const isProcessingStatuses: List = [ ProcessingFileStatuses.SURROUNDING_TEXT_PROCESSING, ProcessingFileStatuses.OCR_PROCESSING, ProcessingFileStatuses.IMAGE_ANALYZING, + ProcessingFileStatuses.NER_ANALYZING, ProcessingFileStatuses.INDEXING, ProcessingFileStatuses.PROCESSING, + ProcessingFileStatuses.ANALYSE, ] as const; export interface StatusBarConfig {