fixed varioues parts of the APP after s3 storage migration

This commit is contained in:
Timo 2021-01-28 10:42:55 +02:00
parent 8b343f7069
commit 0434feb5fc
8 changed files with 53 additions and 21 deletions

View File

@ -126,7 +126,7 @@ const routes = [
canActivate: [AuthGuard]
},
{
path: 'pdf-preview/:fileId',
path: 'pdf-preview/:projectId/:fileId',
component: PdfViewerScreenComponent,
canActivate: [CompositeRouteGuard],
data: {
@ -134,7 +134,7 @@ const routes = [
}
},
{
path: 'html-debug/:fileId',
path: 'html-debug/:projectId/:fileId',
component: HtmlDebugScreenComponent,
canActivate: [CompositeRouteGuard],
data: {

View File

@ -65,7 +65,7 @@ export class FileDownloadBtnComponent {
this._changeDetectorRef.detectChanges();
} else {
this._fileManagementControllerService
.downloadPreviewFile(this.file.fileId, this.file.projectId, true, this.file.lastProcessed, 'body')
.downloadPreviewFile(this.file.projectId, this.file.fileId, true, this.file.lastProcessed, 'body')
.subscribe((data) => saveAs(data, (<FileStatusWrapper>this.file).filename));
}
}

View File

@ -572,11 +572,11 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
// <!-- Dev Mode Features-->
async openSSRFilePreview() {
window.open(`/pdf-preview/${this.fileId}`, '_blank');
window.open(`/pdf-preview/${this.projectId}/${this.fileId}`, '_blank');
}
async openHTMLDebug() {
window.open(`/html-debug/${this.fileId}`, '_blank');
window.open(`/html-debug/${this.projectId}/${this.fileId}`, '_blank');
}
// <!-- End Dev Mode Features-->

View File

@ -13,6 +13,7 @@ import { SingleFileDownloadService } from '../file/service/single-file-download.
})
export class HtmlDebugScreenComponent {
private _fileId: string;
private _projectId: string;
htmlData: any;
loading: boolean;
@ -25,13 +26,21 @@ export class HtmlDebugScreenComponent {
) {
this._activatedRoute.params.subscribe((params) => {
this._fileId = params.fileId;
this._projectId = params.projectId;
this._loadDebugHTML();
});
}
private _loadDebugHTML() {
this.loading = true;
const fileStatus = new FileStatusWrapper({ fileId: this._fileId, lastProcessed: new Date().toISOString() }, null);
const fileStatus = new FileStatusWrapper(
{
projectId: this._projectId,
fileId: this._fileId,
lastProcessed: new Date().toISOString()
},
null
);
this._fileDownloadService
.loadFile(FileType.ANNOTATED, fileStatus)
@ -41,8 +50,12 @@ export class HtmlDebugScreenComponent {
})
)
.subscribe((data) => {
this.htmlData = data;
this.loading = false;
const reader = new FileReader();
reader.onload = () => {
this.htmlData = reader.result;
this.loading = false;
};
reader.readAsText(data);
});
}
}

View File

