Removed RDA JSON export from Datasets (it doesn't and it can't (cycling dependency))

This commit is contained in:
George Kalampokis 2020-07-15 12:35:22 +03:00
parent 69fc698866
commit d40e9fadbf
3 changed files with 17 additions and 14 deletions

View File

@ -90,7 +90,8 @@ export class DatasetService {
return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response', headers: headerPdf });
}
public downloadJson(id: string): Observable<HttpResponse<Blob>> {
return this.httpClient.get(this.actionUrl + 'rda/' + id, { responseType: 'blob', observe: 'response' });
}
//GK: NO
// public downloadJson(id: string): Observable<HttpResponse<Blob>> {
// return this.httpClient.get(this.actionUrl + 'rda/' + id, { responseType: 'blob', observe: 'response' });
// }
}

View File

@ -122,10 +122,11 @@
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadJson(dataset.id)">
<!-- GK: NO-->
<!-- <button mat-menu-item (click)="downloadJson(dataset.id)">
<i class="fa fa-file-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span>
</button>
</button> -->
</mat-menu>
</div>
<div class="frame mb-3 pt-4 pl-3 pr-3 pb-1">

View File

@ -342,15 +342,16 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
});
}
downloadJson(id: string) {
this.datasetService.downloadJson(id)
.pipe(takeUntil(this._destroyed))
.subscribe(response => {
const blob = new Blob([response.body], { type: 'application/json' });
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename);
})
}
//GK: NO
// downloadJson(id: string) {
// this.datasetService.downloadJson(id)
// .pipe(takeUntil(this._destroyed))
// .subscribe(response => {
// const blob = new Blob([response.body], { type: 'application/json' });
// const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
// FileSaver.saveAs(blob, filename);
// })
// }
getFilenameFromContentDispositionHeader(header: string): string {
const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g);