Merge branch 'ui-refactoring' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-refactoring
This commit is contained in:
commit
ad84ff8235
|
@ -4,6 +4,7 @@ package eu.eudat.controllers;
|
|||
import eu.eudat.configurations.dynamicproject.DynamicProjectConfiguration;
|
||||
import eu.eudat.data.dao.criteria.DynamicFieldsCriteria;
|
||||
import eu.eudat.data.dao.criteria.RequestItem;
|
||||
import eu.eudat.data.dao.entities.DMPDao;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.query.items.item.dmp.DataManagementPlanCriteriaRequest;
|
||||
import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest;
|
||||
|
@ -11,6 +12,7 @@ import eu.eudat.exceptions.datamanagementplan.DMPWithDatasetsDeleteException;
|
|||
import eu.eudat.logic.managers.DataManagementPlanManager;
|
||||
import eu.eudat.logic.managers.DatasetManager;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
||||
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
||||
import eu.eudat.models.data.dmp.DataManagementPlan;
|
||||
import eu.eudat.models.data.helpermodels.Tuple;
|
||||
|
@ -71,11 +73,19 @@ public class DMPs extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DataManagementPlanListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"{id}"}, produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataManagementPlan>> getSingle(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException {
|
||||
eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan = this.dataManagementPlanManager.getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, principal, this.dynamicProjectConfiguration);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlan>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlan));
|
||||
ResponseEntity getSingle(@PathVariable String id,@RequestHeader("Content-Type") String contentType, Principal principal) throws IllegalAccessException, InstantiationException, IOException {
|
||||
if(contentType.equals("application/xml") || contentType.equals("application/msword")){
|
||||
DMPDao dmpDao = this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao();
|
||||
VisibilityRuleService visibilityRuleService = this.getApiContext().getUtilitiesService().getVisibilityRuleService();
|
||||
ResponseEntity<byte[]> document = this.dataManagementPlanManager.getDocument(this.environment, dmpDao, id, visibilityRuleService, contentType);
|
||||
return document;
|
||||
}
|
||||
else{
|
||||
eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan = this.dataManagementPlanManager.getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, principal, this.dynamicProjectConfiguration);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlan>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlan));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -110,7 +120,6 @@ public class DMPs extends BaseController {
|
|||
}catch (DMPWithDatasetsDeleteException exception){
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/dynamic"}, consumes = "application/json", produces = "application/json")
|
||||
|
@ -120,27 +129,7 @@ public class DMPs extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Tuple<String, String>>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getXml/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<byte[]> getXml(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException {
|
||||
FileEnvelope envelope = this.dataManagementPlanManager.getXmlDocument(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService());
|
||||
InputStream resource = new FileInputStream(envelope.getFile());
|
||||
System.out.println("Mime Type of " + envelope.getFilename() + " is " +
|
||||
new MimetypesFileTypeMap().getContentType(envelope.getFile()));
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
responseHeaders.setContentLength(envelope.getFile().length());
|
||||
responseHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
responseHeaders.set("Content-Disposition", "attachment;filename=" + envelope.getFilename() + ".xml");
|
||||
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
|
||||
|
||||
byte[] content = IOUtils.toByteArray(resource);
|
||||
return new ResponseEntity<>(content,
|
||||
responseHeaders,
|
||||
HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getWord/{id}"})
|
||||
/*@RequestMapping(method = RequestMethod.GET, value = {"/getWord/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<byte[]> getWordDocument(@PathVariable String id) throws IOException, IllegalAccessException, InstantiationException {
|
||||
File file = this.dataManagementPlanManager.getWordDocument(this.environment, this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService());
|
||||
|
@ -158,11 +147,12 @@ public class DMPs extends BaseController {
|
|||
return new ResponseEntity<>(content,
|
||||
responseHeaders,
|
||||
HttpStatus.OK);
|
||||
}
|
||||
}*/
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getPDF/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<byte[]> getPDFDocument(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException, InterruptedException {
|
||||
ResponseEntity<byte[]> getPDFDocument(@PathVariable String id, @RequestHeader("Content-Type") String contentType) throws IllegalAccessException, IOException, InstantiationException, InterruptedException {
|
||||
System.out.println(contentType);
|
||||
File file = this.dataManagementPlanManager.getWordDocument(this.environment, this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService());
|
||||
File pdffile = new DatasetManager().convertToPDF(file, environment, file.getName());
|
||||
InputStream resource = new FileInputStream(pdffile);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.data.dao.entities.DatasetDao;
|
||||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.data.query.items.item.dataset.DatasetWizardAutocompleteRequest;
|
||||
import eu.eudat.data.query.items.item.datasetprofile.DatasetProfileWizardAutocompleteRequest;
|
||||
|
@ -9,6 +10,7 @@ import eu.eudat.logic.managers.DatasetWizardManager;
|
|||
import eu.eudat.logic.managers.UserManager;
|
||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
||||
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
||||
import eu.eudat.models.data.datasetwizard.DataManagentPlanListingModel;
|
||||
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
||||
|
@ -67,11 +69,19 @@ public class DatasetWizardController extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<AssociatedProfile>>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlans));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getSingle/{id}"}, produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DatasetWizardModel>> getSingle(@PathVariable String id, @ClaimedAuthorities(claims = {ANONYMOUS}) Principal principal) throws IllegalAccessException, IOException, InstantiationException {
|
||||
DatasetWizardModel dataset = this.datasetManager.getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), this.getApiContext().getOperationsContext().getDatasetRepository(), id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetWizardModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataset));
|
||||
ResponseEntity getSingle(@PathVariable String id, @RequestHeader("Content-Type") String contentType, @ClaimedAuthorities(claims = {ANONYMOUS}) Principal principal) throws IllegalAccessException, IOException, InstantiationException {
|
||||
if(contentType.equals("application/xml")){
|
||||
DatasetDao datasetDao = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao();
|
||||
VisibilityRuleService visibilityRuleService = this.getApiContext().getUtilitiesService().getVisibilityRuleService();
|
||||
|
||||
return this.datasetManager.getDocument(datasetDao, id, visibilityRuleService, contentType);
|
||||
}
|
||||
else {
|
||||
DatasetWizardModel dataset = this.datasetManager.getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), this.getApiContext().getOperationsContext().getDatasetRepository(), id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetWizardModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataset));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -111,26 +121,6 @@ public class DatasetWizardController extends BaseController {
|
|||
HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getXml/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<byte[]> getXml(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException {
|
||||
FileEnvelope envelope = new DatasetManager().getXmlDocument(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService());
|
||||
InputStream resource = new FileInputStream(envelope.getFile());
|
||||
System.out.println("Mime Type of " + envelope.getFilename() + " is " +
|
||||
new MimetypesFileTypeMap().getContentType(envelope.getFile()));
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
responseHeaders.setContentLength(envelope.getFile().length());
|
||||
responseHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
responseHeaders.set("Content-Disposition", "attachment;filename=" + envelope.getFilename() + ".xml");
|
||||
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
|
||||
|
||||
byte[] content = IOUtils.toByteArray(resource);
|
||||
return new ResponseEntity<>(content,
|
||||
responseHeaders,
|
||||
HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/get/{id}"}, produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<PagedDatasetProfile>> getSingle(@PathVariable String id) {
|
||||
eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||
|
|
|
@ -41,9 +41,11 @@ import org.springframework.web.client.RestTemplate;
|
|||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import javax.activation.MimetypesFileTypeMap;
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
@ -385,7 +387,7 @@ public class DataManagementPlanManager {
|
|||
ExportXmlBuilder xmlBuilder = new ExportXmlBuilder();
|
||||
eu.eudat.data.entities.DMP dmp = dmpRepository.find(UUID.fromString(id));
|
||||
List<Dataset> datasets = dmp.getDataset().stream().collect(Collectors.toList());
|
||||
File xmlFile = new File(UUID.randomUUID() + ".xml");
|
||||
File xmlFile = new File(dmp.getLabel() + ".xml");
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(xmlFile, true));
|
||||
Document xmlDoc = XmlBuilder.getDocument();
|
||||
Element root = xmlDoc.createElement("root");
|
||||
|
@ -439,7 +441,37 @@ public class DataManagementPlanManager {
|
|||
FileEnvelope fileEnvelope = new FileEnvelope();
|
||||
fileEnvelope.setFile(xmlFile);
|
||||
fileEnvelope.setFilename(dmp.getLabel());
|
||||
|
||||
return fileEnvelope;
|
||||
}
|
||||
|
||||
public ResponseEntity<byte[]> getDocument(Environment environment, DMPDao dmpDao, String id, VisibilityRuleService visibilityRuleService, String contentType) throws InstantiationException, IllegalAccessException, IOException{
|
||||
File file;
|
||||
switch (contentType){
|
||||
case "application/xml":
|
||||
file = getXmlDocument(dmpDao, id, visibilityRuleService).getFile();
|
||||
break;
|
||||
case "application/msword":
|
||||
file = getWordDocument(environment, dmpDao, id, visibilityRuleService);
|
||||
break;
|
||||
default:
|
||||
file = getXmlDocument(dmpDao, id, visibilityRuleService).getFile();
|
||||
}
|
||||
InputStream resource = new FileInputStream(file);
|
||||
System.out.println("Mime Type of " + file.getName() + " is " +
|
||||
new MimetypesFileTypeMap().getContentType(file));
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
responseHeaders.setContentLength(file.length());
|
||||
responseHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
responseHeaders.set("Content-Disposition", "attachment;filename=" + file.getName());
|
||||
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
|
||||
|
||||
byte[] content = org.apache.poi.util.IOUtils.toByteArray(resource);
|
||||
resource.close();
|
||||
Files.deleteIfExists(file.toPath());
|
||||
return new ResponseEntity<>(content,
|
||||
responseHeaders,
|
||||
HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,10 @@ import org.springframework.stereotype.Component;
|
|||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.activation.MimetypesFileTypeMap;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
@ -375,4 +377,25 @@ public class DatasetManager {
|
|||
datasetDao.createOrUpdate(dataset);
|
||||
}
|
||||
|
||||
public ResponseEntity<byte[]> getDocument(DatasetDao datasetDao, String id, VisibilityRuleService visibilityRuleService, String contentType) throws IllegalAccessException, IOException, InstantiationException {
|
||||
FileEnvelope envelope = getXmlDocument(datasetDao, id, visibilityRuleService);
|
||||
InputStream resource = new FileInputStream(envelope.getFile());
|
||||
System.out.println("Mime Type of " + envelope.getFilename() + " is " +
|
||||
new MimetypesFileTypeMap().getContentType(envelope.getFile()));
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
responseHeaders.setContentLength(envelope.getFile().length());
|
||||
responseHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
responseHeaders.set("Content-Disposition", "attachment;filename=" + envelope.getFilename() + ".xml");
|
||||
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
|
||||
|
||||
byte[] content = org.apache.poi.util.IOUtils.toByteArray(resource);
|
||||
resource.close();
|
||||
Files.deleteIfExists(envelope.getFile().toPath());
|
||||
|
||||
return new ResponseEntity<>(content,
|
||||
responseHeaders,
|
||||
HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import { BaseHttpService } from '../http/base-http.service';
|
|||
export class DatasetWizardService {
|
||||
|
||||
private actionUrl: string;
|
||||
private headers: HttpHeaders;
|
||||
private headers = new HttpHeaders();
|
||||
|
||||
constructor(private http: BaseHttpService, private httpClient: HttpClient) {
|
||||
this.actionUrl = environment.Server + 'datasetwizard/';
|
||||
|
@ -30,7 +30,7 @@ export class DatasetWizardService {
|
|||
}
|
||||
|
||||
public getSingle(id: String): Observable<DatasetWizardModel> {
|
||||
return this.http.get<DatasetWizardModel>(this.actionUrl + 'getSingle/' + id, { headers: this.headers });
|
||||
return this.http.get<DatasetWizardModel>(this.actionUrl + id, { headers: this.headers }); // + 'getSingle/'
|
||||
}
|
||||
|
||||
public delete(id: string): Observable<DatasetWizardModel> {
|
||||
|
@ -42,11 +42,12 @@ export class DatasetWizardService {
|
|||
}
|
||||
|
||||
public downloadPDF(id: string): Observable<HttpResponse<Blob>> {
|
||||
return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response' });
|
||||
return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response', headers: this.headers });
|
||||
}
|
||||
|
||||
public downloadXML(id: string): Observable<HttpResponse<Blob>> {
|
||||
return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response' });
|
||||
let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml')
|
||||
return this.httpClient.get(this.actionUrl + id, { responseType: 'blob', observe: 'response', headers: headerXml }); // + 'getXml/'
|
||||
}
|
||||
|
||||
public getDefinition(id: String): Observable<DatasetProfileDefinitionModel> {
|
||||
|
|
|
@ -17,10 +17,11 @@ import { BaseHttpService } from '../http/base-http.service';
|
|||
export class DmpService {
|
||||
|
||||
private actionUrl: string;
|
||||
private headers: HttpHeaders;
|
||||
private headers = new HttpHeaders();
|
||||
|
||||
constructor(private http: BaseHttpService, private httpClient: HttpClient) {
|
||||
this.actionUrl = environment.Server + 'dmps/';
|
||||
|
||||
}
|
||||
|
||||
getPaged(dataTableRequest: DataTableRequest<DmpCriteria>, fieldsGroup?: string): Observable<DataTableData<DmpListingModel>> {
|
||||
|
@ -41,7 +42,7 @@ export class DmpService {
|
|||
return this.http.get<DmpModel>(this.actionUrl + id + '/unlock', { headers: this.headers });
|
||||
}
|
||||
createDmp(dataManagementPlanModel: DmpModel): Observable<DmpModel> {
|
||||
return this.http.post<DmpModel>(this.actionUrl , dataManagementPlanModel, { headers: this.headers });
|
||||
return this.http.post<DmpModel>(this.actionUrl, dataManagementPlanModel, { headers: this.headers });
|
||||
}
|
||||
|
||||
inactivate(id: String): Observable<DmpModel> {
|
||||
|
@ -69,14 +70,17 @@ export class DmpService {
|
|||
}
|
||||
|
||||
public downloadXML(id: string): Observable<HttpResponse<Blob>> {
|
||||
return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response' });
|
||||
let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml')
|
||||
return this.httpClient.get(this.actionUrl + id, { responseType: 'blob', observe: 'response', headers: headerXml }); //+ "/getXml/"
|
||||
}
|
||||
|
||||
public downloadDocx(id: string): Observable<HttpResponse<Blob>> {
|
||||
return this.httpClient.get(this.actionUrl + 'getWord/' + id, { responseType: 'blob', observe: 'response' });
|
||||
let headerDoc: HttpHeaders = this.headers.set('Content-Type', 'application/msword')
|
||||
return this.httpClient.get(this.actionUrl + id, { responseType: 'blob', observe: 'response', headers: headerDoc });
|
||||
}
|
||||
|
||||
public downloadPDF(id: string): Observable<HttpResponse<Blob>> {
|
||||
return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response' });
|
||||
let headerPdf: HttpHeaders = this.headers.set('Content-Type', 'application/pdf')
|
||||
return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response', headers: headerPdf });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -358,7 +358,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
this.dmpService.downloadDocx(id)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(response => {
|
||||
const blob = new Blob([response.body], { type: 'application/octet-stream' });
|
||||
const blob = new Blob([response.body], { type: 'application/msword' });
|
||||
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
||||
|
||||
FileSaver.saveAs(blob, filename);
|
||||
|
@ -369,7 +369,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
this.dmpService.downloadPDF(id)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(response => {
|
||||
const blob = new Blob([response.body], { type: 'application/octet-stream' });
|
||||
const blob = new Blob([response.body], { type: 'application/pdf' });
|
||||
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
||||
|
||||
FileSaver.saveAs(blob, filename);
|
||||
|
|
Loading…
Reference in New Issue