diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpBlueprintValuePersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpBlueprintValuePersist.java index 734dcd426..70793d157 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpBlueprintValuePersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpBlueprintValuePersist.java @@ -80,11 +80,11 @@ public class DmpBlueprintValuePersist { // .iff(() -> this.isNull(item.getReferences()) || item.getReferences().isEmpty()) // .must(() -> !this.isEmpty(item.getFieldValue())) // .failOn(DmpBlueprintValuePersist._fieldValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpBlueprintValuePersist._fieldValue}, LocaleContextHolder.getLocale())), - this.navSpec() - .iff(() -> !this.isListNullOrEmpty(item.getReferences())) - .on(DmpBlueprintValuePersist._references) - .over(item.getReferences()) - .using((itm) -> this.validatorFactory.validator(ReferencePersist.ReferencePersistValidator.class)) + this.navSpec() + .iff(() -> !this.isListNullOrEmpty(item.getReferences())) + .on(DmpBlueprintValuePersist._references) + .over(item.getReferences()) + .using((itm) -> this.validatorFactory.validator(ReferencePersist.ReferencePersistValidator.class)) ); } } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpPropertiesPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpPropertiesPersist.java index 81e7ffe36..af466b46d 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpPropertiesPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/dmpproperties/DmpPropertiesPersist.java @@ -70,13 +70,13 @@ public class DmpPropertiesPersist { protected List specifications(DmpPropertiesPersist item) { return Arrays.asList( this.mapSpec() - .iff(() ->!this.isNull(item.getDmpBlueprintValues())) + .iff(() ->this.status == DmpStatus.Finalized && !this.isNull(item.getDmpBlueprintValues())) .on(DmpPropertiesPersist._dmpBlueprintValues) .over(item.getDmpBlueprintValues()) .mapKey((k) -> ((UUID)k).toString()) .using((itm) -> this.validatorFactory.validator(DmpBlueprintValuePersist.DmpBlueprintValuePersistValidator.class)), this.navSpec() - .iff(() -> !this.isListNullOrEmpty(item.getContacts())) + .iff(() -> this.status == DmpStatus.Finalized && !this.isListNullOrEmpty(item.getContacts())) .on(DmpPropertiesPersist._contacts) .over(item.getContacts()) .using((itm) -> this.validatorFactory.validator(DmpContactPersist.DmpContactPersistValidator.class)) diff --git a/dmp-frontend/src/app/core/services/dmp/dmp-blueprint.service.ts b/dmp-frontend/src/app/core/services/dmp/dmp-blueprint.service.ts index eb788298a..2f741c8ed 100644 --- a/dmp-frontend/src/app/core/services/dmp/dmp-blueprint.service.ts +++ b/dmp-frontend/src/app/core/services/dmp/dmp-blueprint.service.ts @@ -15,6 +15,7 @@ import { catchError, map } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { ConfigurationService } from '../configuration/configuration.service'; import { BaseHttpV2Service } from '../http/base-http-v2.service'; +import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status'; @Injectable() export class DmpBlueprintService { @@ -109,12 +110,13 @@ export class DmpBlueprintService { valueAssign: (item: DmpBlueprint) => item.id, }; - private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DmpBlueprintLookup { + public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: DmpBlueprintStatus[]): DmpBlueprintLookup { const lookup: DmpBlueprintLookup = new DmpBlueprintLookup(); lookup.page = { size: 100, offset: 0 }; if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (ids && ids.length > 0) { lookup.ids = ids; } lookup.isActive = [IsActive.Active]; + lookup.statuses = statuses; lookup.project = { fields: [ nameof(x => x.id), 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 a0795c9c5..66c02efe5 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 @@ -55,7 +55,7 @@
{{'DMP-EDITOR.FIELDS.BLUEPRINT' | translate}} *
{{'DMP-EDITOR.FIELDS.BLUEPRINT' | translate}} - + @@ -132,7 +132,8 @@
-
{{i + 1}}.{{j + 1}} {{field.label}}*
+
{{i + 1}}.{{j + 1}} {{enumUtils.toDmpBlueprintSystemFieldTypeString(field.systemFieldType)}}*
+
{{i + 1}}.{{j + 1}} {{field.label}}*
{{field.description}}
@@ -274,7 +275,9 @@
{{field.label}} - + + + {{formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('fieldValue').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | 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 eb97ea6db..80c327600 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 @@ -46,6 +46,8 @@ import { UserService } from '@app/core/services/user/user.service'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { DmpContactType } from '@app/core/common/enum/dmp-contact-type'; import { MatButtonToggleChange } from '@angular/material/button-toggle'; +import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; +import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status'; @Component({ selector: 'app-dmp-editor', @@ -70,6 +72,14 @@ export class DmpEditorComponent extends BaseEditor implemen dmpAccessTypeEnumValues = this.enumUtils.getEnumValues(DmpAccessType); dmpContactTypeEnum = DmpContactType; dmpContactTypeEnumValues = this.enumUtils.getEnumValues(DmpContactType); + singleAutocompleteBlueprintConfiguration: SingleAutoCompleteConfiguration = { + initialItems: (data?: any) => this.dmpBlueprintService.query(this.dmpBlueprintService.buildAutocompleteLookup(null, null, null, [DmpBlueprintStatus.Finalized])).pipe(map(x => x.items)), + filterFn: (searchQuery: string, data?: any) => this.dmpBlueprintService.query(this.dmpBlueprintService.buildAutocompleteLookup(searchQuery, null, null, [DmpBlueprintStatus.Finalized])).pipe(map(x => x.items)), + getSelectedItem: (selectedItem: any) => this.dmpBlueprintService.query(this.dmpBlueprintService.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), + displayFn: (item: DmpBlueprint) => item.label, + titleFn: (item: DmpBlueprint) => item.label, + valueAssign: (item: DmpBlueprint) => item.id, + }; protected get canDelete(): boolean { return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteDmp); @@ -111,7 +121,7 @@ export class DmpEditorComponent extends BaseEditor implemen private configurationService: ConfigurationService, // public visibilityRulesService: VisibilityRulesService, private languageInfoService: LanguageInfoService, - private enumUtils: EnumUtils, + public enumUtils: EnumUtils, public descriptionTemplateService: DescriptionTemplateService, public userService: UserService 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 9b0380701..e7cfc285f 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 @@ -5,7 +5,6 @@ {{form.getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} -{{form.errors | json}}
{{'REFERENCE-FIELD.COULD-NOT-FIND-MESSAGE' | translate}} {{'REFERENCE-FIELD.ACTIONS.INSERT-MANUALLY' | translate}} diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index aedabc17e..d3dedccf5 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -2245,8 +2245,7 @@ "ORGANIZATIONS": "Organizations", "DATASET-IDENTIFIER": "Dataset Identifier", "CURRENCY": "Currency", - "VALIDATION": "Validator", - "SELECT": "Select" + "VALIDATION": "Validator" }, "DATASET-PROFILE-UPLOAD-TYPE": { "DOWNLOAD": "Download file" diff --git a/dmp-frontend/src/common/base/base-editor.ts b/dmp-frontend/src/common/base/base-editor.ts index 63f728f3a..67dd9e0f3 100644 --- a/dmp-frontend/src/common/base/base-editor.ts +++ b/dmp-frontend/src/common/base/base-editor.ts @@ -108,6 +108,9 @@ export abstract class BaseEditor