From 64488d06631b782fc61fd0612e4bfc46162b9f36 Mon Sep 17 00:00:00 2001 From: Timo Date: Mon, 5 Apr 2021 17:55:39 +0300 Subject: [PATCH] File Status Updates --- .../app/models/file/file-status.wrapper.ts | 9 ++- .../project-overview-screen.component.ts | 2 +- apps/red-ui/src/assets/i18n/en.json | 1 + .../src/assets/styles/red-components.scss | 5 ++ .../lib/api/reanalysisController.service.ts | 75 +++++++++++++++++++ libs/red-ui-http/src/lib/model/fileStatus.ts | 2 + 6 files changed, 91 insertions(+), 3 deletions(-) diff --git a/apps/red-ui/src/app/models/file/file-status.wrapper.ts b/apps/red-ui/src/app/models/file/file-status.wrapper.ts index 4433d0ed4..6021e9adc 100644 --- a/apps/red-ui/src/app/models/file/file-status.wrapper.ts +++ b/apps/red-ui/src/app/models/file/file-status.wrapper.ts @@ -89,7 +89,7 @@ export class FileStatusWrapper { } get status() { - return this.fileStatus.status === 'REPROCESS' ? 'PROCESSING' : this.fileStatus.status; + return this.fileStatus.status === 'REPROCESS' || this.fileStatus.status === 'FULLREPROCESS' ? 'PROCESSING' : this.fileStatus.status; } get numberOfPages() { @@ -105,7 +105,12 @@ export class FileStatusWrapper { } get isProcessing() { - return [FileStatus.StatusEnum.REPROCESS, FileStatus.StatusEnum.OCR_PROCESSING, FileStatus.StatusEnum.PROCESSING].includes(this.status); + return [ + FileStatus.StatusEnum.REPROCESS, + FileStatus.StatusEnum.FULLREPROCESS, + FileStatus.StatusEnum.OCR_PROCESSING, + FileStatus.StatusEnum.PROCESSING + ].includes(this.status); } get statusSort() { diff --git a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts index 45356c96d..8bd41af50 100644 --- a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts @@ -140,7 +140,7 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { } public isProcessing(fileStatusWrapper: FileStatusWrapper) { - return [FileStatus.StatusEnum.REPROCESS, FileStatus.StatusEnum.PROCESSING].includes(fileStatusWrapper.status); + return [FileStatus.StatusEnum.REPROCESS, FileStatus.StatusEnum.FULLREPROCESS, FileStatus.StatusEnum.PROCESSING].includes(fileStatusWrapper.status); } public get noData() { diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 7fac975cd..d196e3a41 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -451,6 +451,7 @@ }, "UNPROCESSED": "Unprocessed", "REPROCESS": "Processing", + "FULLREPROCESS": "Processing", "PROCESSING": "Processing", "OCR_PROCESSING": "OCR Processing", "ERROR": "Re-processing required", diff --git a/apps/red-ui/src/assets/styles/red-components.scss b/apps/red-ui/src/assets/styles/red-components.scss index 932536098..13236f052 100644 --- a/apps/red-ui/src/assets/styles/red-components.scss +++ b/apps/red-ui/src/assets/styles/red-components.scss @@ -136,6 +136,11 @@ background-color: $grey-1; } +.FULLREPROCESS { + stroke: $grey-1; + background-color: $grey-1; +} + .ERROR { stroke: lighten($red-1, 25%); background-color: lighten($red-1, 25%); diff --git a/libs/red-ui-http/src/lib/api/reanalysisController.service.ts b/libs/red-ui-http/src/lib/api/reanalysisController.service.ts index 4050b8ec2..6b34c836c 100644 --- a/libs/red-ui-http/src/lib/api/reanalysisController.service.ts +++ b/libs/red-ui-http/src/lib/api/reanalysisController.service.ts @@ -374,4 +374,79 @@ export class ReanalysisControllerService { reportProgress: reportProgress }); } + + /** + * Exclude or re-include a file to analysis + * None + * @param projectId projectId + * @param fileId fileId + * @param analysisStatus analysisStatus + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public toggleAnalysis(projectId: string, fileId: string, analysisStatus?: boolean, observe?: 'body', reportProgress?: boolean): Observable; + public toggleAnalysis( + projectId: string, + fileId: string, + analysisStatus?: boolean, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public toggleAnalysis( + projectId: string, + fileId: string, + analysisStatus?: boolean, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public toggleAnalysis( + projectId: string, + fileId: string, + analysisStatus?: boolean, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error('Required parameter projectId was null or undefined when calling toggleAnalysis.'); + } + + if (fileId === null || fileId === undefined) { + throw new Error('Required parameter fileId was null or undefined when calling toggleAnalysis.'); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (analysisStatus !== undefined && analysisStatus !== null) { + queryParameters = queryParameters.set('analysisStatus', analysisStatus); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = []; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'post', + `${this.basePath}/toggle-analysis/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, + { + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } } diff --git a/libs/red-ui-http/src/lib/model/fileStatus.ts b/libs/red-ui-http/src/lib/model/fileStatus.ts index 14f066635..6fbfcd490 100644 --- a/libs/red-ui-http/src/lib/model/fileStatus.ts +++ b/libs/red-ui-http/src/lib/model/fileStatus.ts @@ -114,6 +114,7 @@ export namespace FileStatus { export type StatusEnum = | 'UNPROCESSED' | 'REPROCESS' + | 'FULLREPROCESS' | 'PROCESSING' | 'OCR_PROCESSING' | 'ERROR' @@ -123,6 +124,7 @@ export namespace FileStatus { | 'APPROVED'; export const StatusEnum = { UNPROCESSED: 'UNPROCESSED' as StatusEnum, + FULLREPROCESS: 'FULLREPROCESS' as StatusEnum, REPROCESS: 'REPROCESS' as StatusEnum, PROCESSING: 'PROCESSING' as StatusEnum, OCR_PROCESSING: 'OCR_PROCESSING' as StatusEnum,