From 2c8cfceba6748f44a22c80676c05dfc83e9aa72b Mon Sep 17 00:00:00 2001 From: gkolokythas Date: Fri, 5 Jul 2019 15:57:28 +0300 Subject: [PATCH] Fixes bug on DMP overview when trying to finalize and adds error message on failled finalize. --- .../src/app/ui/dmp/overview/dmp-overview.component.ts | 11 +++++++++-- dmp-frontend/src/assets/i18n/en.json | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts index 885145819..4db160074 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts @@ -347,16 +347,23 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: DmpFinalizeDialogOutput) => { if (result && !result.cancelled) { - this.dmp.status = DmpStatus.Finalized; var datasetsToBeFinalized: DatasetsToBeFinalized = { uuids: result.datasetsToBeFinalized }; this.dmpService.finalize(datasetsToBeFinalized, this.dmp.id) .pipe(takeUntil(this._destroyed)) .subscribe( - complete => this.onCallbackSuccess() + complete => { + this.dmp.status = DmpStatus.Finalized; + this.onCallbackSuccess() + }, + error => this.onFinalizeCallbackError(error) ); } }); } + + onFinalizeCallbackError(error) { + this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('DMP-EDITOR.SNACK-BAR.UNSUCCESSFUL-FINALIZE'), SnackBarNotificationLevel.Error); + } } diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index a235ac4ad..dee14bbfb 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -509,7 +509,8 @@ }, "SNACK-BAR": { "UNSUCCESSFUL-DOI": "Unsuccessful DOI creation", - "SUCCESSFUL-DOI": "Successful DOI creation" + "SUCCESSFUL-DOI": "Successful DOI creation", + "UNSUCCESSFUL-FINALIZE": "Unsuccessful DMP finalization" } }, "DMP-PROFILE-LISTING": {