download original file dev feature

This commit is contained in:
Timo 2021-02-05 14:07:26 +02:00
parent bbafad9d07
commit 1baace9e22
3 changed files with 22 additions and 2 deletions

View File

@ -120,6 +120,15 @@
></redaction-circle-button>
<!-- Dev Mode Features-->
<redaction-circle-button
*ngIf="userPreferenceService.areDevFeaturesEnabled"
(action)="downloadOriginalFile()"
icon="red:download"
type="primary"
class="ml-8"
tooltip="file-preview.download-original-file"
tooltipPosition="before"
></redaction-circle-button>
<redaction-circle-button
*ngIf="userPreferenceService.areDevFeaturesEnabled"
(action)="openSSRFilePreview()"

View File

@ -26,8 +26,9 @@ import { handleFilterDelta, processFilters } from '../../../common/filter/utils/
import { UserPreferenceService } from '../../../common/service/user-preference.service';
import { UserService } from '../../../user/user.service';
import { FormBuilder, FormGroup } from '@angular/forms';
import { StatusControllerService } from '@redaction/red-ui-http';
import { FileManagementControllerService, StatusControllerService } from '@redaction/red-ui-http';
import { PdfViewerDataService } from '../service/pdf-viewer-data.service';
import { download } from '../../../utils/file-download-utils';
const KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'f', 'F', 'Escape'];
@ -81,7 +82,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
private readonly _fileDownloadService: PdfViewerDataService,
private readonly _formBuilder: FormBuilder,
private readonly _statusControllerService: StatusControllerService,
private readonly ngZone: NgZone
private readonly ngZone: NgZone,
private readonly _fileManagementControllerService: FileManagementControllerService
) {
this._activatedRoute.params.subscribe((params) => {
this.projectId = params.projectId;
@ -617,5 +619,13 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
window.open(`/html-debug/${this.projectId}/${this.fileId}`, '_blank');
}
downloadOriginalFile() {
this._fileManagementControllerService
.downloadOriginalFile(this.projectId, this.fileId, true, this.fileData.fileStatus.lastUploaded, 'response')
.subscribe((data) => {
download(data, this.fileData.fileStatus.filename);
});
}
// <!-- End Dev Mode Features-->
}

View File

@ -298,6 +298,7 @@
"fullscreen": "Full Screen (F)",
"new-tab-ssr": "Open Document in Server Side Rendering Mode",
"html-debug": "Open Document HTML Debug",
"download-original-file": "Download Original File",
"exit-fullscreen": "Exit Full Screen (F)"
},
"annotation-actions": {