Fixes bug on DMP overview when trying to finalize and adds error message on failled finalize.

This commit is contained in:
gkolokythas 2019-07-05 15:57:28 +03:00
parent de56a1acc4
commit 2c8cfceba6
2 changed files with 11 additions and 3 deletions

View File

@ -347,16 +347,23 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
}); });
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: DmpFinalizeDialogOutput) => { dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: DmpFinalizeDialogOutput) => {
if (result && !result.cancelled) { if (result && !result.cancelled) {
this.dmp.status = DmpStatus.Finalized;
var datasetsToBeFinalized: DatasetsToBeFinalized = { var datasetsToBeFinalized: DatasetsToBeFinalized = {
uuids: result.datasetsToBeFinalized uuids: result.datasetsToBeFinalized
}; };
this.dmpService.finalize(datasetsToBeFinalized, this.dmp.id) this.dmpService.finalize(datasetsToBeFinalized, this.dmp.id)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .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);
}
} }

View File

@ -509,7 +509,8 @@
}, },
"SNACK-BAR": { "SNACK-BAR": {
"UNSUCCESSFUL-DOI": "Unsuccessful DOI creation", "UNSUCCESSFUL-DOI": "Unsuccessful DOI creation",
"SUCCESSFUL-DOI": "Successful DOI creation" "SUCCESSFUL-DOI": "Successful DOI creation",
"UNSUCCESSFUL-FINALIZE": "Unsuccessful DMP finalization"
} }
}, },
"DMP-PROFILE-LISTING": { "DMP-PROFILE-LISTING": {