diff --git a/apps/red-ui/src/app/app.module.ts b/apps/red-ui/src/app/app.module.ts index 7591df031..253ffde75 100644 --- a/apps/red-ui/src/app/app.module.ts +++ b/apps/red-ui/src/app/app.module.ts @@ -95,6 +95,8 @@ import { UserListingScreenComponent } from './screens/admin/users/user-listing-s import { NotificationsComponent } from './components/notifications/notifications.component'; import { RulesScreenComponent } from './screens/admin/rules-screen/rules-screen.component'; import { WatermarkScreenComponent } from './screens/admin/watermark-screen/watermark-screen.component'; +import { PdfViewerScreenComponent } from './screens/pdf-viewer-screen/pdf-viewer-screen.component'; +import { HtmlDebugScreenComponent } from './screens/html-debug-screen/html-debug-screen.component'; export function HttpLoaderFactory(httpClient: HttpClient) { return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json'); @@ -115,6 +117,23 @@ const routes = [ path: 'info', component: AppInfoComponent }, + { + path: 'pdf-preview/:fileId', + component: PdfViewerScreenComponent, + canActivate: [CompositeRouteGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard] + } + }, + { + path: 'html-debug/:fileId', + component: HtmlDebugScreenComponent, + canActivate: [CompositeRouteGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard] + } + }, + { path: 'ui', component: BaseScreenComponent, @@ -184,7 +203,8 @@ const routes = [ component: WatermarkScreenComponent, canActivate: [CompositeRouteGuard], data: { - routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard], + requiredRoles: ['RED_ADMIN'] } } ] @@ -269,7 +289,9 @@ const matImports = [ UserListingScreenComponent, NotificationsComponent, RulesScreenComponent, - WatermarkScreenComponent + WatermarkScreenComponent, + PdfViewerScreenComponent, + HtmlDebugScreenComponent ], imports: [ BrowserModule, diff --git a/apps/red-ui/src/app/auth/red-role.guard.ts b/apps/red-ui/src/app/auth/red-role.guard.ts index 19870efbc..743bcc76d 100644 --- a/apps/red-ui/src/app/auth/red-role.guard.ts +++ b/apps/red-ui/src/app/auth/red-role.guard.ts @@ -18,13 +18,27 @@ export class RedRoleGuard implements CanActivate { obs.next(false); obs.complete(); } else { + // we have at least 1 RED Role -> if it's not user he must be admin if (!this._userService.isUser() && state.url.startsWith('/ui/projects')) { this._router.navigate(['/ui/admin']); obs.next(false); obs.complete(); + return; + } + if (route.data.requiredRoles) { + if (this._userService.hasAnyRole(route.data.requiredRoles)) { + obs.next(true); + obs.complete(); + } else { + console.log('this case'); + this._router.navigate(['/ui/projects']); + obs.next(false); + obs.complete(); + } + } else { + obs.next(true); + obs.complete(); } - obs.next(true); - obs.complete(); } }); } diff --git a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html index 41b3ad694..2bedc5574 100644 --- a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html +++ b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html @@ -14,7 +14,7 @@ [routerLinkActiveOptions]="{ exact: true }" routerLinkActive="active" translate="rule-editor" - *ngIf="screen === 'rules' || root" + *ngIf="(screen === 'rules' || root) && userPreferenceService.areDevFeaturesEnabled" > diff --git a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.ts b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.ts index 8be407e0d..afd0adb8f 100644 --- a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.ts +++ b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { TypeValue } from '@redaction/red-ui-http'; import { AppStateService } from '../../state/app-state.service'; +import { UserPreferenceService } from '../../common/service/user-preference.service'; +import { PermissionsService } from '../../common/service/permissions.service'; @Component({ selector: 'redaction-admin-breadcrumbs', @@ -13,7 +15,12 @@ export class AdminBreadcrumbsComponent implements OnInit { public root: boolean; public screen: string; - constructor(private readonly _activatedRoute: ActivatedRoute, private _appStateService: AppStateService) { + constructor( + public readonly userPreferenceService: UserPreferenceService, + public readonly permissionService: PermissionsService, + private readonly _activatedRoute: ActivatedRoute, + private readonly _appStateService: AppStateService + ) { this._activatedRoute.params.subscribe((params) => { const url = this._activatedRoute.snapshot.url; this.root = url.length === 1; diff --git a/apps/red-ui/src/app/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.html b/apps/red-ui/src/app/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.html index 71df39fbd..f98ba2b58 100644 --- a/apps/red-ui/src/app/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.html +++ b/apps/red-ui/src/app/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.html @@ -11,7 +11,7 @@ -
+
{{ 'project-listing.add-edit-dialog.form.template' | translate }} diff --git a/apps/red-ui/src/app/icons/icons.module.ts b/apps/red-ui/src/app/icons/icons.module.ts index 8f3a5b189..5c91fccf8 100644 --- a/apps/red-ui/src/app/icons/icons.module.ts +++ b/apps/red-ui/src/app/icons/icons.module.ts @@ -36,12 +36,14 @@ export class IconsModule { 'expand', 'folder', 'fullscreen', + 'html-file', 'info', 'lightning', 'logout', 'menu', 'needs-work', 'notification', + 'new-tab', 'pages', 'plus', 'preview', 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 74ce00c66..fb9ea1e45 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 @@ -72,6 +72,28 @@ tooltip="file-preview.fullscreen" tooltipPosition="before" > + + + + + + + async openSSRFilePreview() { + window.open(`/pdf-preview/${this.fileId}`, '_blank'); + } + + async openHTMLDebug() { + window.open(`/html-debug/${this.fileId}`, '_blank'); + } + // } diff --git a/apps/red-ui/src/app/screens/html-debug-screen/html-debug-screen.component.html b/apps/red-ui/src/app/screens/html-debug-screen/html-debug-screen.component.html new file mode 100644 index 000000000..64c7852a3 --- /dev/null +++ b/apps/red-ui/src/app/screens/html-debug-screen/html-debug-screen.component.html @@ -0,0 +1,2 @@ +
+ diff --git a/apps/red-ui/src/app/screens/html-debug-screen/html-debug-screen.component.scss b/apps/red-ui/src/app/screens/html-debug-screen/html-debug-screen.component.scss new file mode 100644 index 000000000..ec70e8d52 --- /dev/null +++ b/apps/red-ui/src/app/screens/html-debug-screen/html-debug-screen.component.scss @@ -0,0 +1,7 @@ +section { + height: calc(100vh - 40px); + display: flex; + flex-direction: column; + align-items: center; + padding: 20px; +} diff --git a/apps/red-ui/src/app/screens/html-debug-screen/html-debug-screen.component.ts b/apps/red-ui/src/app/screens/html-debug-screen/html-debug-screen.component.ts new file mode 100644 index 000000000..22d8e6580 --- /dev/null +++ b/apps/red-ui/src/app/screens/html-debug-screen/html-debug-screen.component.ts @@ -0,0 +1,49 @@ +import { ChangeDetectorRef, Component } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { FileDownloadService } from '../file/service/file-download.service'; +import { DebugControllerService } from '@redaction/red-ui-http'; +import { FileType } from '../file/model/file-type'; +import { FileStatusWrapper } from '../file/model/file-status.wrapper'; +import { mergeMap } from 'rxjs/operators'; + +@Component({ + selector: 'redaction-html-debug-screen', + templateUrl: './html-debug-screen.component.html', + styleUrls: ['./html-debug-screen.component.scss'] +}) +export class HtmlDebugScreenComponent { + private _fileId: string; + + htmlData: any; + loading: boolean; + + constructor( + private readonly _activatedRoute: ActivatedRoute, + private readonly _changeDetectorRef: ChangeDetectorRef, + private readonly _debugControllerService: DebugControllerService, + private readonly _fileDownloadService: FileDownloadService + ) { + this._activatedRoute.params.subscribe((params) => { + this._fileId = params.fileId; + this._loadDebugHTML(); + }); + } + + private _loadDebugHTML() { + this.loading = true; + const fileStatus = new FileStatusWrapper({ fileId: this._fileId, lastProcessed: new Date().toISOString() }, null); + + this._fileDownloadService + .loadFile(FileType.ANNOTATED, fileStatus) + .pipe( + mergeMap((fileData) => { + return this._debugControllerService.debugHtmlTablesForm(fileData, true); + }) + ) + .subscribe((data) => { + this.htmlData = data; + this.loading = false; + console.log(this.htmlData); + }); + } +} diff --git a/apps/red-ui/src/app/screens/pdf-viewer-screen/pdf-viewer-screen.component.html b/apps/red-ui/src/app/screens/pdf-viewer-screen/pdf-viewer-screen.component.html new file mode 100644 index 000000000..534e12c77 --- /dev/null +++ b/apps/red-ui/src/app/screens/pdf-viewer-screen/pdf-viewer-screen.component.html @@ -0,0 +1 @@ +
diff --git a/apps/red-ui/src/app/screens/pdf-viewer-screen/pdf-viewer-screen.component.scss b/apps/red-ui/src/app/screens/pdf-viewer-screen/pdf-viewer-screen.component.scss new file mode 100644 index 000000000..c5aa1aa0f --- /dev/null +++ b/apps/red-ui/src/app/screens/pdf-viewer-screen/pdf-viewer-screen.component.scss @@ -0,0 +1,4 @@ +.viewer { + width: 100vw; + height: 100vh; +} diff --git a/apps/red-ui/src/app/screens/pdf-viewer-screen/pdf-viewer-screen.component.ts b/apps/red-ui/src/app/screens/pdf-viewer-screen/pdf-viewer-screen.component.ts new file mode 100644 index 000000000..dc0a16f3e --- /dev/null +++ b/apps/red-ui/src/app/screens/pdf-viewer-screen/pdf-viewer-screen.component.ts @@ -0,0 +1,74 @@ +import { ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import WebViewer, { WebViewerInstance } from '@pdftron/webviewer'; +import { environment } from '../../../environments/environment'; +import { FileDownloadService } from '../file/service/file-download.service'; +import { ActivatedRoute } from '@angular/router'; +import { FileType } from '../file/model/file-type'; +import { FileStatusWrapper } from '../file/model/file-status.wrapper'; + +@Component({ + selector: 'redaction-pdf-viewer-screen', + templateUrl: './pdf-viewer-screen.component.html', + styleUrls: ['./pdf-viewer-screen.component.scss'] +}) +export class PdfViewerScreenComponent implements OnInit { + private _instance: WebViewerInstance; + @ViewChild('viewer', { static: true }) + private _viewer: ElementRef; + + private _fileId: string; + private _fileData: any; + + constructor( + private readonly _activatedRoute: ActivatedRoute, + private readonly _changeDetectorRef: ChangeDetectorRef, + private readonly _fileDownloadService: FileDownloadService + ) { + this._activatedRoute.params.subscribe((params) => { + this._fileId = params.fileId; + this._loadFile(); + }); + } + + ngOnInit(): void { + this._loadViewer(); + } + + private _loadViewer() { + WebViewer( + { + licenseKey: environment.licenseKey ? atob(environment.licenseKey) : null, + isReadOnly: true, + path: '/assets/wv-resources', + css: '/assets/pdftron/stylesheet.css' + }, + this._viewer.nativeElement + ).then((instance) => { + this._instance = instance; + + instance.docViewer.on('documentLoaded', () => { + this._changeDetectorRef.detectChanges(); + }); + + if (this._fileData) { + this._loadDocumentIntoViewer(); + } + }); + } + + private _loadFile() { + const fileStatus = new FileStatusWrapper({ fileId: this._fileId, lastProcessed: new Date().toISOString() }, null); + this._fileDownloadService.loadFile(FileType.ANNOTATED, fileStatus).subscribe((data) => { + this._fileData = data; + this._loadDocumentIntoViewer(); + }); + } + + private _loadDocumentIntoViewer() { + if (this._instance) { + this._instance.loadDocument(this._fileData, { + filename: 'document.pdf' + }); + } + } +} diff --git a/apps/red-ui/src/app/user/user.service.ts b/apps/red-ui/src/app/user/user.service.ts index 45ed259b6..5dff4bc5e 100644 --- a/apps/red-ui/src/app/user/user.service.ts +++ b/apps/red-ui/src/app/user/user.service.ts @@ -113,4 +113,20 @@ export class UserService { private _hasAnyRedRole(u: User) { return u.roles.indexOf('RED_USER') >= 0 || u.roles.indexOf('RED_MANAGER') >= 0 || u.roles.indexOf('RED_ADMIN') >= 0; } + + hasAnyRole(requiredRoles: string[], user?: User) { + if (!user) { + user = this.user; + } + if (requiredRoles && requiredRoles.length > 0) { + for (let role of requiredRoles) { + if (user.roles.indexOf(role) >= 0) { + return true; + } + } + return false; + } else { + return true; + } + } } diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 74e76359c..896b75f60 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -106,7 +106,7 @@ "description": "Description", "name": "Name", "due-date": "Due Date", - "template": "Project Template" + "template": "Project Template", }, "actions": { "save": "Save", @@ -260,6 +260,8 @@ "assign-me": "Assign to me", "last-reviewer": "Last Reviewed by:", "fullscreen": "Full Screen (F)", + "new-tab-ssr": "Open Document in Server Side Rendering Mode", + "html-debug": "Open Document HTML Debug", "exit-fullscreen": "Exit Full Screen (F)" }, "annotation-actions": { diff --git a/apps/red-ui/src/assets/icons/general/html-file.svg b/apps/red-ui/src/assets/icons/general/html-file.svg new file mode 100644 index 000000000..bf55986ff --- /dev/null +++ b/apps/red-ui/src/assets/icons/general/html-file.svg @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/apps/red-ui/src/assets/icons/general/new-tab.svg b/apps/red-ui/src/assets/icons/general/new-tab.svg new file mode 100644 index 000000000..4e7f8432e --- /dev/null +++ b/apps/red-ui/src/assets/icons/general/new-tab.svg @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/libs/red-ui-http/src/lib/api/debugController.service.ts b/libs/red-ui-http/src/lib/api/debugController.service.ts index e7d363cea..b71f1cf6f 100644 --- a/libs/red-ui-http/src/lib/api/debugController.service.ts +++ b/libs/red-ui-http/src/lib/api/debugController.service.ts @@ -25,11 +25,7 @@ export class DebugControllerService { public configuration = new Configuration(); protected basePath = ''; - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string, - @Optional() configuration: Configuration - ) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -47,37 +43,15 @@ export class DebugControllerService { * @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 debugClassificationsForm( - file: Blob, - inline?: boolean, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public debugClassificationsForm(file: Blob, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - public debugClassificationsForm( - file: Blob, - inline?: boolean, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public debugClassificationsForm(file: Blob, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - public debugClassificationsForm( - file: Blob, - inline?: boolean, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public debugClassificationsForm(file: Blob, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - public debugClassificationsForm( - file: Blob, - inline?: boolean, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public debugClassificationsForm(file: Blob, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { if (file === null || file === undefined) { - throw new Error( - 'Required parameter file was null or undefined when calling debugClassifications.' - ); + throw new Error('Required parameter file was null or undefined when calling debugClassifications.'); } let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); @@ -89,18 +63,13 @@ export class DebugControllerService { // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : 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/octet-stream']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -144,37 +113,15 @@ export class DebugControllerService { * @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 debugHtmlTablesForm( - file: Blob, - inline?: boolean, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public debugHtmlTablesForm(file: Blob, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - public debugHtmlTablesForm( - file: Blob, - inline?: boolean, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public debugHtmlTablesForm(file: Blob, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - public debugHtmlTablesForm( - file: Blob, - inline?: boolean, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public debugHtmlTablesForm(file: Blob, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - public debugHtmlTablesForm( - file: Blob, - inline?: boolean, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public debugHtmlTablesForm(file: Blob, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { if (file === null || file === undefined) { - throw new Error( - 'Required parameter file was null or undefined when calling debugHtmlTables.' - ); + throw new Error('Required parameter file was null or undefined when calling debugHtmlTables.'); } let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); @@ -186,18 +133,13 @@ export class DebugControllerService { // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : 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/octet-stream']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -223,7 +165,8 @@ export class DebugControllerService { formParams = (formParams.append('file', file) as any) || formParams; } - return this.httpClient.request('post', `${this.basePath}/debug/htmlTables`, { + return this.httpClient.request('post', `${this.basePath}/debug/htmlTables`, { + responseType: 'text', body: convertFormParamsToString ? formParams.toString() : formParams, params: queryParameters, withCredentials: this.configuration.withCredentials, @@ -241,37 +184,15 @@ export class DebugControllerService { * @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 debugSectionsForm( - file: Blob, - inline?: boolean, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public debugSectionsForm(file: Blob, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - public debugSectionsForm( - file: Blob, - inline?: boolean, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public debugSectionsForm(file: Blob, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - public debugSectionsForm( - file: Blob, - inline?: boolean, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public debugSectionsForm(file: Blob, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - public debugSectionsForm( - file: Blob, - inline?: boolean, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public debugSectionsForm(file: Blob, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { if (file === null || file === undefined) { - throw new Error( - 'Required parameter file was null or undefined when calling debugSections.' - ); + throw new Error('Required parameter file was null or undefined when calling debugSections.'); } let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); @@ -283,18 +204,13 @@ export class DebugControllerService { // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : 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/octet-stream']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -339,41 +255,15 @@ export class DebugControllerService { * @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 redactionForm( - file: Blob, - inline?: boolean, - flatRedaction?: boolean, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - public redactionForm( - file: Blob, - inline?: boolean, - flatRedaction?: boolean, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - public redactionForm( - file: Blob, - inline?: boolean, - flatRedaction?: boolean, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - public redactionForm( - file: Blob, - inline?: boolean, - flatRedaction?: boolean, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { if (file === null || file === undefined) { - throw new Error( - 'Required parameter file was null or undefined when calling redaction.' - ); + throw new Error('Required parameter file was null or undefined when calling redaction.'); } let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); @@ -388,18 +278,13 @@ export class DebugControllerService { // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : 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/octet-stream']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } diff --git a/libs/red-ui-http/src/lib/model/fileStatus.ts b/libs/red-ui-http/src/lib/model/fileStatus.ts index 55b6d9a56..0f0709c86 100644 --- a/libs/red-ui-http/src/lib/model/fileStatus.ts +++ b/libs/red-ui-http/src/lib/model/fileStatus.ts @@ -65,7 +65,7 @@ export interface FileStatus { /** * Date and time when the file was last uploaded. */ - lastUploaded: string; + lastUploaded?: string; /** * The number of times the file has been analyzed. */