check if blueprint is valid when finalizing in editor

This commit is contained in:
Bernaldo Mihasi 2023-09-27 16:20:54 +03:00
parent 2f4e123ac9
commit 0bd3422903
1 changed files with 13 additions and 8 deletions

View File

@ -399,9 +399,9 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
this.descriptionTemplatesArray(sectionIndex).push(profile.buildForm()); this.descriptionTemplatesArray(sectionIndex).push(profile.buildForm());
} }
formSubmit(): void { checkValidity() {
this.formService.touchAllFormFields(this.formGroup); this.formService.touchAllFormFields(this.formGroup);
if (!this.isFormValid()) { return; } if (!this.isFormValid()) { return false; }
let errorMessages = []; let errorMessages = [];
if(!this.hasTitle()) { if(!this.hasTitle()) {
errorMessages.push("Title should be set."); errorMessages.push("Title should be set.");
@ -414,8 +414,13 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
} }
if(errorMessages.length > 0) { if(errorMessages.length > 0) {
this.showValidationErrorsDialog(undefined, errorMessages); this.showValidationErrorsDialog(undefined, errorMessages);
return; return false;
} }
return true;
}
formSubmit(): void {
if (this.checkValidity())
this.onSubmit(); this.onSubmit();
} }
@ -548,11 +553,11 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
} }
finalize() { finalize() {
//const data = this.form.value; if (this.checkValidity()) {
this.formGroup.get('status').setValue(DmpProfileStatus.Finalized); this.formGroup.get('status').setValue(DmpProfileStatus.Finalized);
this.onSubmit(); this.onSubmit();
} }
}
downloadXML(): void { downloadXML(): void {
this.dmpProfileService.downloadXML(this.dmpProfileId) this.dmpProfileService.downloadXML(this.dmpProfileId)