diff --git a/dmp-frontend/src/app/core/model/description-template/description-template-persist.ts b/dmp-frontend/src/app/core/model/description-template/description-template-persist.ts index 389240caf..4903f93bd 100644 --- a/dmp-frontend/src/app/core/model/description-template/description-template-persist.ts +++ b/dmp-frontend/src/app/core/model/description-template/description-template-persist.ts @@ -110,6 +110,7 @@ export interface DescriptionTemplateBaseFieldDataPersist { export interface DescriptionTemplateReferenceTypeFieldPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist { referenceTypeId: Guid; + name: string; } export interface DescriptionTemplateExternalDatasetDataPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist { diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.ts index 48c9ca9bb..c95f85f12 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.ts @@ -238,7 +238,8 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon if (editorField.data.fieldType === DescriptionTemplateFieldType.REFERENCE_TYPES) { convertedField.data = editorField.data; (convertedField.data as DescriptionTemplateReferenceTypeData).referenceType = { - id: (editorField.data as DescriptionTemplateReferenceTypeFieldPersist).referenceTypeId + id: (editorField.data as DescriptionTemplateReferenceTypeFieldPersist).referenceTypeId, + name: (editorField.data as DescriptionTemplateReferenceTypeFieldPersist).name, }; } else { convertedField.data = editorField.data; diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.model.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.model.ts index 4d27509ce..2358af96e 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.model.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.model.ts @@ -1246,6 +1246,7 @@ export class DescriptionTemplateExternalDatasetDataEditorModel extends Descripti // export class DescriptionTemplateReferenceTypeDataEditorModel extends DescriptionTemplateLabelAndMultiplicityDataEditorModel implements DescriptionTemplateReferenceTypeFieldPersist { referenceTypeId: Guid; + name: string; protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); constructor( @@ -1255,6 +1256,7 @@ export class DescriptionTemplateReferenceTypeDataEditorModel extends Description fromModel(item: DescriptionTemplateReferenceTypeData): DescriptionTemplateReferenceTypeDataEditorModel { if (item) { super.fromModel(item); + this.name = item.referenceType?.name; this.referenceTypeId = item.referenceType?.id; } return this; @@ -1275,6 +1277,7 @@ export class DescriptionTemplateReferenceTypeDataEditorModel extends Description const formGroup = super.buildForm({ context, disabled, rootPath }); formGroup.setControl('referenceTypeId', new FormControl({ value: this.referenceTypeId, disabled: disabled }, context.getValidation('referenceTypeId').validators)); + formGroup.setControl('name', new FormControl({ value: this.name, disabled: disabled })); return formGroup; } 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 5979af77b..fff2af37c 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 @@ -129,13 +129,12 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit, On } addReference() { - const dialogRef = this.dialog.open(ReferenceDialogEditorComponent, { minWidth: '49%', restoreFocus: false, data: { referenceTypeId: this.referenceType.id, - label: this.label ?? this.referenceType.name, + label: this.label && this.label !== '' ? this.label : this.referenceType.name, }, }); dialogRef.afterClosed()