This commit is contained in:
George Kalampokis 2020-10-02 10:35:23 +03:00
commit b64f6e98fe
2 changed files with 14 additions and 14 deletions

View File

@ -66,8 +66,8 @@ export class DmpService {
return this.http.get<DmpModel>(this.actionUrl + id + '/unlock', { headers: this.headers }); return this.http.get<DmpModel>(this.actionUrl + id + '/unlock', { headers: this.headers });
} }
createDmp(dataManagementPlanModel: DmpModel): Observable<String> { createDmp(dataManagementPlanModel: DmpModel): Observable<DmpModel> {
return this.http.post<String>(this.actionUrl, dataManagementPlanModel, { headers: this.headers }); return this.http.post<DmpModel>(this.actionUrl, dataManagementPlanModel, { headers: this.headers });
} }
createDmpWithDatasets(dataManagementPlanModel: DmpModel): Observable<String> { createDmpWithDatasets(dataManagementPlanModel: DmpModel): Observable<String> {

View File

@ -400,11 +400,11 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
// this.onDatasetSubmit(); // this.onDatasetSubmit();
// } // }
// else { // else {
if (!this.isFormValid()) { if (!this.isFormValid()) {
this.showValidationErrorsDialog(); this.showValidationErrorsDialog();
return; return;
} }
this.onSubmit(addNew, showAddDatasetDialog); 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); 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) { if (dmp.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]); }) 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 { } else {
this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans']); }); 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); //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.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) { 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; 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, { const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '500px', maxWidth: '500px',
restoreFocus: false, restoreFocus: false,
@ -721,7 +721,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
// this.router.navigate(['datasets/new/' + id]); // this.router.navigate(['datasets/new/' + id]);
this.addDataset(); this.addDataset();
} else { } 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']);
} }
}); });
} }