diff --git a/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.ts b/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.ts index 635649175..4f006f28d 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.ts @@ -41,6 +41,7 @@ export class DescriptionBaseFieldsEditorComponent extends BaseComponent { private loadDescriptionTemplates(): void { const dmpDescriptionTemplates: DmpDescriptionTemplate[] = this.description.dmp.dmpDescriptionTemplates.filter(x => x.sectionId == this.description.dmpDescriptionTemplate.sectionId && x.isActive == IsActive.Active); const currentVersionsOfDescriptionTemplates = dmpDescriptionTemplates.map(x => x.currentDescriptionTemplate); + //Check if the used tempalte in included in the current list. If not add it. if (this.description.descriptionTemplate && currentVersionsOfDescriptionTemplates.find(x => x.id == this.description?.descriptionTemplate?.id) == null) { if (this.description.status === 0) { this.openDeprecatedDescriptionTemplateDialog(); diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html index 698244d6b..c903e861c 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html @@ -47,7 +47,7 @@
{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}} *
- +
diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts index 4f93b3b14..b12b15522 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts @@ -62,10 +62,10 @@ export class DmpEditorComponent extends BaseEditor implemen isNew = true; isDeleted = false; + goToNextStep = true; item: Dmp; selectedBlueprint: DmpBlueprint; step: number = 0; - formTouchEvent: EventEmitter = new EventEmitter(); //Enums descriptionStatusEnum = DescriptionStatus; @@ -225,7 +225,7 @@ export class DmpEditorComponent extends BaseEditor implemen this.formGroup.disable(); } - if (this.item != null) { + if (this.item != null && this.goToNextStep) { this.nextStep(); } } @@ -341,28 +341,25 @@ export class DmpEditorComponent extends BaseEditor implemen } selectDefaultBlueprint(): void { - if (!(this.formGroup.get('label').value && this.formGroup.get('description').value)) { - this.formGroup.get('label').markAsTouched(); - this.formTouchEvent.emit(true); - return; - } - this.dmpBlueprintService.getSingle(this.configurationService.defaultBlueprintId, DmpEditorResolver.blueprintLookupFields()).pipe(takeUntil(this._destroyed)).subscribe(data => { this.selectedBlueprint = data; this.formGroup.get('blueprint').setValue(this.selectedBlueprint.id); - this.buildFormAfterBlueprintSelection(); - this.nextStep(); + + const goToNextStep: boolean = this.formGroup.get('label').valid && this.formGroup.get('description').valid; + this.buildFormAfterBlueprintSelection(goToNextStep); }); } - private buildFormAfterBlueprintSelection() { + private buildFormAfterBlueprintSelection(goToNextStep: boolean = true) { const dmp: Dmp = { label: this.formGroup.get('label').value, description: this.formGroup.get('description').value, blueprint: this.selectedBlueprint, status: DmpStatus.Draft } + this.prepareForm(dmp); + this.goToNextStep = true; //reset } //