Adds everywhere snackbar on download rda json failure
This commit is contained in:
parent
02c36c1f61
commit
4c3775232a
|
@ -448,7 +448,15 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
||||||
const blob = new Blob([response.body], { type: 'application/json' });
|
const blob = new Blob([response.body], { type: 'application/json' });
|
||||||
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
||||||
FileSaver.saveAs(blob, filename);
|
FileSaver.saveAs(blob, filename);
|
||||||
})
|
}, async error => {
|
||||||
|
this.onExportCallbackError(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async onExportCallbackError(error: any) {
|
||||||
|
const errorJsonText = await error.error.text();
|
||||||
|
const errorObj = JSON.parse(errorJsonText);
|
||||||
|
this.uiNotificationService.snackBarNotification(errorObj.message, SnackBarNotificationLevel.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadPDF(dataset: DatasetListingModel): void {
|
downloadPDF(dataset: DatasetListingModel): void {
|
||||||
|
|
|
@ -394,7 +394,15 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
|
||||||
const blob = new Blob([response.body], { type: 'application/json' });
|
const blob = new Blob([response.body], { type: 'application/json' });
|
||||||
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
||||||
FileSaver.saveAs(blob, filename);
|
FileSaver.saveAs(blob, filename);
|
||||||
})
|
}, async error => {
|
||||||
|
this.onExportCallbackError(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async onExportCallbackError(error: any) {
|
||||||
|
const errorJsonText = await error.error.text();
|
||||||
|
const errorObj = JSON.parse(errorJsonText);
|
||||||
|
this.uiNotificationService.snackBarNotification(errorObj.message, SnackBarNotificationLevel.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFilenameFromContentDispositionHeader(header: string): string {
|
getFilenameFromContentDispositionHeader(header: string): string {
|
||||||
|
|
|
@ -662,7 +662,15 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
||||||
const blob = new Blob([response.body], { type: 'application/json' });
|
const blob = new Blob([response.body], { type: 'application/json' });
|
||||||
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
||||||
FileSaver.saveAs(blob, filename);
|
FileSaver.saveAs(blob, filename);
|
||||||
})
|
}, async error => {
|
||||||
|
this.onExportCallbackError(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async onExportCallbackError(error: any) {
|
||||||
|
const errorJsonText = await error.error.text();
|
||||||
|
const errorObj = JSON.parse(errorJsonText);
|
||||||
|
this.uiNotificationService.snackBarNotification(errorObj.message, SnackBarNotificationLevel.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFilenameFromContentDispositionHeader(header: string): string {
|
getFilenameFromContentDispositionHeader(header: string): string {
|
||||||
|
|
|
@ -252,7 +252,15 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
|
||||||
const blob = new Blob([response.body], { type: 'application/json' });
|
const blob = new Blob([response.body], { type: 'application/json' });
|
||||||
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
||||||
FileSaver.saveAs(blob, filename);
|
FileSaver.saveAs(blob, filename);
|
||||||
})
|
}, async error => {
|
||||||
|
this.onExportCallbackError(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async onExportCallbackError(error: any) {
|
||||||
|
const errorJsonText = await error.error.text();
|
||||||
|
const errorObj = JSON.parse(errorJsonText);
|
||||||
|
this.uiNotificationService.snackBarNotification(errorObj.message, SnackBarNotificationLevel.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFilenameFromContentDispositionHeader(header: string): string {
|
getFilenameFromContentDispositionHeader(header: string): string {
|
||||||
|
|
Loading…
Reference in New Issue