diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpblueprintdefinition/DescriptionTemplatePersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpblueprintdefinition/DescriptionTemplatePersist.java index 62e754a1e..617651266 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpblueprintdefinition/DescriptionTemplatePersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpblueprintdefinition/DescriptionTemplatePersist.java @@ -4,9 +4,11 @@ import eu.eudat.commons.validation.BaseValidator; import gr.cite.tools.validation.specification.Specification; import eu.eudat.convention.ConventionService; import eu.eudat.errorcode.ErrorThesaurusProperties; -import eu.eudat.model.persist.descriptiontemplatedefinition.FieldPersist; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Scope; import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.List; @@ -74,6 +76,8 @@ public class DescriptionTemplatePersist { this.maxMultiplicity = maxMultiplicity; } + @Component(DescriptionTemplatePersist.DescriptionTemplatePersistValidator.ValidatorName) + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public static class DescriptionTemplatePersistValidator extends BaseValidator { public static final String ValidatorName = "DmpBlueprint.DescriptionTemplatePersistValidator"; diff --git a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.html b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.html index bfa801bce..23733bbaa 100644 --- a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.html +++ b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.html @@ -109,6 +109,7 @@ {{'DMP-BLUEPRINT-EDITOR.FIELDS.SYSTEM-FIELD' | translate}} + {{field.get('dataType').getError('backendError').message}}
@@ -170,6 +171,7 @@ {{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}} + {{section.get('hasTemplates').getError('backendError').message}}
@@ -180,8 +182,7 @@
{{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}} - - +
diff --git a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts index b39341ccd..0537260c4 100644 --- a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts +++ b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.component.ts @@ -35,6 +35,8 @@ import { map, takeUntil } from 'rxjs/operators'; import { DescriptionTemplatesInSectionEditorModel, DmpBlueprintDefinitionSectionEditorModel, DmpBlueprintEditorModel, FieldInSectionEditorModel } from './dmp-blueprint-editor.model'; import { DmpBlueprintEditorResolver } from './dmp-blueprint-editor.resolver'; import { DmpBlueprintEditorService } from './dmp-blueprint-editor.service'; +import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; +import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; @Component({ @@ -55,16 +57,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor(DmpBlueprintSystemFieldType); dmpBlueprintExtraFieldDataType = DmpBlueprintExtraFieldDataType; public dmpBlueprintExtraFieldDataTypeEnum = this.enumUtils.getEnumValues(DmpBlueprintExtraFieldDataType); - - //TODO refactor - // blueprintsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = { - // filterFn: this.filterDescriptionTempaltes.bind(this), - // initialItems: (excludedItems: any[]) => this.filterDescriptionTempaltes('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))), - // displayFn: (item: DatasetProfileModel) => item.label, - // titleFn: (item: DatasetProfileModel) => item.label, - // subtitleFn: (item: DatasetProfileModel) => item.description, - // popupItemActionIcon: 'visibility' - // }; + templatesAutoCompleteConfiguration: SingleAutoCompleteConfiguration protected get canDelete(): boolean { return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteDmpBlueprint); @@ -103,9 +96,10 @@ export class DmpBlueprintEditorComponent extends BaseEditor DescriptionTemplatesInSectionEditorModel.reapplyValidators({ formGroup: control as UntypedFormGroup, rootPath: `${rootPath}descriptionTemplates[${index}].`,