From 30902bbab8923518958b081e70f7323ac13b8677 Mon Sep 17 00:00:00 2001 From: Diamantis Tziotzios Date: Thu, 1 Feb 2024 11:36:55 +0200 Subject: [PATCH] ui fixes --- .../description-template-editor.model.ts | 16 ++++----- .../dmp-editor.component.html | 34 +++++++++---------- .../dmp-editor-blueprint/dmp-editor.model.ts | 6 ++-- 3 files changed, 27 insertions(+), 29 deletions(-) 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 c6f83fb9d..9bd066fdb 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 @@ -340,7 +340,7 @@ export class DescriptionTemplatePageEditorModel implements DescriptionTemplatePa rootPath: string }): void { const { validationErrorModel, rootPath, formArray } = params; - + } static reapplyValidators(params: { @@ -1019,7 +1019,7 @@ export class DescriptionTemplateLabelDataEditorModel implements DescriptionTempl } export class DescriptionTemplateLabelAndMultiplicityDataEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateLabelAndMultiplicityDataPersist { - multipleSelect: boolean; + multipleSelect: boolean = false; protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); constructor( @@ -1029,7 +1029,7 @@ export class DescriptionTemplateLabelAndMultiplicityDataEditorModel extends Desc fromModel(item: DescriptionTemplateLabelAndMultiplicityDataPersist): DescriptionTemplateLabelAndMultiplicityDataEditorModel { if (item) { super.fromModel(item); - this.multipleSelect = item.multipleSelect; + this.multipleSelect = item.multipleSelect ?? false; } return this; } @@ -1158,7 +1158,7 @@ export class DescriptionTemplateExternalDatasetDataEditorModel extends Descripti // // export class DescriptionTemplateExternalSelectDataEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateExternalSelectDataPersist { - multipleSelect: boolean; + multipleSelect: boolean = false; sources: DescriptionTemplateExternalSelectSourceEditorModel[] = []; protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); @@ -1169,7 +1169,7 @@ export class DescriptionTemplateExternalSelectDataEditorModel extends Descriptio fromModel(item: DescriptionTemplateExternalSelectDataPersist): DescriptionTemplateExternalSelectDataEditorModel { if (item) { super.fromModel(item); - this.multipleSelect = item.multipleSelect; + this.multipleSelect = item.multipleSelect ?? false; if (item.sources) { item.sources.map(x => this.sources.push(new DescriptionTemplateExternalSelectSourceEditorModel(this.validationErrorModel).fromModel(x))); } } return this; @@ -1655,7 +1655,7 @@ export class DescriptionTemplateRadioBoxOptionEditorModel implements Description // export class DescriptionTemplateSelectDataEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateSelectDataPersist { options: DescriptionTemplateSelectOptionEditorModel[] = []; - multipleSelect: boolean; + multipleSelect: boolean = false; protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); constructor( @@ -1665,7 +1665,7 @@ export class DescriptionTemplateSelectDataEditorModel extends DescriptionTemplat fromModel(item: DescriptionTemplateSelectDataPersist): DescriptionTemplateSelectDataEditorModel { if (item) { super.fromModel(item); - this.multipleSelect = item.multipleSelect; + this.multipleSelect = item.multipleSelect ?? false; if (item.options) { item.options.map(x => this.options.push(new DescriptionTemplateSelectOptionEditorModel(this.validationErrorModel).fromModel(x))); } } return this; @@ -1950,4 +1950,4 @@ export class DescriptionTemplateUploadOptionEditorModel implements DescriptionTe control?.addValidators(context.getValidation(keyField).validators); }) } -} \ No newline at end of file +} 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 66c02efe5..c7cfb2414 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 @@ -139,7 +139,7 @@
- + {{formGroup.get('label').getError('backendError').message}} @@ -295,22 +295,22 @@
-
- {{formGroup.get('descriptionTemplates').get(section.id).value | json}} -
-
-
-
{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}
- - {{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}} - - - {{formGroup.get('descriptionTemplates').get(section.id).getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
- {{'DMP-EDITOR.NO-TEMPLATE-MESSAGE' | translate}} -
+
+
+ {{formGroup.get('descriptionTemplates').get(section.id).value | json}} +
+
+
+
{{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}
+ + {{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}} + + + {{formGroup.get('descriptionTemplates').get(section.id).getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+ {{'DMP-EDITOR.NO-TEMPLATE-MESSAGE' | translate}}
diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.model.ts b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.model.ts index 91fcdca55..e50816b13 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.model.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.model.ts @@ -193,9 +193,7 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist { const formGroup = this.formBuilder.group({ contacts: this.formBuilder.array( (this.contacts ?? []).map( - (item, index) => new DmpContactEditorModel( - this.validationErrorModel - ).fromModel(item).buildForm({ + (item, index) => item.buildForm({ rootPath: `${rootPath}contacts[${index}].` }) ), context.getValidation('contacts').validators @@ -350,7 +348,7 @@ export class DmpContactEditorModel implements DmpContactPersist { this.firstName = item.firstName; this.lastName = item.lastName; this.email = item.email; - this.contactType = item == null ? DmpContactType.Internal : (this.userId != null ? DmpContactType.Internal : DmpContactType.External); + this.contactType = (item == null || this.userId != null) ? DmpContactType.Internal : DmpContactType.External; return this; }