From bbafad9d07a9cc5d09e77bfa5c81eba0fe2a9be3 Mon Sep 17 00:00:00 2001 From: Timo Date: Fri, 5 Feb 2021 14:00:24 +0200 Subject: [PATCH] UI Update for download queue --- .../file-download-btn.component.ts | 16 +--- .../digital-signature-screen.component.html | 4 +- .../digital-signature-screen.component.ts | 6 +- .../base-screen/base-screen.component.ts | 2 +- .../file-preview-screen.component.html | 11 +-- .../file-preview-screen.component.ts | 6 +- .../project-listing-screen.component.html | 10 +-- .../download-status-overlay.component.html | 35 -------- .../download-status-overlay.component.scss | 3 - .../download-status-overlay.component.ts | 42 --------- .../upload-download/file-download.service.ts | 19 +--- .../file-upload-download.module.ts | 7 +- .../model/download-status.wrapper.ts | 1 - .../upload-download/status-overlay.service.ts | 21 ----- .../api/digitalSignatureController.service.ts | 73 +++++++++++++-- .../lib/api/redactionLogController.service.ts | 90 +++++++++++++++---- .../src/lib/model/digitalSignature.ts | 6 +- .../lib/model/digitalSignatureViewModel.ts | 18 ++++ libs/red-ui-http/src/lib/model/models.ts | 3 + .../src/lib/model/redactionChangeLog.ts | 20 +++++ .../src/lib/model/redactionChangeLogEntry.ts | 55 ++++++++++++ .../src/lib/model/redactionLogEntry.ts | 3 +- 22 files changed, 264 insertions(+), 187 deletions(-) delete mode 100644 apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.html delete mode 100644 apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.scss delete mode 100644 apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.ts create mode 100644 libs/red-ui-http/src/lib/model/digitalSignatureViewModel.ts create mode 100644 libs/red-ui-http/src/lib/model/redactionChangeLog.ts create mode 100644 libs/red-ui-http/src/lib/model/redactionChangeLogEntry.ts diff --git a/apps/red-ui/src/app/components/buttons/file-download-btn/file-download-btn.component.ts b/apps/red-ui/src/app/components/buttons/file-download-btn/file-download-btn.component.ts index c51f4c463..82cc64d50 100644 --- a/apps/red-ui/src/app/components/buttons/file-download-btn/file-download-btn.component.ts +++ b/apps/red-ui/src/app/components/buttons/file-download-btn/file-download-btn.component.ts @@ -1,11 +1,9 @@ -import { ChangeDetectorRef, Component, Input } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { PermissionsService } from '../../../common/service/permissions.service'; import { ProjectWrapper } from '../../../state/model/project.wrapper'; import { FileStatusWrapper } from '../../../screens/file/model/file-status.wrapper'; -import { FileManagementControllerService } from '@redaction/red-ui-http'; -import { StatusOverlayService } from '../../../upload-download/status-overlay.service'; import { FileDownloadService } from '../../../upload-download/file-download.service'; -import { UserPreferenceService } from '../../../common/service/user-preference.service'; +import { NotificationService } from '../../../notification/notification.service'; export type MenuState = 'OPEN' | 'CLOSED'; @@ -24,10 +22,7 @@ export class FileDownloadBtnComponent { constructor( private readonly _permissionsService: PermissionsService, private readonly _fileDownloadService: FileDownloadService, - private readonly _userPreferencesService: UserPreferenceService, - private readonly _changeDetectorRef: ChangeDetectorRef, - private readonly _statusOverlayService: StatusOverlayService, - private readonly _fileManagementControllerService: FileManagementControllerService + private readonly _notificationService: NotificationService ) {} get canDownloadFiles() { @@ -41,9 +36,6 @@ export class FileDownloadBtnComponent { downloadFiles($event: MouseEvent) { $event.stopPropagation(); // Bulk Download - this._fileDownloadService.downloadFiles(Array.isArray(this.file) ? this.file : [this.file], this.project).subscribe((data) => { - this._statusOverlayService.openDownloadStatusOverlay(); - this._changeDetectorRef.detectChanges(); - }); + this._fileDownloadService.downloadFiles(Array.isArray(this.file) ? this.file : [this.file], this.project).subscribe((data) => {}); } } diff --git a/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.html b/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.html index 2ebeece77..d96cdbab1 100644 --- a/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.html +++ b/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.html @@ -26,7 +26,7 @@ -
+
-
+
diff --git a/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.ts b/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.ts index 7381bc6a6..49e1a45b5 100644 --- a/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.ts +++ b/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.ts @@ -32,7 +32,7 @@ export class DigitalSignatureScreenComponent { const digitalSignature = { ...this.digitalSignatureForm.getRawValue() }; - + //adjusted for chrome auto-complete / password manager digitalSignature.password = digitalSignature.keySecret; this._digitalSignatureControllerService.saveDigitalSignature(digitalSignature).subscribe( @@ -116,10 +116,10 @@ export class DigitalSignatureScreenComponent { private _initForm() { this.digitalSignatureForm = this._formBuilder.group({ - certificateName: { value: this.digitalSignature.certificateName, disabled: true }, + certificateName: [this.digitalSignature.certificateName, Validators.required], contactInfo: this.digitalSignature.contactInfo, location: this.digitalSignature.location, - keySecret: this.digitalSignature.password, + keySecret: [this.digitalSignature.password, Validators.required], reason: this.digitalSignature.reason, base64EncodedPrivateKey: [this.digitalSignature.base64EncodedPrivateKey, Validators.required] }); diff --git a/apps/red-ui/src/app/screens/base-screen/base-screen.component.ts b/apps/red-ui/src/app/screens/base-screen/base-screen.component.ts index 4d40a3b1b..b3e164153 100644 --- a/apps/red-ui/src/app/screens/base-screen/base-screen.component.ts +++ b/apps/red-ui/src/app/screens/base-screen/base-screen.component.ts @@ -48,7 +48,7 @@ export class BaseScreenComponent { } get showPendingDownloadsDot() { - return this.fileDownloadService.pendingDownloads.length > 0 && !this._statusOverlayService.isDownloadOverlayOpen; + return this.fileDownloadService.hasPendingDownloads; } logout() { diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html index d60fdc47e..15ca17419 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html @@ -114,7 +114,7 @@ @@ -142,6 +142,7 @@ - -
diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts index 345c5207a..5efca496b 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts @@ -294,7 +294,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy { if (this.fullScreen) { this._openFullScreen(); } else { - this._closeFullScreen(); + this.closeFullScreen(); } } @@ -306,7 +306,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy { if (['Escape'].includes($event.key)) { this.fullScreen = false; - this._closeFullScreen(); + this.closeFullScreen(); } if (['f', 'F'].includes($event.key)) { @@ -602,7 +602,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy { } /* Close fullscreen */ - private _closeFullScreen() { + closeFullScreen() { if (document.exitFullscreen) { document.exitFullscreen(); } diff --git a/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.html b/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.html index b5524821d..747243fce 100644 --- a/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.html +++ b/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.html @@ -87,12 +87,6 @@
{{ pw.project.projectName }}
-
-
- - {{ getRuleSet(pw).name }} -
-
@@ -114,6 +108,10 @@ {{ pw.project.dueDate | date: 'mediumDate' }}
+
+ + {{ getRuleSet(pw).name }} +
diff --git a/apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.html b/apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.html deleted file mode 100644 index d67d1c0ed..000000000 --- a/apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.html +++ /dev/null @@ -1,35 +0,0 @@ -
-
-
- {{ 'download-status.dialog.title' | translate: { len: downloadService.pendingDownloads.length } }} -
-
- -
-
- -
-
- -
-
-
-
-
-
-
- {{ model.filename }} -
- -
- -
-
-
-
-
-
diff --git a/apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.scss b/apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.scss deleted file mode 100644 index d587e0315..000000000 --- a/apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.red-upload-download-overlay { - left: 10px; -} diff --git a/apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.ts b/apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.ts deleted file mode 100644 index 878b7d065..000000000 --- a/apps/red-ui/src/app/upload-download/download-status-overlay/download-status-overlay.component.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; -import { OverlayRef } from '@angular/cdk/overlay'; -import { FileDownloadService } from '../file-download.service'; -import { DownloadStatus } from '@redaction/red-ui-http'; - -@Component({ - selector: 'redaction-download-status-overlay', - templateUrl: './download-status-overlay.component.html', - styleUrls: ['./download-status-overlay.component.scss'] -}) -export class DownloadStatusOverlay implements OnInit { - collapsed = false; - - downloadStatusInterval: number; - - constructor( - public readonly downloadService: FileDownloadService, - private readonly _overlayRef: OverlayRef, - private readonly _changeDetectorRef: ChangeDetectorRef - ) {} - - ngOnInit() { - this.downloadStatusInterval = setInterval(() => { - // keep only errors - if (this.downloadService.pendingDownloads.length === 0) { - this.closeDialog(); - } - }, 2500); - } - - closeDialog() { - if (this.downloadStatusInterval) { - clearInterval(this.downloadStatusInterval); - this.downloadStatusInterval = null; - } - this._overlayRef.detach(); - } - - hasError(downloadStatus: DownloadStatus) { - return downloadStatus.status === 'FAILED'; - } -} diff --git a/apps/red-ui/src/app/upload-download/file-download.service.ts b/apps/red-ui/src/app/upload-download/file-download.service.ts index 13fcf2b94..98f8b19eb 100644 --- a/apps/red-ui/src/app/upload-download/file-download.service.ts +++ b/apps/red-ui/src/app/upload-download/file-download.service.ts @@ -1,5 +1,5 @@ import { ApplicationRef, Injectable } from '@angular/core'; -import { DownloadControllerService, DownloadStatus, FileManagementControllerService } from '@redaction/red-ui-http'; +import { DownloadControllerService, FileManagementControllerService } from '@redaction/red-ui-http'; import { interval, Observable } from 'rxjs'; import { AppConfigService } from '../app-config/app-config.service'; import { TranslateService } from '@ngx-translate/core'; @@ -17,8 +17,8 @@ import { PermissionsService } from '../common/service/permissions.service'; }) export class FileDownloadService { public downloads: DownloadStatusWrapper[] = []; - public pendingDownloads: DownloadStatusWrapper[] = []; - private inProgressDownloads = new Set(); + + public hasPendingDownloads; constructor( private readonly _applicationRef: ApplicationRef, @@ -56,19 +56,12 @@ export class FileDownloadService { return this._downloadControllerService.getDownloadStatus().pipe( tap((statusResponse) => { this.downloads = statusResponse.downloadStatus.map((d) => new DownloadStatusWrapper(d)); - this.downloads.forEach((d) => { - if (!d.lastDownload && d.status === 'READY') { - this.performDownload(d); - } - }); - // never downloaded or download still pending - this.pendingDownloads = this.downloads.filter((d) => !d.lastDownload || this.inProgressDownloads.has(d.storageId)); + this.hasPendingDownloads = !!this.downloads.find((f) => !f.lastDownload); }) ); } public performDownload(status: DownloadStatusWrapper) { - this.inProgressDownloads.add(status.storageId); status.inProgress = true; this._downloadControllerService .downloadFile( @@ -82,12 +75,8 @@ export class FileDownloadService { (response) => { download(response, status.filename); status.inProgress = false; - setTimeout(() => { - this.inProgressDownloads.delete(status.storageId); - }, 1000); }, () => { - this.inProgressDownloads.delete(status.storageId); status.inProgress = false; } ); diff --git a/apps/red-ui/src/app/upload-download/file-upload-download.module.ts b/apps/red-ui/src/app/upload-download/file-upload-download.module.ts index c435098a2..8bd63748e 100644 --- a/apps/red-ui/src/app/upload-download/file-upload-download.module.ts +++ b/apps/red-ui/src/app/upload-download/file-upload-download.module.ts @@ -10,7 +10,6 @@ import { UploadStatusOverlay } from './upload-status-overlay/upload-status-overl import { NgxDropzoneModule } from 'ngx-dropzone'; import { TranslateModule } from '@ngx-translate/core'; import { MatButtonModule } from '@angular/material/button'; -import { DownloadStatusOverlay } from './download-status-overlay/download-status-overlay.component'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; @NgModule({ @@ -26,9 +25,9 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; OverlayModule, MatButtonModule ], - declarations: [FileDropComponent, UploadStatusOverlay, DownloadStatusOverlay], + declarations: [FileDropComponent, UploadStatusOverlay], providers: [], - entryComponents: [FileDropComponent, UploadStatusOverlay, DownloadStatusOverlay], - exports: [FileDropComponent, UploadStatusOverlay, DownloadStatusOverlay] + entryComponents: [FileDropComponent, UploadStatusOverlay], + exports: [FileDropComponent, UploadStatusOverlay] }) export class FileUploadDownloadModule {} diff --git a/apps/red-ui/src/app/upload-download/model/download-status.wrapper.ts b/apps/red-ui/src/app/upload-download/model/download-status.wrapper.ts index fe63d857f..c3341c685 100644 --- a/apps/red-ui/src/app/upload-download/model/download-status.wrapper.ts +++ b/apps/red-ui/src/app/upload-download/model/download-status.wrapper.ts @@ -2,7 +2,6 @@ import { DownloadDetails, DownloadStatus } from '@redaction/red-ui-http'; export class DownloadStatusWrapper { inProgress: boolean; - displayName: string; constructor(private _downloadStatus: DownloadStatus) {} diff --git a/apps/red-ui/src/app/upload-download/status-overlay.service.ts b/apps/red-ui/src/app/upload-download/status-overlay.service.ts index 274ae612e..08ca516e9 100644 --- a/apps/red-ui/src/app/upload-download/status-overlay.service.ts +++ b/apps/red-ui/src/app/upload-download/status-overlay.service.ts @@ -2,18 +2,15 @@ import { Injectable, Injector } from '@angular/core'; import { Overlay, OverlayRef } from '@angular/cdk/overlay'; import { ComponentPortal } from '@angular/cdk/portal'; import { UploadStatusOverlay } from './upload-status-overlay/upload-status-overlay.component'; -import { DownloadStatusOverlay } from './download-status-overlay/download-status-overlay.component'; @Injectable({ providedIn: 'root' }) export class StatusOverlayService { private readonly _uploadStatusOverlayRef: OverlayRef; - private readonly _downloadStatusOverlayRef: OverlayRef; constructor(private overlay: Overlay, private readonly _injector: Injector) { this._uploadStatusOverlayRef = this.overlay.create(); - this._downloadStatusOverlayRef = this.overlay.create(); } private _createUploadInjector() { @@ -23,28 +20,10 @@ export class StatusOverlayService { }); } - private _createDownloadInjector() { - return Injector.create({ - providers: [{ provide: OverlayRef, useValue: this._downloadStatusOverlayRef }], - parent: this._injector - }); - } - openUploadStatusOverlay() { const component = new ComponentPortal(UploadStatusOverlay, null, this._createUploadInjector()); if (!this._uploadStatusOverlayRef.hasAttached()) { this._uploadStatusOverlayRef.attach(component); } } - - openDownloadStatusOverlay() { - const component = new ComponentPortal(DownloadStatusOverlay, null, this._createDownloadInjector()); - if (!this._downloadStatusOverlayRef.hasAttached()) { - this._downloadStatusOverlayRef.attach(component); - } - } - - get isDownloadOverlayOpen() { - return this._downloadStatusOverlayRef && this._downloadStatusOverlayRef.hasAttached(); - } } diff --git a/libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts b/libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts index 7f3f5852b..2b5004a76 100644 --- a/libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts +++ b/libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts @@ -16,6 +16,7 @@ import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/commo import { Observable } from 'rxjs'; import { DigitalSignature } from '../model/digitalSignature'; +import { DigitalSignatureViewModel } from '../model/digitalSignatureViewModel'; import { BASE_PATH } from '../variables'; import { Configuration } from '../configuration'; @@ -92,9 +93,9 @@ export class DigitalSignatureControllerService { * @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 getDigitalSignature(observe?: 'body', reportProgress?: boolean): Observable; - public getDigitalSignature(observe?: 'response', reportProgress?: boolean): Observable>; - public getDigitalSignature(observe?: 'events', reportProgress?: boolean): Observable>; + public getDigitalSignature(observe?: 'body', reportProgress?: boolean): Observable; + public getDigitalSignature(observe?: 'response', reportProgress?: boolean): Observable>; + public getDigitalSignature(observe?: 'events', reportProgress?: boolean): Observable>; public getDigitalSignature(observe: any = 'body', reportProgress: boolean = false): Observable { let headers = this.defaultHeaders; @@ -114,7 +115,7 @@ export class DigitalSignatureControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/digital-signature`, { + return this.httpClient.request('get', `${this.basePath}/digital-signature`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -123,15 +124,15 @@ export class DigitalSignatureControllerService { } /** - * Save/Update the digital signature used to sign PDF's + * Save a new digital signature used to sign PDF's * None * @param body digitalSignatureModel * @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 saveDigitalSignature(body: DigitalSignature, observe?: 'body', reportProgress?: boolean): Observable; - public saveDigitalSignature(body: DigitalSignature, observe?: 'response', reportProgress?: boolean): Observable>; - public saveDigitalSignature(body: DigitalSignature, observe?: 'events', reportProgress?: boolean): Observable>; + public saveDigitalSignature(body: DigitalSignature, observe?: 'body', reportProgress?: boolean): Observable; + public saveDigitalSignature(body: DigitalSignature, observe?: 'response', reportProgress?: boolean): Observable>; + public saveDigitalSignature(body: DigitalSignature, observe?: 'events', reportProgress?: boolean): Observable>; public saveDigitalSignature(body: DigitalSignature, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling saveDigitalSignature.'); @@ -159,7 +160,61 @@ export class DigitalSignatureControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/digital-signature`, { + return this.httpClient.request('post', `${this.basePath}/digital-signature`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Update the digital signature used to sign PDF's + * None + * @param body digitalSignatureModel + * @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 saveDigitalSignature1(body: DigitalSignatureViewModel, observe?: 'body', reportProgress?: boolean): Observable; + public saveDigitalSignature1( + body: DigitalSignatureViewModel, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public saveDigitalSignature1( + body: DigitalSignatureViewModel, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public saveDigitalSignature1(body: DigitalSignatureViewModel, observe: any = 'body', reportProgress: boolean = false): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling saveDigitalSignature1.'); + } + + 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[] = ['application/json']; + 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[] = ['application/json']; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request('put', `${this.basePath}/digital-signature`, { body: body, withCredentials: this.configuration.withCredentials, headers: headers, diff --git a/libs/red-ui-http/src/lib/api/redactionLogController.service.ts b/libs/red-ui-http/src/lib/api/redactionLogController.service.ts index 804d0c67d..68145454d 100644 --- a/libs/red-ui-http/src/lib/api/redactionLogController.service.ts +++ b/libs/red-ui-http/src/lib/api/redactionLogController.service.ts @@ -15,6 +15,7 @@ import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/commo import { Observable } from 'rxjs'; +import { RedactionChangeLog } from '../model/redactionChangeLog'; import { RedactionLog } from '../model/redactionLog'; import { SectionGrid } from '../model/sectionGrid'; @@ -23,9 +24,9 @@ import { Configuration } from '../configuration'; @Injectable() export class RedactionLogControllerService { + protected basePath = ''; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); - protected basePath = ''; constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { @@ -37,6 +38,75 @@ export class RedactionLogControllerService { } } + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } + + /** + * Gets the redaction changelog for a fileId + * None + * @param projectId projectId + * @param fileId fileId + * @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 getRedactionChangeLog(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + public getRedactionChangeLog( + projectId: string, + fileId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public getRedactionChangeLog(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public getRedactionChangeLog(projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (projectId === null || projectId === undefined) { + throw new Error('Required parameter projectId was null or undefined when calling getRedactionLog.'); + } + + if (fileId === null || fileId === undefined) { + throw new Error('Required parameter fileId was null or undefined when calling getRedactionLog.'); + } + + 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[] = ['application/json']; + 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( + 'get', + `${this.basePath}/redactionChnageLog/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + /** * Gets the redaction log for a fileId * None @@ -50,11 +120,11 @@ export class RedactionLogControllerService { public getRedactionLog(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; public getRedactionLog(projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling getRedactionLog.'); + throw new Error('Required parameter projectId was null or undefined when calling getRedactionLog1.'); } if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling getRedactionLog.'); + throw new Error('Required parameter fileId was null or undefined when calling getRedactionLog1.'); } let headers = this.defaultHeaders; @@ -136,18 +206,4 @@ export class RedactionLogControllerService { } ); } - - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } } diff --git a/libs/red-ui-http/src/lib/model/digitalSignature.ts b/libs/red-ui-http/src/lib/model/digitalSignature.ts index 31321fc50..657d5802f 100644 --- a/libs/red-ui-http/src/lib/model/digitalSignature.ts +++ b/libs/red-ui-http/src/lib/model/digitalSignature.ts @@ -11,10 +11,10 @@ */ export interface DigitalSignature { - base64EncodedPrivateKey?: string; certificateName?: string; - contactInfo?: string; location?: string; - password?: string; reason?: string; + contactInfo?: string; + password?: string; + base64EncodedPrivateKey?: string; } diff --git a/libs/red-ui-http/src/lib/model/digitalSignatureViewModel.ts b/libs/red-ui-http/src/lib/model/digitalSignatureViewModel.ts new file mode 100644 index 000000000..f5e3110fb --- /dev/null +++ b/libs/red-ui-http/src/lib/model/digitalSignatureViewModel.ts @@ -0,0 +1,18 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +export interface DigitalSignatureViewModel { + certificateName?: string; + contactInfo?: string; + location?: string; + reason?: string; +} diff --git a/libs/red-ui-http/src/lib/model/models.ts b/libs/red-ui-http/src/lib/model/models.ts index c5ba95a34..e2d88a6ab 100644 --- a/libs/red-ui-http/src/lib/model/models.ts +++ b/libs/red-ui-http/src/lib/model/models.ts @@ -49,3 +49,6 @@ export * from './downloadStatus'; export * from './downloadStatusResponse'; export * from './prepareDownloadRequest'; export * from './digitalSignature'; +export * from './digitalSignatureViewModel'; +export * from './redactionChangeLog'; +export * from './redactionChangeLogEntry'; diff --git a/libs/red-ui-http/src/lib/model/redactionChangeLog.ts b/libs/red-ui-http/src/lib/model/redactionChangeLog.ts new file mode 100644 index 000000000..3b1d3bf05 --- /dev/null +++ b/libs/red-ui-http/src/lib/model/redactionChangeLog.ts @@ -0,0 +1,20 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +import { RedactionChangeLogEntry } from './redactionChangeLogEntry'; + +export interface RedactionChangeLog { + dictionaryVersion?: number; + filename?: string; + redactionLogEntry?: Array; + ruleSetId?: string; + rulesVersion?: number; +} diff --git a/libs/red-ui-http/src/lib/model/redactionChangeLogEntry.ts b/libs/red-ui-http/src/lib/model/redactionChangeLogEntry.ts new file mode 100644 index 000000000..a5bed54db --- /dev/null +++ b/libs/red-ui-http/src/lib/model/redactionChangeLogEntry.ts @@ -0,0 +1,55 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +import { Comment } from './comment'; +import { Rectangle } from './rectangle'; + +export interface RedactionChangeLogEntry { + changeType?: RedactionChangeLogEntry.ChangeTypeEnum; + color?: Array; + comments?: Array; + dictionaryEntry?: boolean; + hint?: boolean; + id?: string; + legalBasis?: string; + manual?: boolean; + manualRedactionType?: RedactionChangeLogEntry.ManualRedactionTypeEnum; + matchedRule?: number; + positions?: Array; + reason?: string; + recommendation?: boolean; + redacted?: boolean; + section?: string; + sectionNumber?: number; + status?: RedactionChangeLogEntry.StatusEnum; + textAfter?: string; + textBefore?: string; + type?: string; + value?: string; +} +export namespace RedactionChangeLogEntry { + export type ChangeTypeEnum = 'ADDED' | 'REMOVED'; + export const ChangeTypeEnum = { + ADDED: 'ADDED' as ChangeTypeEnum, + REMOVED: 'REMOVED' as ChangeTypeEnum + }; + export type ManualRedactionTypeEnum = 'ADD' | 'REMOVE'; + export const ManualRedactionTypeEnum = { + ADD: 'ADD' as ManualRedactionTypeEnum, + REMOVE: 'REMOVE' as ManualRedactionTypeEnum + }; + export type StatusEnum = 'REQUESTED' | 'APPROVED' | 'DECLINED'; + export const StatusEnum = { + REQUESTED: 'REQUESTED' as StatusEnum, + APPROVED: 'APPROVED' as StatusEnum, + DECLINED: 'DECLINED' as StatusEnum + }; +} diff --git a/libs/red-ui-http/src/lib/model/redactionLogEntry.ts b/libs/red-ui-http/src/lib/model/redactionLogEntry.ts index f2b3e5395..a1df0463d 100644 --- a/libs/red-ui-http/src/lib/model/redactionLogEntry.ts +++ b/libs/red-ui-http/src/lib/model/redactionLogEntry.ts @@ -9,10 +9,12 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ +import { Comment } from './comment'; import { Rectangle } from './rectangle'; export interface RedactionLogEntry { color?: Array; + comments?: Array; dictionaryEntry?: boolean; hint?: boolean; id?: string; @@ -32,7 +34,6 @@ export interface RedactionLogEntry { type?: string; value?: string; } - export namespace RedactionLogEntry { export type ManualRedactionTypeEnum = 'ADD' | 'REMOVE'; export const ManualRedactionTypeEnum = {