diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxIntegrationEvent.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxIntegrationEvent.java index 97d7c1c52..54d725201 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxIntegrationEvent.java +++ b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxIntegrationEvent.java @@ -23,6 +23,10 @@ public class OutboxIntegrationEvent extends IntegrationEvent { public static final String USER_REMOVE = "USER_REMOVE"; + public static final String DMP_TOUCH = "DMP_TOUCH"; + + public static final String DESCRIPTION_TOUCH = "DESCRIPTION_TOUCH"; + public static final String WHAT_YOU_KNOW_ABOUT_ME_COMPLETED = "WHAT_YOU_KNOW_ABOUT_ME_COMPLETED"; public static final String GENERATE_FILE = "GENERATE_FILE"; diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxProperties.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxProperties.java index 431027f04..8a66f6a26 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxProperties.java +++ b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxProperties.java @@ -19,6 +19,10 @@ public class OutboxProperties { private final String userTouchTopic; + private final String dmpTouchTopic; + + private final String descriptionTouchTopic; + private final String notifyTopic; private final String forgetMeCompletedTopic; @@ -32,8 +36,8 @@ public class OutboxProperties { String tenantRemovalTopic, String tenantReactivationTopic, String tenantUserInviteTopic, - String userRemovalTopic, - String userTouchTopic, + String userRemovalTopic, + String userTouchTopic, String dmpTouchTopic, String descriptionTouchTopic, String notifyTopic, String forgetMeCompletedTopic, String whatYouKnowAboutMeCompletedTopic, @@ -46,6 +50,8 @@ public class OutboxProperties { this.tenantUserInviteTopic = tenantUserInviteTopic; this.userRemovalTopic = userRemovalTopic; this.userTouchTopic = userTouchTopic; + this.dmpTouchTopic = dmpTouchTopic; + this.descriptionTouchTopic = descriptionTouchTopic; this.notifyTopic = notifyTopic; this.forgetMeCompletedTopic = forgetMeCompletedTopic; this.whatYouKnowAboutMeCompletedTopic = whatYouKnowAboutMeCompletedTopic; @@ -80,6 +86,14 @@ public class OutboxProperties { return userTouchTopic; } + public String getDmpTouchTopic() { + return dmpTouchTopic; + } + + public String getDescriptionTouchTopic() { + return descriptionTouchTopic; + } + public String getNotifyTopic() { return notifyTopic; } diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxRepositoryImpl.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxRepositoryImpl.java index 2e1529411..4ef2cd90b 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxRepositoryImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/OutboxRepositoryImpl.java @@ -407,6 +407,14 @@ public class OutboxRepositoryImpl implements OutboxRepository { routingKey = this.outboxProperties.getUserTouchTopic(); break; } + case OutboxIntegrationEvent.DMP_TOUCH: { + routingKey = this.outboxProperties.getDmpTouchTopic(); + break; + } + case OutboxIntegrationEvent.DESCRIPTION_TOUCH: { + routingKey = this.outboxProperties.getDescriptionTouchTopic(); + break; + } case OutboxIntegrationEvent.FORGET_ME_COMPLETED: { routingKey = this.outboxProperties.getForgetMeCompletedTopic(); break; diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEvent.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEvent.java new file mode 100644 index 000000000..469fd7f5e --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEvent.java @@ -0,0 +1,102 @@ +package eu.eudat.integrationevent.outbox.descriptiontouched; + +import eu.eudat.commons.enums.DescriptionStatus; +import eu.eudat.integrationevent.TrackedEvent; +import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist; + +import java.util.List; +import java.util.UUID; + +public class DescriptionTouchedIntegrationEvent extends TrackedEvent { + + private UUID id; + + private String label; + + private UUID dmpId; + + private UUID dmpDescriptionTemplateId; + + private UUID descriptionTemplateId; + + private DescriptionStatus status; + + private String description; + + private PropertyDefinitionPersist properties; + + private List tags; + + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public UUID getDmpId() { + return dmpId; + } + + public void setDmpId(UUID dmpId) { + this.dmpId = dmpId; + } + + public UUID getDmpDescriptionTemplateId() { + return dmpDescriptionTemplateId; + } + + public void setDmpDescriptionTemplateId(UUID dmpDescriptionTemplateId) { + this.dmpDescriptionTemplateId = dmpDescriptionTemplateId; + } + + public UUID getDescriptionTemplateId() { + return descriptionTemplateId; + } + + public void setDescriptionTemplateId(UUID descriptionTemplateId) { + this.descriptionTemplateId = descriptionTemplateId; + } + + public DescriptionStatus getStatus() { + return status; + } + + public void setStatus(DescriptionStatus status) { + this.status = status; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public PropertyDefinitionPersist getProperties() { + return properties; + } + + public void setProperties(PropertyDefinitionPersist properties) { + this.properties = properties; + } + + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandler.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandler.java new file mode 100644 index 000000000..d2fb9fcdf --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandler.java @@ -0,0 +1,23 @@ +package eu.eudat.integrationevent.outbox.descriptiontouched; + +import eu.eudat.model.persist.DescriptionPersist; + +public interface DescriptionTouchedIntegrationEventHandler { + + void handle(DescriptionTouchedIntegrationEvent event); + + static DescriptionTouchedIntegrationEvent buildEventFromPersistModel(DescriptionPersist persist) { + DescriptionTouchedIntegrationEvent event = new DescriptionTouchedIntegrationEvent(); + event.setId(persist.getId()); + event.setLabel(persist.getLabel()); + event.setDmpId(persist.getDmpId()); + event.setDmpDescriptionTemplateId(persist.getDmpDescriptionTemplateId()); + event.setDescriptionTemplateId(persist.getDescriptionTemplateId()); + event.setStatus(persist.getStatus()); + event.setDescription(persist.getDescription()); + event.setProperties(persist.getProperties()); + event.setTags(persist.getTags()); + return event; + } + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandlerImpl.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandlerImpl.java new file mode 100644 index 000000000..34e206558 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/descriptiontouched/DescriptionTouchedIntegrationEventHandlerImpl.java @@ -0,0 +1,34 @@ +package eu.eudat.integrationevent.outbox.descriptiontouched; + +import eu.eudat.integrationevent.outbox.OutboxIntegrationEvent; +import eu.eudat.integrationevent.outbox.OutboxService; +import gr.cite.tools.logging.LoggerService; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import java.util.UUID; + +@Component +@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class DescriptionTouchedIntegrationEventHandlerImpl implements DescriptionTouchedIntegrationEventHandler { + + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DescriptionTouchedIntegrationEventHandlerImpl.class)); + + private final OutboxService outboxService; + + public DescriptionTouchedIntegrationEventHandlerImpl(OutboxService outboxService) { + this.outboxService = outboxService; + } + + @Override + public void handle(DescriptionTouchedIntegrationEvent event) { + OutboxIntegrationEvent message = new OutboxIntegrationEvent(); + message.setMessageId(UUID.randomUUID()); + message.setType(OutboxIntegrationEvent.DESCRIPTION_TOUCH); + message.setEvent(event); + this.outboxService.publish(message); + } + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEvent.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEvent.java new file mode 100644 index 000000000..d33c07df6 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEvent.java @@ -0,0 +1,116 @@ +package eu.eudat.integrationevent.outbox.dmptouched; + +import eu.eudat.commons.enums.DmpAccessType; +import eu.eudat.commons.enums.DmpStatus; +import eu.eudat.integrationevent.TrackedEvent; +import eu.eudat.model.persist.DmpDescriptionTemplatePersist; +import eu.eudat.model.persist.dmpproperties.DmpBlueprintValuePersist; +import eu.eudat.model.persist.dmpproperties.DmpContactPersist; + +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class DmpTouchedIntegrationEvent extends TrackedEvent { + + private UUID id; + + private String label; + + private DmpStatus status; + + private List contacts; + + private Map dmpBlueprintValues; + + private String description; + + private String language; + + private UUID blueprint; + + private DmpAccessType accessType; + + private List descriptionTemplates; + + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public DmpStatus getStatus() { + return status; + } + + public void setStatus(DmpStatus status) { + this.status = status; + } + + public List getContacts() { + return contacts; + } + + public void setContacts(List contacts) { + this.contacts = contacts; + } + + public Map getDmpBlueprintValues() { + return dmpBlueprintValues; + } + + public void setDmpBlueprintValues(Map dmpBlueprintValues) { + this.dmpBlueprintValues = dmpBlueprintValues; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public UUID getBlueprint() { + return blueprint; + } + + public void setBlueprint(UUID blueprint) { + this.blueprint = blueprint; + } + + public DmpAccessType getAccessType() { + return accessType; + } + + public void setAccessType(DmpAccessType accessType) { + this.accessType = accessType; + } + + public List getDescriptionTemplates() { + return descriptionTemplates; + } + + public void setDescriptionTemplates(List descriptionTemplates) { + this.descriptionTemplates = descriptionTemplates; + } + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandler.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandler.java new file mode 100644 index 000000000..4c70fb8f9 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandler.java @@ -0,0 +1,24 @@ +package eu.eudat.integrationevent.outbox.dmptouched; + +import eu.eudat.model.persist.DmpPersist; + +public interface DmpTouchedIntegrationEventHandler { + + void handle(DmpTouchedIntegrationEvent event); + + static DmpTouchedIntegrationEvent buildEventFromPersistModel(DmpPersist persist) { + DmpTouchedIntegrationEvent event = new DmpTouchedIntegrationEvent(); + event.setId(persist.getId()); + event.setLabel(persist.getLabel()); + event.setStatus(persist.getStatus()); + event.setContacts(persist.getProperties().getContacts()); + event.setDmpBlueprintValues(persist.getProperties().getDmpBlueprintValues()); + event.setDescription(persist.getDescription()); + event.setLanguage(persist.getLanguage()); + event.setBlueprint(persist.getBlueprint()); + event.setAccessType(persist.getAccessType()); + event.setDescriptionTemplates(persist.getDescriptionTemplates()); + return event; + } + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandlerImpl.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandlerImpl.java new file mode 100644 index 000000000..5d45a42e0 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/dmptouched/DmpTouchedIntegrationEventHandlerImpl.java @@ -0,0 +1,35 @@ +package eu.eudat.integrationevent.outbox.dmptouched; + +import eu.eudat.integrationevent.outbox.OutboxIntegrationEvent; +import eu.eudat.integrationevent.outbox.OutboxService; +import eu.eudat.integrationevent.outbox.tenantremoval.TenantRemovalIntegrationEventHandlerImpl; +import gr.cite.tools.logging.LoggerService; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import java.util.UUID; + +@Component +@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class DmpTouchedIntegrationEventHandlerImpl implements DmpTouchedIntegrationEventHandler { + + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpTouchedIntegrationEventHandlerImpl.class)); + + private final OutboxService outboxService; + + public DmpTouchedIntegrationEventHandlerImpl(OutboxService outboxService) { + this.outboxService = outboxService; + } + + @Override + public void handle(DmpTouchedIntegrationEvent event) { + OutboxIntegrationEvent message = new OutboxIntegrationEvent(); + message.setMessageId(UUID.randomUUID()); + message.setType(OutboxIntegrationEvent.DMP_TOUCH); + message.setEvent(event); + this.outboxService.publish(message); + } + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ReferenceTypeDataBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ReferenceTypeDataBuilder.java index b84a8826f..0eec04a00 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ReferenceTypeDataBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ReferenceTypeDataBuilder.java @@ -2,7 +2,13 @@ package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata; import eu.eudat.commons.types.descriptiontemplate.fielddata.ReferenceTypeDataEntity; import eu.eudat.convention.ConventionService; +import eu.eudat.model.builder.ReferenceTypeBuilder; +import eu.eudat.model.builder.dmpblueprintdefinition.ReferenceFieldBuilder; import eu.eudat.model.descriptiontemplatedefinition.fielddata.ReferenceTypeData; +import eu.eudat.model.dmpblueprintdefinition.ReferenceTypeField; +import eu.eudat.query.ReferenceTypeQuery; +import gr.cite.tools.data.builder.BuilderFactory; +import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.LoggerService; import org.slf4j.LoggerFactory; @@ -15,9 +21,14 @@ import org.springframework.stereotype.Component; @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class ReferenceTypeDataBuilder extends BaseFieldDataBuilder { + private final QueryFactory queryFactory; + private final BuilderFactory builderFactory; + @Autowired - public ReferenceTypeDataBuilder(ConventionService conventionService) { + public ReferenceTypeDataBuilder(ConventionService conventionService, QueryFactory queryFactory, BuilderFactory builderFactory) { super(conventionService, new LoggerService(LoggerFactory.getLogger(ReferenceTypeDataBuilder.class))); + this.queryFactory = queryFactory; + this.builderFactory = builderFactory; } protected ReferenceTypeData getInstance() { @@ -26,6 +37,8 @@ public class ReferenceTypeDataBuilder extends BaseFieldDataBuilder(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.options), nameof(x => x.value)].join('.'), [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.multipleSelect)].join('.'), [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.type)].join('.'), - [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.referenceTypeId)].join('.'), + [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.referenceType), nameof(x => x.id)].join('.'), + [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.referenceType), nameof(x => x.name)].join('.'), [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.maxFileSizeInMB)].join('.'), [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.types), nameof(x => x.label)].join('.'), [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.types), nameof(x => x.value)].join('.'), diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts index 7b8fed036..c183330c7 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts @@ -225,6 +225,7 @@ export class DescriptionPropertyDefinitionEditorModel implements DescriptionProp textListValue: undefined, dateValue: undefined, externalIdentifier: undefined, + references: undefined }); }) fieldSetValue.items = [{ @@ -429,8 +430,8 @@ export class DescriptionFieldEditorModel implements DescriptionFieldPersist { this.textListValue = item.textListValue; this.dateValue = item.dateValue; //TODO: refactor reference type - //this.references = descriptionReferences?.filter(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active).map(x => x.reference); - //this.reference = descriptionReferences?.find(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active)?.reference; + // this.references = descriptionReferences?.filter(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active).map(x => x.reference); + // this.reference = descriptionReferences?.find(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active)?.reference; this.externalIdentifier = new DescriptionExternalIdentifierEditorModel(this.validationErrorModel).fromModel(item.externalIdentifier); } return this; diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.resolver.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.resolver.ts index 889484c29..44cc72f24 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.resolver.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.resolver.ts @@ -1,9 +1,10 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; -import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateExternalDatasetData, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData, DescriptionTemplateSelectOption, DescriptionTemplateUploadData, DescriptionTemplateUploadOption } from '@app/core/model/description-template/description-template'; +import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateExternalDatasetData, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateReferenceTypeData, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData, DescriptionTemplateSelectOption, DescriptionTemplateUploadData, DescriptionTemplateUploadOption } from '@app/core/model/description-template/description-template'; import { Description, DescriptionExternalIdentifier, DescriptionField, DescriptionPropertyDefinition, DescriptionPropertyDefinitionFieldSet, DescriptionPropertyDefinitionFieldSetItem, DescriptionReference, DescriptionTag } from '@app/core/model/description/description'; import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp'; +import { ReferenceType } from '@app/core/model/reference-type/reference-type'; import { Reference } from '@app/core/model/reference/reference'; import { Tag } from '@app/core/model/tag/tag'; import { DescriptionService } from '@app/core/services/description/description.service'; @@ -101,7 +102,8 @@ export class DescriptionEditorResolver extends BaseEditorResolver { (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.type)].join('.'), (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.maxFileSizeInMB)].join('.'), (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.types), nameof(x => x.label)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.types), nameof(x => x.value)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.referenceType), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.pages), nameof(x => x.sections), nameof(x => x.fieldSets), nameof(x => x.fields), nameof(x => x.data), nameof(x => x.referenceType), nameof(x => x.name)].join('.'), ] } diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html index 9fe802bb2..a937c1542 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html @@ -16,12 +16,12 @@
- + +
diff --git a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html index b3a3c3328..f82199b98 100644 --- a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html +++ b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html @@ -6,6 +6,14 @@ {{'GENERAL.VALIDATION.REQUIRED' | translate}} {{hint}} + + {{label ?? referenceType?.name}} + + + {{form.getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{hint}} +
{{'REFERENCE-FIELD.COULD-NOT-FIND-MESSAGE' | translate}} {{'REFERENCE-FIELD.ACTIONS.INSERT-MANUALLY' | translate}} diff --git a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts index 393c2dbc4..b8448ccc6 100644 --- a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts +++ b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts @@ -4,6 +4,7 @@ import { ReferenceType } from '@app/core/model/reference-type/reference-type'; import { ReferenceService } from '@app/core/services/reference/reference.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; +import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; import { BaseComponent } from '@common/base/base.component'; @Component({ @@ -22,6 +23,7 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit { @Input() placeholder: string; multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration; + singleAutoCompleteSearchConfiguration: SingleAutoCompleteConfiguration; constructor( private referenceService: ReferenceService, @@ -29,7 +31,11 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit { ) { super(); } ngOnInit() { - this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id); + if (this.multiple) { + this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id); + } else { + this.singleAutoCompleteSearchConfiguration = this.referenceService.getSingleAutocompleteSearchConfiguration(this.referenceType.id); + } } addReference() {