diff --git a/dmp-frontend/src/app/core/services/dmp/dmp.service.ts b/dmp-frontend/src/app/core/services/dmp/dmp.service.ts index e64d0c755..a913cb386 100644 --- a/dmp-frontend/src/app/core/services/dmp/dmp.service.ts +++ b/dmp-frontend/src/app/core/services/dmp/dmp.service.ts @@ -66,8 +66,8 @@ export class DmpService { return this.http.get(this.actionUrl + id + '/unlock', { headers: this.headers }); } - createDmp(dataManagementPlanModel: DmpModel): Observable { - return this.http.post(this.actionUrl, dataManagementPlanModel, { headers: this.headers }); + createDmp(dataManagementPlanModel: DmpModel): Observable { + return this.http.post(this.actionUrl, dataManagementPlanModel, { headers: this.headers }); } createDmpWithDatasets(dataManagementPlanModel: DmpModel): Observable { diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts index 573397159..380bb43ca 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts @@ -400,11 +400,11 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC // this.onDatasetSubmit(); // } // else { - if (!this.isFormValid()) { - this.showValidationErrorsDialog(); - return; - } - this.onSubmit(addNew, showAddDatasetDialog); + if (!this.isFormValid()) { + this.showValidationErrorsDialog(); + return; + } + this.onSubmit(addNew, showAddDatasetDialog); // } } @@ -477,10 +477,10 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC ); } - onCallbackSuccess(id?: String, datasetId?: string): void { + onCallbackSuccess(dmp?: DmpModel, datasetId?: string): void { this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); - if (id != null) { - datasetId ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans', 'edit', id], { queryParams: { dataset: datasetId } }); }) : this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans', 'edit', id]); }) + if (dmp.id != null) { + datasetId ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans', 'edit', dmp.id], { queryParams: { dataset: datasetId } }); }) : this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans', 'edit', dmp.id]); }) } else { this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans']); }); } @@ -492,9 +492,9 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC //this.validateAllFormFields(this.formGroup); } - onCallbackSuccessAddNew(id?: String) { + onCallbackSuccessAddNew(dmp?: DmpModel) { // this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); - this.router.navigate(['/datasets', 'new', id]); + this.router.navigate(['/datasets', 'new', dmp.id]); } public setErrorModel(validationErrorModel: ValidationErrorModel) { @@ -704,7 +704,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC return this.formGroup.get('profiles') && this.formGroup.get('profiles').value && this.formGroup.get('profiles').value.length > 0; } - addDatasetOpenDialog(id: String) { + addDatasetOpenDialog(dmp: DmpModel) { const dialogRef = this.dialog.open(ConfirmationDialogComponent, { maxWidth: '500px', restoreFocus: false, @@ -721,7 +721,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC // this.router.navigate(['datasets/new/' + id]); this.addDataset(); } else { - id != null ? this.router.navigate(['/plans', 'edit', id]) : this.router.navigate(['/plans']); + dmp.id != null ? this.router.navigate(['/plans', 'edit', dmp.id]) : this.router.navigate(['/plans']); } }); }