Merge branch 'RED-10405' into 'master'

RED-10405: added labels and filtering for separate file pending types.

See merge request redactmanager/red-ui!695
This commit is contained in:
Dan Percic 2024-11-13 09:38:33 +01:00
commit acf4a4f4d7
13 changed files with 125 additions and 36 deletions

View File

@ -61,7 +61,7 @@
*ngFor="let config of statusConfig"
[attr.help-mode-key]="'dashboard_in_dossier'"
[config]="config"
filterKey="processingTypeFilters"
[filterKey]="PendingTypes[config.id] ? 'pendingTypeFilters' : 'processingTypeFilters'"
></iqser-progress-bar>
</div>

View File

@ -21,7 +21,9 @@ import {
DossierAttributeWithValue,
DossierStats,
File,
FileErrorCodes,
IDossierRequest,
PendingTypes,
ProcessingTypes,
StatusSorter,
User,
@ -74,6 +76,7 @@ export class DossierDetailsComponent extends ContextComponent<DossierDetailsCont
#currentChartSubtitleIndex = 0;
readonly #dossierId = getParam(DOSSIER_ID);
protected readonly circleButtonTypes = CircleButtonTypes;
protected readonly PendingTypes = PendingTypes;
@Input() dossierAttributes: DossierAttributeWithValue[];
@Output() readonly toggleCollapse = new EventEmitter();
editingOwner = false;
@ -153,6 +156,10 @@ export class DossierDetailsComponent extends ContextComponent<DossierDetailsCont
}
#calculateStatusConfig(stats: DossierStats): ProgressBarConfigModel[] {
const files = this._filesMapService.get(this.#dossierId);
const numberOfRulesLockedFiles = files.filter(file => file.errorCode === FileErrorCodes.LOCKED_RULES).length;
const numberOfTimeoutFiles = files.filter(file => file.errorCode === FileErrorCodes.RULES_EXECUTION_TIMEOUT).length;
const numberOfUnknownErrorFiles = stats.processingStats.pending - numberOfRulesLockedFiles - numberOfTimeoutFiles;
return [
{
id: ProcessingTypes.pending,
@ -161,6 +168,27 @@ export class DossierDetailsComponent extends ContextComponent<DossierDetailsCont
count: stats.processingStats.pending,
icon: 'red:reanalyse',
},
{
id: PendingTypes.lockedRules,
label: _('processing-status.pending-locked-rules'),
total: stats.numberOfFiles,
count: numberOfRulesLockedFiles,
icon: 'red:reanalyse',
},
{
id: PendingTypes.timeout,
label: _('processing-status.pending-timeout'),
total: stats.numberOfFiles,
count: numberOfTimeoutFiles,
icon: 'red:reanalyse',
},
{
id: PendingTypes.unknown,
label: _('processing-status.pending-unknown'),
total: stats.numberOfFiles,
count: numberOfUnknownErrorFiles,
icon: 'red:reanalyse',
},
{
id: ProcessingTypes.ocr,
label: _('processing-status.ocr'),

View File

@ -39,7 +39,12 @@
</ng-container>
<div [class.extend-cols]="file.isError" class="status-container cell">
<div *ngIf="file.isError" class="small-label error" translate="dossier-overview.file-listing.file-entry.file-error"></div>
<div
*ngIf="file.isError"
class="small-label error"
translate="dossier-overview.file-listing.file-entry.file-error"
[translateParams]="{ errorCode: file.errorCode }"
></div>
<div *ngIf="file.isUnprocessed" class="small-label" translate="dossier-overview.file-listing.file-entry.file-pending"></div>

View File

@ -24,6 +24,7 @@ import {
FileAttributeConfigType,
FileAttributeConfigTypes,
IFileAttributeConfig,
PendingType,
ProcessingType,
StatusSorter,
User,
@ -184,6 +185,7 @@ export class ConfigService {
const allDistinctPeople = new Set<string>();
const allDistinctNeedsWork = new Set<string>();
const allDistinctProcessingTypes = new Set<ProcessingType>();
const allDistinctPendingTypes = new Set<PendingType>();
const dynamicFilters = new Map<string, { type: FileAttributeConfigType; filterValue: Set<string> }>();
@ -216,6 +218,7 @@ export class ConfigService {
}
allDistinctProcessingTypes.add(file.processingType);
allDistinctPendingTypes.add(file.pendingType);
// extract values for dynamic filters
fileAttributeConfigs.forEach(config => {
@ -317,6 +320,14 @@ export class ConfigService {
hide: true,
});
const pendingTypesFilters = [...allDistinctPendingTypes].map(item => new NestedFilter({ id: item, label: item }));
filterGroups.push({
slug: 'pendingTypeFilters',
filters: pendingTypesFilters,
checker: (file: File, filter: INestedFilter) => file.pendingType === filter.id,
hide: true,
});
dynamicFilters.forEach((value: { filterValue: Set<string>; type: FileAttributeConfigType }, filterKey: string) => {
const id = filterKey.split(':')[0];
const key = filterKey.split(':')[1];

View File

@ -987,7 +987,7 @@
"download-file-disabled": "Download: Sie müssen Genehmiger im Dossier sein und die initiale Verarbeitung {count, plural, one{der Datei} other{der Dateien}} muss abgeschlossen sein.",
"file-listing": {
"file-entry": {
"file-error": "Reanalyse erforderlich",
"file-error": "Reanalyse erforderlich ({errorCode, select, RULES_EXECUTION_TIMEOUT{Zeitlimit für Regeln} LOCKED_RULES{Regeln gesperrt} other{unbekannt}})",
"file-pending": "Ausstehend ..."
}
},
@ -1463,7 +1463,7 @@
"save": {
"error": "Erstellung der Datei-Attribute fehlgeschlagen.",
"label": "Attribute speichern",
"success": "{count} Datei-{count, plural, one{Attribut} other{Attribute}} erfolgreich erstellt!"
"success": "{count} Datei-{count, plural, one{Attribut} other{Attribute}} erfolgreich erstellt."
},
"search": {
"placeholder": "Nach Spaltennamen suchen..."
@ -2101,6 +2101,9 @@
"processing-status": {
"ocr": "OCR",
"pending": "Ausstehend",
"pending-locked-rules": "Ausstehend (Regeln gesperrt)",
"pending-timeout": "Ausstehend (Zeitlimit für Regeln)",
"pending-unknown": "Ausstehend (unbekannt)",
"processed": "Verarbeitet",
"processing": "Verarbeitung läuft"
},
@ -2371,8 +2374,8 @@
"inactive": "Inaktiv",
"manager-admin": "{count, plural, one{Manager & Admin} other{Manager & Admins}}",
"no-role": "Keine Rolle definiert",
"red-admin": "Anwendungsadmin",
"red-manager": "Manager",
"red-admin": "{count, plural, one{Anwendungsadmin} other{Anwendungsadmins}}",
"red-manager": "{count, plural, one{Manager} other{Manager}}",
"red-user": "Benutzer",
"red-user-admin": "{count, plural, one{Benutzeradmin} other{Benutzeradmins}}",
"regular": "{number, plural, one{{regulärer Benutzer}} other{reguläre Benutzer}}"

View File

@ -987,7 +987,7 @@
"download-file-disabled": "To download, ensure you are an approver in the dossier, and the {count, plural, one{file has undergone} other{files have undergone}} initial processing.",
"file-listing": {
"file-entry": {
"file-error": "Re-processing required",
"file-error": "Re-processing required ({errorCode, select, RULES_EXECUTION_TIMEOUT{Rules timeout} LOCKED_RULES{Rules locked} other{unknown}})",
"file-pending": "Pending..."
}
},
@ -2101,6 +2101,9 @@
"processing-status": {
"ocr": "OCR",
"pending": "Pending",
"pending-locked-rules": "Pending (Rules locked)",
"pending-timeout": "Pending (Rules timeout)",
"pending-unknown": "Pending (unknown)",
"processed": "Processed",
"processing": "Processing"
},

View File

@ -987,7 +987,7 @@
"download-file-disabled": "Download: Sie müssen Genehmiger im Dossier sein und die initiale Verarbeitung {count, plural, one{der Datei} other{der Dateien}} muss abgeschlossen sein.",
"file-listing": {
"file-entry": {
"file-error": "Reanalyse erforderlich",
"file-error": "Reanalyse erforderlich ({errorCode, select, RULES_EXECUTION_TIMEOUT{Zeitlimit für Regeln} LOCKED_RULES{Regeln gesperrt} other{unbekannt}})",
"file-pending": "Ausstehend ..."
}
},
@ -1385,7 +1385,7 @@
},
"file": {
"action": "Zurück zum Dossier",
"label": "Diese Datei wurde gelöscht!"
"label": "Diese Datei wurde gelöscht."
}
},
"file-preview": {
@ -2101,6 +2101,9 @@
"processing-status": {
"ocr": "OCR",
"pending": "Ausstehend",
"pending-locked-rules": "Ausstehend (Regeln gesperrt)",
"pending-timeout": "Ausstehend (Zeitlimit für Regeln)",
"pending-unknown": "Ausstehend (unbekannt)",
"processed": "Verarbeitet",
"processing": "Verarbeitung läuft"
},
@ -2294,7 +2297,7 @@
}
}
},
"invalid-upload": "Ungültiges Upload-Format ausgewählt! Unterstützt werden Dokumente im .xlsx- und im .docx-Format",
"invalid-upload": "Ungültiges Upload-Format ausgewählt. Unterstützte Formate: .xlsx- und .docx",
"multi-file-report": "(Mehrere Dateien)",
"report-documents": "Berichtsvorlagen",
"setup": "Dieser Platzhalter wird durch die Nummer der Seite ersetzt, auf der sich die Schwärzung befindet.",

View File

@ -987,7 +987,7 @@
"download-file-disabled": "To download, ensure you are an approver in the dossier, and the {count, plural, one{file has undergone} other{files have undergone}} initial processing.",
"file-listing": {
"file-entry": {
"file-error": "Re-processing required",
"file-error": "Re-processing required ({errorCode, select, RULES_EXECUTION_TIMEOUT{Rules timeout} LOCKED_RULES{Rules locked} other{unknown}})",
"file-pending": "Pending..."
}
},
@ -2101,6 +2101,9 @@
"processing-status": {
"ocr": "OCR",
"pending": "Pending",
"pending-locked-rules": "Pending (Rules locked)",
"pending-timeout": "Pending (Rules timeout)",
"pending-unknown": "Pending (unknown)",
"processed": "Processed",
"processing": "Processing"
},

View File

@ -1,22 +1,6 @@
import {
isProcessingStatuses,
OCR_STATES,
PENDING_STATES,
PROCESSED_STATES,
PROCESSING_STATES,
ProcessingFileStatus,
} from '../files/types';
import { isProcessingStatuses, OCR_STATES, PENDING_STATES, PROCESSED_STATES, PROCESSING_STATES, ProcessingFileStatus } from '../files';
import { IDossierStats } from './dossier-stats';
import { FileCountPerProcessingStatus, FileCountPerWorkflowStatus } from './types';
export const ProcessingTypes = {
pending: 'pending',
ocr: 'ocr',
processing: 'processing',
processed: 'processed',
} as const;
export type ProcessingType = keyof typeof ProcessingTypes;
import { FileCountPerProcessingStatus, FileCountPerWorkflowStatus, ProcessingType } from './types';
export type ProcessingStats = Record<ProcessingType, number>;

View File

@ -1,4 +1,21 @@
import { ProcessingFileStatus, WorkflowFileStatus } from '../files/types';
import { ProcessingFileStatus, WorkflowFileStatus } from '../files';
export type FileCountPerWorkflowStatus = { [key in WorkflowFileStatus]?: number };
export type FileCountPerProcessingStatus = { [key in ProcessingFileStatus]?: number };
export const ProcessingTypes = {
pending: 'pending',
ocr: 'ocr',
processing: 'processing',
processed: 'processed',
} as const;
export type ProcessingType = keyof typeof ProcessingTypes;
export const PendingTypes = {
lockedRules: 'lockedRules',
timeout: 'timeout',
unknown: 'unknown',
} as const;
export type PendingType = keyof typeof PendingTypes;

View File

@ -1,10 +1,12 @@
import { Entity } from '@iqser/common-ui';
import { ProcessingType, ProcessingTypes } from '../dossier-stats/dossier-stats.model';
import { ARCHIVE_ROUTE, DOSSIERS_ROUTE } from '../dossiers/constants';
import { FileAttributes } from '../file-attributes/file-attributes';
import { StatusSorter } from '../shared/sorters/status-sorter';
import { PendingType, PendingTypes, ProcessingType, ProcessingTypes } from '../dossier-stats';
import { ARCHIVE_ROUTE, DOSSIERS_ROUTE } from '../dossiers';
import { FileAttributes } from '../file-attributes';
import { StatusSorter } from '../shared';
import { IFile } from './file';
import {
FileErrorCode,
FileErrorCodes,
isFullProcessingStatuses,
isProcessingStatuses,
OCR_STATES,
@ -81,6 +83,8 @@ export class File extends Entity<IFile> implements IFile {
readonly canBeOCRed: boolean;
readonly processingType: ProcessingType;
readonly errorCode?: FileErrorCode;
readonly pendingType?: PendingType;
constructor(
file: IFile,
@ -120,7 +124,7 @@ export class File extends Entity<IFile> implements IFile {
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.numberOfPages = this.isError ? 0 : (file.numberOfPages ?? 0);
this.rulesVersion = file.rulesVersion;
this.uploader = file.uploader;
this.excludedPages = file.excludedPages || [];
@ -157,6 +161,8 @@ export class File extends Entity<IFile> implements IFile {
file.fileAttributes && file.fileAttributes.attributeIdToValue ? file.fileAttributes : { attributeIdToValue: {} };
this.processingType = this.#processingType;
this.errorCode = file.fileErrorInfo?.errorCode;
this.pendingType = this.processingType === ProcessingTypes.pending ? this.#pendingType : undefined;
}
get deleted(): boolean {
@ -189,6 +195,16 @@ export class File extends Entity<IFile> implements IFile {
return ProcessingTypes.processed;
}
get #pendingType(): PendingType {
if (this.errorCode === FileErrorCodes.LOCKED_RULES) {
return PendingTypes.lockedRules;
}
if (this.errorCode === FileErrorCodes.RULES_EXECUTION_TIMEOUT) {
return PendingTypes.timeout;
}
return PendingTypes.unknown;
}
isPageExcluded(page: number): boolean {
return this.excludedPages.includes(page);
}

View File

@ -2,7 +2,7 @@
* Object containing information on a specific file.
*/
import { FileAttributes } from '../file-attributes';
import { ProcessingFileStatus, WorkflowFileStatus } from './types';
import { FileErrorInfo, ProcessingFileStatus, WorkflowFileStatus } from './types';
export interface IFile {
/**
@ -147,4 +147,5 @@ export interface IFile {
readonly fileManipulationDate: string | null;
readonly redactionModificationDate: string | null;
readonly lastManualChangeDate?: string;
readonly fileErrorInfo?: FileErrorInfo;
}

View File

@ -96,3 +96,18 @@ export const PROCESSING_STATES: ProcessingFileStatus[] = [
export const PROCESSED_STATES: ProcessingFileStatus[] = [ProcessingFileStatuses.PROCESSED];
export const OCR_STATES: ProcessingFileStatus[] = [ProcessingFileStatuses.OCR_PROCESSING, ProcessingFileStatuses.OCR_PROCESSING_QUEUED];
export const FileErrorCodes = {
RULES_EXECUTION_TIMEOUT: 'RULES_EXECUTION_TIMEOUT',
LOCKED_RULES: 'LOCKED_RULES',
} as const;
export type FileErrorCode = keyof typeof FileErrorCodes;
export interface FileErrorInfo {
cause: string;
queue: string;
service: string;
timestamp: string;
errorCode?: FileErrorCode;
}