From acbd4ca261c8dd63f7fd81b050375af303aa9469 Mon Sep 17 00:00:00 2001 From: Timo Date: Thu, 21 Jan 2021 20:19:25 +0200 Subject: [PATCH] fixed cache issue and download message --- .../file-download-btn.component.ts | 2 +- .../watermark-screen.component.ts | 2 +- .../upload-download/file-download.service.ts | 2 +- apps/red-ui/src/assets/i18n/en.json | 2 +- .../lib/api/fileManagementController.service.ts | 17 +++++++++++++---- 5 files changed, 17 insertions(+), 8 deletions(-) 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 cd99a5d68..c0a325a9d 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 @@ -65,7 +65,7 @@ export class FileDownloadBtnComponent { this._changeDetectorRef.detectChanges(); } else { this._fileManagementControllerService - .downloadPreviewFile(this.file.fileId, true, 'body') + .downloadPreviewFile(this.file.fileId, true, this.file.lastProcessed, 'body') .subscribe((data) => saveAs(data, (this.file).filename)); } } diff --git a/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.ts b/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.ts index 05b513b35..cfd913850 100644 --- a/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.ts +++ b/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.ts @@ -167,7 +167,7 @@ export class WatermarkScreenComponent implements OnInit { this._instance.docViewer.setWatermark({ custom: (ctx, pageNumber, pageWidth, pageHeight) => { ctx.fillStyle = color; - ctx.font = `${fontSize}pt ${fontType}`; + ctx.font = `${fontSize}px ${fontType}`; ctx.globalAlpha = opacity / 100; for (let idx = 0; idx < lines.length; ++idx) { 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 b4a3f4ea7..454035354 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 @@ -99,7 +99,7 @@ export class FileDownloadService { }, () => { downloadModel.completed = true; - downloadModel.error = { message: this._translateService.instant('upload-status.error.generic') }; + downloadModel.error = { message: this._translateService.instant('download-status.error.generic') }; this._removeDownload(subscription); } ); diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 814a1b9ab..c00d022e7 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -23,7 +23,7 @@ }, "download-status": { "error": { - "generic": "Failed to download project." + "generic": "Download failed" }, "dialog": { "title": "Downloads ({{len}})", diff --git a/libs/red-ui-http/src/lib/api/fileManagementController.service.ts b/libs/red-ui-http/src/lib/api/fileManagementController.service.ts index c04cd8499..98c15fc37 100644 --- a/libs/red-ui-http/src/lib/api/fileManagementController.service.ts +++ b/libs/red-ui-http/src/lib/api/fileManagementController.service.ts @@ -154,10 +154,16 @@ export class FileManagementControllerService { * @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 downloadPreviewFile(fileId: string, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - public downloadPreviewFile(fileId: string, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - public downloadPreviewFile(fileId: string, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - public downloadPreviewFile(fileId: string, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { + public downloadPreviewFile(fileId: string, inline?: boolean, indicator?: string, observe?: 'body', reportProgress?: boolean): Observable; + public downloadPreviewFile( + fileId: string, + inline?: boolean, + indicator?: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public downloadPreviewFile(fileId: string, inline?: boolean, indicator?: string, observe?: 'events', reportProgress?: boolean): Observable>; + public downloadPreviewFile(fileId: string, inline?: boolean, indicator?: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (fileId === null || fileId === undefined) { throw new Error('Required parameter fileId was null or undefined when calling downloadPreviewFile.'); } @@ -166,6 +172,9 @@ export class FileManagementControllerService { if (inline !== undefined && inline !== null) { queryParameters = queryParameters.set('inline', inline); } + if (indicator !== undefined && indicator !== null) { + queryParameters = queryParameters.set('indicator', indicator); + } let headers = this.defaultHeaders;