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 }); return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response', headers: headerPdf });
} }
public downloadJson(id: string): Observable<HttpResponse<Blob>> { //GK: NO
return this.httpClient.get(this.actionUrl + 'rda/' + id, { responseType: 'blob', observe: 'response' }); // 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> <i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span> <span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
</button> </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> <i class="fa fa-file-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span> <span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span>
</button> </button> -->
</mat-menu> </mat-menu>
</div> </div>
<div class="frame mb-3 pt-4 pl-3 pr-3 pb-1"> <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) { //GK: NO
this.datasetService.downloadJson(id) // downloadJson(id: string) {
.pipe(takeUntil(this._destroyed)) // this.datasetService.downloadJson(id)
.subscribe(response => { // .pipe(takeUntil(this._destroyed))
const blob = new Blob([response.body], { type: 'application/json' }); // .subscribe(response => {
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); // const blob = new Blob([response.body], { type: 'application/json' });
FileSaver.saveAs(blob, filename); // const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
}) // FileSaver.saveAs(blob, filename);
} // })
// }
getFilenameFromContentDispositionHeader(header: string): string { getFilenameFromContentDispositionHeader(header: string): string {
const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g); const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g);