Report Template Upload
This commit is contained in:
parent
f3fd36a851
commit
e449d49c8c
@ -83,4 +83,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<input #fileInput (change)="uploadTemplate($event)" hidden type="file" />
|
<input
|
||||||
|
#fileInput
|
||||||
|
(change)="uploadTemplate($event)"
|
||||||
|
hidden
|
||||||
|
type="file"
|
||||||
|
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||||
|
/>
|
||||||
|
|||||||
@ -11,6 +11,8 @@ import {
|
|||||||
placeholdersDescriptionsTranslations
|
placeholdersDescriptionsTranslations
|
||||||
} from '../../translations/placeholders-descriptions-translations';
|
} from '../../translations/placeholders-descriptions-translations';
|
||||||
import { removeBraces } from '../../../../utils/functions';
|
import { removeBraces } from '../../../../utils/functions';
|
||||||
|
import { Toaster } from '../../../../services/toaster.service';
|
||||||
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
|
|
||||||
interface Placeholder {
|
interface Placeholder {
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
@ -37,6 +39,7 @@ export class ReportsScreenComponent implements OnInit {
|
|||||||
private readonly _appStateService: AppStateService,
|
private readonly _appStateService: AppStateService,
|
||||||
private readonly _reportTemplateService: ReportTemplateControllerService,
|
private readonly _reportTemplateService: ReportTemplateControllerService,
|
||||||
private readonly _dialogService: AdminDialogService,
|
private readonly _dialogService: AdminDialogService,
|
||||||
|
private readonly _toaster: Toaster,
|
||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
readonly permissionsService: PermissionsService
|
readonly permissionsService: PermissionsService
|
||||||
) {
|
) {
|
||||||
@ -81,9 +84,17 @@ export class ReportsScreenComponent implements OnInit {
|
|||||||
|
|
||||||
private async _uploadTemplate($event) {
|
private async _uploadTemplate($event) {
|
||||||
const file = $event.target.files[0];
|
const file = $event.target.files[0];
|
||||||
await this._reportTemplateService.uploadTemplateForm(this._appStateService.activeDossierTemplateId, file).toPromise();
|
|
||||||
|
if (this._isValidFile(file)) {
|
||||||
|
await this._reportTemplateService.uploadTemplateForm(this._appStateService.activeDossierTemplateId, false, file).toPromise();
|
||||||
|
if (this._isExcelFile(file)) {
|
||||||
|
// await this._reportTemplateService.uploadTemplateForm(this._appStateService.activeDossierTemplateId, true, file).toPromise();
|
||||||
|
}
|
||||||
this._fileInput.nativeElement.value = null;
|
this._fileInput.nativeElement.value = null;
|
||||||
await this._loadReportTemplates();
|
await this._loadReportTemplates();
|
||||||
|
} else {
|
||||||
|
this._toaster.error(_('reports-screen.invalid-upload'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _deleteTemplate(template: ReportTemplate) {
|
private async _deleteTemplate(template: ReportTemplate) {
|
||||||
@ -109,4 +120,22 @@ export class ReportsScreenComponent implements OnInit {
|
|||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _isValidFile(file: File): boolean {
|
||||||
|
return this._isExcelFile(file) || this._isWordFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
private _isExcelFile(file: File): boolean {
|
||||||
|
return (
|
||||||
|
file.type?.toLowerCase() === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
|
||||||
|
file.name.toLowerCase().endsWith('.xlsx')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private _isWordFile(file: File): boolean {
|
||||||
|
return (
|
||||||
|
file.type?.toLowerCase() === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ||
|
||||||
|
file.name.toLowerCase().endsWith('.docx')
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1192,6 +1192,7 @@
|
|||||||
},
|
},
|
||||||
"reports": "Reports",
|
"reports": "Reports",
|
||||||
"reports-screen": {
|
"reports-screen": {
|
||||||
|
"invalid-upload": "Invalid format selected for Upload! Supported formats are XLSX and DOCX",
|
||||||
"description": "A short text explaining how to create report documents. It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.",
|
"description": "A short text explaining how to create report documents. It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.",
|
||||||
"descriptions": {
|
"descriptions": {
|
||||||
"dossier-attributes": "This placeholder gets replaced with the value of the dossier attribute <code>{attribute}</code>.",
|
"dossier-attributes": "This placeholder gets replaced with the value of the dossier attribute <code>{attribute}</code>.",
|
||||||
|
|||||||
@ -16,17 +16,17 @@ import { CustomHttpUrlEncodingCodec } from '../encoder';
|
|||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { PlaceholdersResponse } from '../model/placeholdersResponse';
|
||||||
import { ReportTemplate } from '../model/reportTemplate';
|
import { ReportTemplate } from '../model/reportTemplate';
|
||||||
|
|
||||||
import { BASE_PATH } from '../variables';
|
import { BASE_PATH } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { PlaceholdersResponse } from '../model/placeholdersResponse';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ReportTemplateControllerService {
|
export class ReportTemplateControllerService {
|
||||||
|
protected basePath = '';
|
||||||
public defaultHeaders = new HttpHeaders();
|
public defaultHeaders = new HttpHeaders();
|
||||||
public configuration = new Configuration();
|
public configuration = new Configuration();
|
||||||
protected basePath = '';
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected httpClient: HttpClient,
|
protected httpClient: HttpClient,
|
||||||
@ -42,6 +42,151 @@ export class ReportTemplateControllerService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete template file for redaction-report
|
||||||
|
* None
|
||||||
|
* @param dossierTemplateId dossierTemplateId
|
||||||
|
* @param templateId templateId
|
||||||
|
* @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 deleteTemplate(dossierTemplateId: string, templateId: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
|
||||||
|
public deleteTemplate(
|
||||||
|
dossierTemplateId: string,
|
||||||
|
templateId: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean
|
||||||
|
): Observable<HttpResponse<any>>;
|
||||||
|
public deleteTemplate(
|
||||||
|
dossierTemplateId: string,
|
||||||
|
templateId: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean
|
||||||
|
): Observable<HttpEvent<any>>;
|
||||||
|
public deleteTemplate(
|
||||||
|
dossierTemplateId: string,
|
||||||
|
templateId: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false
|
||||||
|
): Observable<any> {
|
||||||
|
if (dossierTemplateId === null || dossierTemplateId === undefined) {
|
||||||
|
throw new Error('Required parameter dossierTemplateId was null or undefined when calling deleteTemplate.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (templateId === null || templateId === undefined) {
|
||||||
|
throw new Error('Required parameter templateId was null or undefined when calling deleteTemplate.');
|
||||||
|
}
|
||||||
|
|
||||||
|
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[] = [];
|
||||||
|
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||||
|
if (httpHeaderAcceptSelected !== undefined) {
|
||||||
|
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request<any>(
|
||||||
|
'delete',
|
||||||
|
`${this.basePath}/templateUpload/${encodeURIComponent(String(dossierTemplateId))}/${encodeURIComponent(String(templateId))}`,
|
||||||
|
{
|
||||||
|
withCredentials: this.configuration.withCredentials,
|
||||||
|
headers: headers,
|
||||||
|
observe: observe,
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download template file for redaction-report
|
||||||
|
* None
|
||||||
|
* @param dossierTemplateId dossierTemplateId
|
||||||
|
* @param templateId templateId
|
||||||
|
* @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 downloadReportTemplate(
|
||||||
|
dossierTemplateId: string,
|
||||||
|
templateId: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean
|
||||||
|
): Observable<any>;
|
||||||
|
public downloadReportTemplate(
|
||||||
|
dossierTemplateId: string,
|
||||||
|
templateId: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean
|
||||||
|
): Observable<HttpResponse<any>>;
|
||||||
|
public downloadReportTemplate(
|
||||||
|
dossierTemplateId: string,
|
||||||
|
templateId: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean
|
||||||
|
): Observable<HttpEvent<any>>;
|
||||||
|
public downloadReportTemplate(
|
||||||
|
dossierTemplateId: string,
|
||||||
|
templateId: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false
|
||||||
|
): Observable<any> {
|
||||||
|
if (dossierTemplateId === null || dossierTemplateId === undefined) {
|
||||||
|
throw new Error('Required parameter dossierTemplateId was null or undefined when calling downloadReportTemplate.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (templateId === null || templateId === undefined) {
|
||||||
|
throw new Error('Required parameter templateId was null or undefined when calling downloadReportTemplate.');
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request<any>(
|
||||||
|
'get',
|
||||||
|
`${this.basePath}/templateUpload/${encodeURIComponent(String(dossierTemplateId))}/${encodeURIComponent(String(templateId))}`,
|
||||||
|
{
|
||||||
|
withCredentials: this.configuration.withCredentials,
|
||||||
|
headers: headers,
|
||||||
|
observe: observe,
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of available placeholders
|
* Returns list of available placeholders
|
||||||
* None
|
* None
|
||||||
@ -97,144 +242,6 @@ export class ReportTemplateControllerService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete template file for redaction-report
|
|
||||||
* None
|
|
||||||
* @param dossierTemplateId dossierTemplateId
|
|
||||||
* @param templateId templateId
|
|
||||||
* @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 deleteTemplate(dossierTemplateId: string, templateId: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
|
|
||||||
|
|
||||||
public deleteTemplate(
|
|
||||||
dossierTemplateId: string,
|
|
||||||
templateId: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean
|
|
||||||
): Observable<HttpResponse<any>>;
|
|
||||||
|
|
||||||
public deleteTemplate(
|
|
||||||
dossierTemplateId: string,
|
|
||||||
templateId: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean
|
|
||||||
): Observable<HttpEvent<any>>;
|
|
||||||
|
|
||||||
public deleteTemplate(
|
|
||||||
dossierTemplateId: string,
|
|
||||||
templateId: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false
|
|
||||||
): Observable<any> {
|
|
||||||
if (dossierTemplateId === null || dossierTemplateId === undefined) {
|
|
||||||
throw new Error('Required parameter dossierTemplateId was null or undefined when calling deleteTemplate.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (templateId === null || templateId === undefined) {
|
|
||||||
throw new Error('Required parameter templateId was null or undefined when calling deleteTemplate.');
|
|
||||||
}
|
|
||||||
|
|
||||||
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[] = [];
|
|
||||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
if (httpHeaderAcceptSelected !== undefined) {
|
|
||||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.httpClient.request<any>(
|
|
||||||
'delete',
|
|
||||||
`${this.basePath}/templateUpload/${encodeURIComponent(String(dossierTemplateId))}/${encodeURIComponent(String(templateId))}`,
|
|
||||||
{
|
|
||||||
withCredentials: this.configuration.withCredentials,
|
|
||||||
headers: headers,
|
|
||||||
observe: observe,
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Download template file for redaction-report
|
|
||||||
* None
|
|
||||||
* @param dossierTemplateId dossierTemplateId
|
|
||||||
* @param templateId templateId
|
|
||||||
* @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 downloadReportTemplate(
|
|
||||||
dossierTemplateId: string,
|
|
||||||
templateId: string,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean
|
|
||||||
): Observable<any>;
|
|
||||||
|
|
||||||
public downloadReportTemplate(
|
|
||||||
dossierTemplateId: string,
|
|
||||||
templateId: string,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean
|
|
||||||
): Observable<HttpResponse<any>>;
|
|
||||||
|
|
||||||
public downloadReportTemplate(
|
|
||||||
dossierTemplateId: string,
|
|
||||||
templateId: string,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean
|
|
||||||
): Observable<HttpEvent<any>>;
|
|
||||||
|
|
||||||
public downloadReportTemplate(
|
|
||||||
dossierTemplateId: string,
|
|
||||||
templateId: string,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false
|
|
||||||
): Observable<any> {
|
|
||||||
if (dossierTemplateId === null || dossierTemplateId === undefined) {
|
|
||||||
throw new Error('Required parameter dossierTemplateId was null or undefined when calling downloadReportTemplate.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (templateId === null || templateId === undefined) {
|
|
||||||
throw new Error('Required parameter templateId was null or undefined when calling downloadReportTemplate.');
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.httpClient.request(
|
|
||||||
'get',
|
|
||||||
`${this.basePath}/templateUpload/${encodeURIComponent(String(dossierTemplateId))}/${encodeURIComponent(String(templateId))}`,
|
|
||||||
{
|
|
||||||
withCredentials: this.configuration.withCredentials,
|
|
||||||
responseType: 'blob',
|
|
||||||
headers: headers,
|
|
||||||
observe: observe,
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns available templates for redaction-report
|
* Returns available templates for redaction-report
|
||||||
* None
|
* None
|
||||||
@ -247,19 +254,16 @@ export class ReportTemplateControllerService {
|
|||||||
observe?: 'body',
|
observe?: 'body',
|
||||||
reportProgress?: boolean
|
reportProgress?: boolean
|
||||||
): Observable<Array<ReportTemplate>>;
|
): Observable<Array<ReportTemplate>>;
|
||||||
|
|
||||||
public getAvailableReportTemplates(
|
public getAvailableReportTemplates(
|
||||||
dossierTemplateId: string,
|
dossierTemplateId: string,
|
||||||
observe?: 'response',
|
observe?: 'response',
|
||||||
reportProgress?: boolean
|
reportProgress?: boolean
|
||||||
): Observable<HttpResponse<Array<ReportTemplate>>>;
|
): Observable<HttpResponse<Array<ReportTemplate>>>;
|
||||||
|
|
||||||
public getAvailableReportTemplates(
|
public getAvailableReportTemplates(
|
||||||
dossierTemplateId: string,
|
dossierTemplateId: string,
|
||||||
observe?: 'events',
|
observe?: 'events',
|
||||||
reportProgress?: boolean
|
reportProgress?: boolean
|
||||||
): Observable<HttpEvent<Array<ReportTemplate>>>;
|
): Observable<HttpEvent<Array<ReportTemplate>>>;
|
||||||
|
|
||||||
public getAvailableReportTemplates(dossierTemplateId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
public getAvailableReportTemplates(dossierTemplateId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
||||||
if (dossierTemplateId === null || dossierTemplateId === undefined) {
|
if (dossierTemplateId === null || dossierTemplateId === undefined) {
|
||||||
throw new Error('Required parameter dossierTemplateId was null or undefined when calling getAvailableReportTemplates.');
|
throw new Error('Required parameter dossierTemplateId was null or undefined when calling getAvailableReportTemplates.');
|
||||||
@ -297,33 +301,35 @@ export class ReportTemplateControllerService {
|
|||||||
* Upload template file for redaction-report
|
* Upload template file for redaction-report
|
||||||
* None
|
* None
|
||||||
* @param dossierTemplateId The dossierTemplateId, the report template belongs to
|
* @param dossierTemplateId The dossierTemplateId, the report template belongs to
|
||||||
|
* @param multiFileReport
|
||||||
* @param file
|
* @param file
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
* @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.
|
* @param reportProgress flag to report request and response progress.
|
||||||
*/
|
*/
|
||||||
public uploadTemplateForm(
|
public uploadTemplateForm(
|
||||||
dossierTemplateId: string,
|
dossierTemplateId: string,
|
||||||
|
multiFileReport?: boolean,
|
||||||
file?: Blob,
|
file?: Blob,
|
||||||
observe?: 'body',
|
observe?: 'body',
|
||||||
reportProgress?: boolean
|
reportProgress?: boolean
|
||||||
): Observable<ReportTemplate>;
|
): Observable<ReportTemplate>;
|
||||||
|
|
||||||
public uploadTemplateForm(
|
public uploadTemplateForm(
|
||||||
dossierTemplateId: string,
|
dossierTemplateId: string,
|
||||||
|
multiFileReport?: boolean,
|
||||||
file?: Blob,
|
file?: Blob,
|
||||||
observe?: 'response',
|
observe?: 'response',
|
||||||
reportProgress?: boolean
|
reportProgress?: boolean
|
||||||
): Observable<HttpResponse<ReportTemplate>>;
|
): Observable<HttpResponse<ReportTemplate>>;
|
||||||
|
|
||||||
public uploadTemplateForm(
|
public uploadTemplateForm(
|
||||||
dossierTemplateId: string,
|
dossierTemplateId: string,
|
||||||
|
multiFileReport?: boolean,
|
||||||
file?: Blob,
|
file?: Blob,
|
||||||
observe?: 'events',
|
observe?: 'events',
|
||||||
reportProgress?: boolean
|
reportProgress?: boolean
|
||||||
): Observable<HttpEvent<ReportTemplate>>;
|
): Observable<HttpEvent<ReportTemplate>>;
|
||||||
|
|
||||||
public uploadTemplateForm(
|
public uploadTemplateForm(
|
||||||
dossierTemplateId: string,
|
dossierTemplateId: string,
|
||||||
|
multiFileReport?: boolean,
|
||||||
file?: Blob,
|
file?: Blob,
|
||||||
observe: any = 'body',
|
observe: any = 'body',
|
||||||
reportProgress: boolean = false
|
reportProgress: boolean = false
|
||||||
@ -365,6 +371,9 @@ export class ReportTemplateControllerService {
|
|||||||
formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
|
formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (multiFileReport !== undefined) {
|
||||||
|
formParams = (formParams.append('multiFileReport', <any>multiFileReport) as any) || formParams;
|
||||||
|
}
|
||||||
if (file !== undefined) {
|
if (file !== undefined) {
|
||||||
formParams = (formParams.append('file', <any>file) as any) || formParams;
|
formParams = (formParams.append('file', <any>file) as any) || formParams;
|
||||||
}
|
}
|
||||||
@ -381,18 +390,4 @@ export class ReportTemplateControllerService {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,6 @@ export interface Notification {
|
|||||||
readDate?: string;
|
readDate?: string;
|
||||||
seenDate?: string;
|
seenDate?: string;
|
||||||
softDeleted?: string;
|
softDeleted?: string;
|
||||||
target?: any;
|
target?: string;
|
||||||
userId?: string;
|
userId?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
export interface ReportTemplate {
|
export interface ReportTemplate {
|
||||||
dossierTemplateId?: string;
|
dossierTemplateId?: string;
|
||||||
fileName?: string;
|
fileName?: string;
|
||||||
|
multiFileReport?: boolean;
|
||||||
storageId?: string;
|
storageId?: string;
|
||||||
templateId?: string;
|
templateId?: string;
|
||||||
uploadDate?: string;
|
uploadDate?: string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user