@ -17,6 +17,7 @@ export class PdfViewerScreenComponent implements OnInit {
private _viewer: ElementRef;
private _fileId: string;
private _projectId: string;
private _fileData: any;
constructor(
@ -26,6 +27,7 @@ export class PdfViewerScreenComponent implements OnInit {
) {
this._activatedRoute.params.subscribe((params) => {
this._fileId = params.fileId;
this._projectId = params.projectId;
this._loadFile();
});
}
@ -57,7 +59,14 @@ export class PdfViewerScreenComponent implements OnInit {
}
private _loadFile() {
const fileStatus = new FileStatusWrapper({ fileId: this._fileId, lastProcessed: new Date().toISOString() }, null);
const fileStatus = new FileStatusWrapper(
{
projectId: this._projectId,
fileId: this._fileId,
lastProcessed: new Date().toISOString()
},
null
);
this._fileDownloadService.loadFile(FileType.ANNOTATED, fileStatus).subscribe((data) => {
this._fileData = data;
this._loadDocumentIntoViewer();

View File

@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>...</title>
<base href="/" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<link href="favicon.ico" rel="icon" type="image/x-icon" />

View File

@ -165,7 +165,8 @@ export class DebugControllerService {
formParams = (formParams.append('file', <any>file) as any) || formParams;
}
return this.httpClient.request<any>('post', `${this.basePath}/debug/htmlTables`, {
return this.httpClient.request('post', `${this.basePath}/debug/htmlTables`, {
responseType: 'blob',
body: convertFormParamsToString ? formParams.toString() : formParams,
params: queryParameters,
withCredentials: this.configuration.withCredentials,

View File

@ -224,10 +224,11 @@ export class FileManagementControllerService {
// to determine the Content-Type header
const consumes: string[] = [];
return this.httpClient.request<any>(
return this.httpClient.request(
'get',
`${this.basePath}/download/annotated/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`,
{
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -315,10 +316,11 @@ export class FileManagementControllerService {
// to determine the Content-Type header
const consumes: string[] = [];
return this.httpClient.request<any>(
return this.httpClient.request(
'get',
`${this.basePath}/download/flatted/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`,
{
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -406,10 +408,11 @@ export class FileManagementControllerService {
// to determine the Content-Type header
const consumes: string[] = [];
return this.httpClient.request<any>(
return this.httpClient.request(
'get',
`${this.basePath}/download/original/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`,
{
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -497,10 +500,11 @@ export class FileManagementControllerService {
// to determine the Content-Type header
const consumes: string[] = [];
return this.httpClient.request<any>(
return this.httpClient.request(
'get',
`${this.basePath}/download/preview/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`,
{
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -567,7 +571,8 @@ export class FileManagementControllerService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.request<any>('post', `${this.basePath}/download/bulk/preview/${encodeURIComponent(String(projectId))}`, {
return this.httpClient.request('post', `${this.basePath}/download/bulk/preview/${encodeURIComponent(String(projectId))}`, {
responseType: 'blob',
body: body,
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@ -655,10 +660,11 @@ export class FileManagementControllerService {
// to determine the Content-Type header
const consumes: string[] = [];
return this.httpClient.request<any>(
return this.httpClient.request(
'get',
`${this.basePath}/download/redacted/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`,
{
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -725,7 +731,8 @@ export class FileManagementControllerService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.request<any>('post', `${this.basePath}/download/bulk/redacted/${encodeURIComponent(String(projectId))}`, {
return this.httpClient.request('post', `${this.basePath}/download/bulk/redacted/${encodeURIComponent(String(projectId))}`, {
responseType: 'blob',
body: body,
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@ -818,7 +825,8 @@ export class FileManagementControllerService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.request<any>('post', `${this.basePath}/download/report/${encodeURIComponent(String(projectId))}`, {
return this.httpClient.request('post', `${this.basePath}/download/report/${encodeURIComponent(String(projectId))}`, {
responseType: 'blob',
body: body,
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@ -898,7 +906,8 @@ export class FileManagementControllerService {
// to determine the Content-Type header
const consumes: string[] = [];
return this.httpClient.request<any>('get', `${this.basePath}/download/report/${encodeURIComponent(String(projectId))}`, {
return this.httpClient.request('get', `${this.basePath}/download/report/${encodeURIComponent(String(projectId))}`, {
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -982,7 +991,8 @@ export class FileManagementControllerService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.request<any>('post', `${this.basePath}/download/bulk/submission/${encodeURIComponent(String(projectId))}`, {
return this.httpClient.request('post', `${this.basePath}/download/bulk/submission/${encodeURIComponent(String(projectId))}`, {
responseType: 'blob',
body: body,
params: queryParameters,
withCredentials: this.configuration.withCredentials,