diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java index 50eb68608..a7806427c 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java @@ -47,7 +47,7 @@ import java.util.List; @JsonSubTypes.Type(value = SelectDataPersist.class, name = FieldType.Names.Select), @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.DataRepositories), @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.JournalRepositories), - @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.Publications), + @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.PubRepositories), }) public abstract class BaseFieldDataPersist { diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/ExternalSelectDataPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/ExternalSelectDataPersist.java index 79e4ded5c..a469fdc44 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/ExternalSelectDataPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/ExternalSelectDataPersist.java @@ -163,13 +163,17 @@ public class ExternalSelectDataPersist extends BaseFieldDataPersist { this.spec() .must(() -> !this.isNull(item.getUrl())) .failOn(ExternalSelectSourcePersist._url).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalSelectSourcePersist._url}, LocaleContextHolder.getLocale())), + this.spec() + .iff(() -> !this.isNull(item.getHasAuth()) && item.getHasAuth()) + .must(() -> !this.isNull(item.getAuth())) + .failOn(ExternalSelectSourcePersist._auth).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalSelectSourcePersist._auth}, LocaleContextHolder.getLocale())), this.refSpec() .iff(() -> !this.isNull(item.getSourceBinding())) .on(ExternalSelectSourcePersist._sourceBinding) .over(item.getSourceBinding()) .using(() -> this.validatorFactory.validator(ExternalSelectSourceBindingPersist.ExternalSelectSourceBindingPersistValidator.class)), this.refSpec() - .iff(() -> !this.isNull(item.getAuth())) + .iff(() -> !this.isNull(item.getHasAuth()) && item.getHasAuth() && !this.isNull(item.getAuth())) .on(ExternalSelectSourcePersist._auth) .over(item.getAuth()) .using(() -> this.validatorFactory.validator(ExternalSelectAuthDataPersist.ExternalSelectAuthDataPersistValidator.class)) diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/UploadDataPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/UploadDataPersist.java index 93a991cb6..a4b003bac 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/UploadDataPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/descriptiontemplatedefinition/fielddata/UploadDataPersist.java @@ -62,11 +62,6 @@ public class UploadDataPersist extends BaseFieldDataPersist { protected List specifications(UploadDataPersist item) { List specifications = getBaseSpecifications(item); specifications.addAll(Arrays.asList( - this.spec() - .iff(() -> !this.isNull(item.getMaxFileSizeInMB())) - .must(() -> !this.lessEqual(item.getMaxFileSizeInMB(), Integer.MAX_VALUE)) - .failOn(UploadDataPersist._maxFileSizeInMB).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{UploadDataPersist._types}, LocaleContextHolder.getLocale())), - this.spec() .must(() -> !this.isNull(item.getTypes())) .failOn(UploadDataPersist._types).failWith(messageSource.getMessage("Validation_Required", new Object[]{UploadDataPersist._types}, LocaleContextHolder.getLocale())), diff --git a/dmp-frontend/src/app/core/common/enum/description-template-external-select-auth-type.ts b/dmp-frontend/src/app/core/common/enum/description-template-external-select-auth-type.ts new file mode 100644 index 000000000..47de756f5 --- /dev/null +++ b/dmp-frontend/src/app/core/common/enum/description-template-external-select-auth-type.ts @@ -0,0 +1,3 @@ +export enum DescriptionTemplateExternalSelectAuthType { + BEARER = 'Bearer' +} diff --git a/dmp-frontend/src/app/core/common/enum/description-template-external-select-http-method-type.ts b/dmp-frontend/src/app/core/common/enum/description-template-external-select-http-method-type.ts new file mode 100644 index 000000000..96f1a9710 --- /dev/null +++ b/dmp-frontend/src/app/core/common/enum/description-template-external-select-http-method-type.ts @@ -0,0 +1,4 @@ +export enum DescriptionTemplateExternalSelectHttpMethodType { + GET = 'GET', + POST = 'POST' +} \ No newline at end of file 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 9461057c5..b9b31b98e 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 @@ -116,6 +116,7 @@ export interface DescriptionTemplateSelectDataPersist extends DescriptionTemplat export interface DescriptionTemplateUploadDataPersist extends DescriptionTemplateBaseFieldDataPersist { types: DescriptionTemplateUploadOptionPersist[]; + maxFileSizeInMB: number; } // diff --git a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts index 7d0e34402..1d387904b 100644 --- a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts +++ b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; import { DescriptionStatus } from '@app/core/common/enum/description-status'; +import { DescriptionTemplateExternalSelectHttpMethodType } from '@app/core/common/enum/description-template-external-select-http-method-type'; import { DescriptionTemplateFieldDataExternalDatasetType } from '@app/core/common/enum/description-template-field-data-external-dataset-type'; import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type'; import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status'; @@ -35,6 +36,7 @@ import { DmpBlueprintExtraFieldDataType } from '../../common/enum/dmp-blueprint- import { DmpBlueprintType } from '../../common/enum/dmp-blueprint-type'; import { DmpStatus } from '../../common/enum/dmp-status'; import { ValidationType } from '../../common/enum/validation-type'; +import { DescriptionTemplateExternalSelectAuthType } from '@app/core/common/enum/description-template-external-select-auth-type'; @Injectable() export class EnumUtils { @@ -400,4 +402,17 @@ export class EnumUtils { case DmpContactType.External: return this.language.instant('TYPES.DMP-CONTACT-TYPE.EXTERNAL'); } } + + public toDescriptionTemplateExternalSelectHttpMethodTypeString(value: DescriptionTemplateExternalSelectHttpMethodType): string { + switch (value) { + case DescriptionTemplateExternalSelectHttpMethodType.GET: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-EXTERNAL-SELECT-HTTP-METHOD-TYPE.GET'); + case DescriptionTemplateExternalSelectHttpMethodType.POST: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-EXTERNAL-SELECT-HTTP-METHOD-TYPE.POST'); + } + } + + public toDescriptionTemplateExternalSelectAuthTypeString(value: DescriptionTemplateExternalSelectAuthType): string { + switch (value) { + case DescriptionTemplateExternalSelectAuthType.BEARER: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-EXTERNAL-SELECT-AUTH-TYPE.BEARER'); + } + } } diff --git a/dmp-frontend/src/app/ui/admin/description-template/description-template.module.ts b/dmp-frontend/src/app/ui/admin/description-template/description-template.module.ts index e2946275d..40a4ee124 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/description-template.module.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/description-template.module.ts @@ -13,10 +13,13 @@ import { NgxDropzoneModule } from "ngx-dropzone"; import { DescriptionTemplateRoutingModule } from './description-template.routing'; import { DescriptionTemplateEditorCompositeFieldComponent } from './editor/components/composite-field/description-template-editor-composite-field.component'; import { DescriptionTemplateEditorDefaultValueComponent } from './editor/components/default-value/description-template-editor-default-value.component'; -import { DescriptionTemplateEditorAutoCompleteFieldComponent } from './editor/components/field-type/auto-complete/description-template-editor-auto-complete-field.component'; -import { DescriptionTemplateEditorMultiplicityFieldComponent } from './editor/components/field-type/multiplicity-field/description-template-editor-multiplicity-field.component'; -import { DescriptionTemplateEditorPlaceholderFieldComponent } from './editor/components/field-type/placeholder-field/description-template-editor-placeholder-field.component'; +import { DescriptionTemplateEditorExternalDatasetsFieldComponent } from './editor/components/field-type/external-datasets/description-template-editor-external-datasets-field.component'; +import { DescriptionTemplateEditorExternalSelectFieldComponent } from './editor/components/field-type/external-select/description-template-editor-external-select-field.component'; +import { DescriptionTemplateEditorLabelAndMultiplicityFieldComponent } from './editor/components/field-type/label-and-multiplicity-field/description-template-editor-label-and-multiplicity-field.component'; +import { DescriptionTemplateEditorLabelFieldComponent } from './editor/components/field-type/label-field/description-template-editor-label-field.component'; +import { DescriptionTemplateEditorRadioBoxFieldComponent } from './editor/components/field-type/radio-box/description-template-editor-radio-box-field.component'; import { DescriptionTemplateEditorSelectFieldComponent } from './editor/components/field-type/select/description-template-editor-select-field.component'; +import { DescriptionTemplateEditorUploadFieldComponent } from './editor/components/field-type/upload/description-template-editor-upload-field.component'; import { DescriptionTemplateEditorFieldComponent } from './editor/components/field/description-template-editor-field.component'; import { DescriptionTemplateEditorSectionFieldSetComponent } from './editor/components/section-fieldset/description-template-editor-section-fieldset.component'; import { DescriptionTemplateEditorSectionComponent } from './editor/components/section/description-template-editor-section.component'; @@ -27,8 +30,6 @@ import { DescriptionTemplateTableOfContentsInternalSection } from './editor/tabl import { DescriptionTemplateListingComponent } from './listing/description-template-listing.component'; import { DescriptionTemplateListingFiltersComponent } from "./listing/filters/description-template-listing-filters.component"; import { ImportDescriptionTemplateDialogComponent } from './listing/import-description-template/import-description-template.dialog.component'; -import { DescriptionTemplateEditorRadioBoxFieldComponent } from './editor/components/field-type/radio-box/description-template-editor-radio-box-field.component'; -import { DescriptionTemplateEditorExternalDatasetsFieldComponent } from './editor/components/field-type/external-datasets/description-template-editor-external-datasets-field.component'; @NgModule({ imports: [ @@ -67,12 +68,13 @@ import { DescriptionTemplateEditorExternalDatasetsFieldComponent } from './edito DescriptionTemplateEditorDefaultValueComponent, DescriptionTemplateEditorRuleComponent, - DescriptionTemplateEditorAutoCompleteFieldComponent, + DescriptionTemplateEditorExternalSelectFieldComponent, DescriptionTemplateEditorSelectFieldComponent, - DescriptionTemplateEditorPlaceholderFieldComponent, - DescriptionTemplateEditorMultiplicityFieldComponent, + DescriptionTemplateEditorLabelFieldComponent, + DescriptionTemplateEditorLabelAndMultiplicityFieldComponent, DescriptionTemplateEditorRadioBoxFieldComponent, - DescriptionTemplateEditorExternalDatasetsFieldComponent + DescriptionTemplateEditorExternalDatasetsFieldComponent, + DescriptionTemplateEditorUploadFieldComponent ] }) export class DescriptionTemplateModule { } 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 16dbe047e..1350463c9 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 @@ -531,7 +531,6 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS: case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DATASETS: - case DescriptionTemplateFieldType.EXTERNAL_DATASETS: case DescriptionTemplateFieldType.DATA_REPOSITORIES: case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES: case DescriptionTemplateFieldType.PUB_REPOSITORIES: diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/auto-complete/description-template-editor-auto-complete-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/auto-complete/description-template-editor-auto-complete-field.component.ts deleted file mode 100644 index 399292193..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/auto-complete/description-template-editor-auto-complete-field.component.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { UntypedFormArray, UntypedFormGroup } from '@angular/forms'; -import { DescriptionTemplateExternalSelectDataEditorModel } from '../../../description-template-editor.model'; - -@Component({ - selector: 'app-description-template-editor-auto-complete-field-component', - styleUrls: ['./description-template-editor-auto-complete-field.component.scss'], - templateUrl: './description-template-editor-auto-complete-field.component.html' -}) -export class DescriptionTemplateEditorAutoCompleteFieldComponent implements OnInit { - - @Input() form: UntypedFormGroup; - multiForm: UntypedFormArray; - - ngOnInit() { - this.multiForm = (this.form.get('data').get('sources')); - } - - addSource() { - (this.multiForm).push(new DescriptionTemplateExternalSelectDataEditorModel().buildForm()); - } - - removeSource(index: number) { - (this.multiForm).removeAt(index); - } -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dataset-identifier/dataset-profile-editor-dataset-identifier-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dataset-identifier/dataset-profile-editor-dataset-identifier-field.component.html deleted file mode 100644 index 55d56dbcb..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dataset-identifier/dataset-profile-editor-dataset-identifier-field.component.html +++ /dev/null @@ -1,10 +0,0 @@ -
-
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATASET-IDENTIFIER-TITLE' - | translate}}
- - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATASET-IDENTIFIER-PLACEHOLDER' | translate}} - - {{form.get('data').get('label').getError('backendError').message}} - -
\ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dataset-identifier/dataset-profile-editor-dataset-identifier-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dataset-identifier/dataset-profile-editor-dataset-identifier-field.component.ts deleted file mode 100644 index d9ecf05e1..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dataset-identifier/dataset-profile-editor-dataset-identifier-field.component.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; -import { Router } from '@angular/router'; -import { DatasetIdentifierDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/dataset-identifier-data-editor-models'; - -@Component({ - selector: 'app-dataset-profile-editor-dataset-identifier-field-component', - styleUrls: ['./dataset-profile-editor-dataset-identifier-field.component.scss'], - templateUrl: './dataset-profile-editor-dataset-identifier-field.component.html' -}) -export class DatasetProfileEditorDatasetIdentifierFieldComponent implements OnInit { - - @Input() form: UntypedFormGroup; - private data: DatasetIdentifierDataEditorModel = new DatasetIdentifierDataEditorModel(); - - constructor(private router: Router) {} - - ngOnInit() { - if(this.router.url.includes('new')){ - this.form.patchValue({'rdaCommonStandard': 'dataset.dataset_id'}); - } - if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); } - } -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/datasets-auto-complete/dataset-profile-editor-datasets-autocomplete-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/datasets-auto-complete/dataset-profile-editor-datasets-autocomplete-field.component.html deleted file mode 100644 index db2accc21..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/datasets-auto-complete/dataset-profile-editor-datasets-autocomplete-field.component.html +++ /dev/null @@ -1,14 +0,0 @@ -
- -
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}
- - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} - - - - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATASETS-PLACEHOLDER' | translate}} - - {{form.get('data').get('label').getError('backendError').message}} - -
diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/datasets-auto-complete/dataset-profile-editor-datasets-autocomplete-field.component.scss b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/datasets-auto-complete/dataset-profile-editor-datasets-autocomplete-field.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/datasets-auto-complete/dataset-profile-editor-datasets-autocomplete-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/datasets-auto-complete/dataset-profile-editor-datasets-autocomplete-field.component.ts deleted file mode 100644 index ec9c22260..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/datasets-auto-complete/dataset-profile-editor-datasets-autocomplete-field.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { OnInit, Input, Component } from "@angular/core"; -import { UntypedFormGroup } from "@angular/forms"; -import { DatasetProfileInternalDmpEntitiesType } from "../../../../../../../core/common/enum/dataset-profile-internal-dmp-entities-type"; -import { DatasetsAutoCompleteFieldDataEditorModel } from "../../../../admin/field-data/datasets-autocomplete-field-data-editor-mode"; - -@Component({ - selector: 'app-dataset-profile-editor-datasets-autocomplete-field-component', - styleUrls: ['./dataset-profile-editor-datasets-autocomplete-field.component.scss'], - templateUrl: './dataset-profile-editor-datasets-autocomplete-field.component.html' -}) -export class DatasetProfileEditorDatasetsAutoCompleteFieldComponent implements OnInit { - - @Input() form: UntypedFormGroup; - private data: DatasetsAutoCompleteFieldDataEditorModel = new DatasetsAutoCompleteFieldDataEditorModel(); - - ngOnInit() { - this.data.type = DatasetProfileInternalDmpEntitiesType.Datasets; - } -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dmps-auto-complete/dataset-profile-editor-dmps-autocomplete-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dmps-auto-complete/dataset-profile-editor-dmps-autocomplete-field.component.html deleted file mode 100644 index ccea3f6a0..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dmps-auto-complete/dataset-profile-editor-dmps-autocomplete-field.component.html +++ /dev/null @@ -1,14 +0,0 @@ -
- -
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}
- - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} - - - - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DMPS-PLACEHOLDER' | translate}} - - {{form.get('data').get('label').getError('backendError').message}} - -
diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dmps-auto-complete/dataset-profile-editor-dmps-autocomplete-field.component.scss b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dmps-auto-complete/dataset-profile-editor-dmps-autocomplete-field.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dmps-auto-complete/dataset-profile-editor-dmps-autocomplete-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dmps-auto-complete/dataset-profile-editor-dmps-autocomplete-field.component.ts deleted file mode 100644 index a7ec9d4fb..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dmps-auto-complete/dataset-profile-editor-dmps-autocomplete-field.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { OnInit, Input, Component } from "@angular/core"; -import { UntypedFormGroup } from "@angular/forms"; -import { DatasetProfileInternalDmpEntitiesType } from "../../../../../../../core/common/enum/dataset-profile-internal-dmp-entities-type"; -import { DatasetsAutoCompleteFieldDataEditorModel } from "../../../../admin/field-data/datasets-autocomplete-field-data-editor-mode"; -import { DmpsAutoCompleteFieldDataEditorModel } from "../../../../admin/field-data/dmps-autocomplete-field-data-editor-model"; - -@Component({ - selector: 'app-dataset-profile-editor-dmps-autocomplete-field-component', - styleUrls: ['./dataset-profile-editor-dmps-autocomplete-field.component.scss'], - templateUrl: './dataset-profile-editor-dmps-autocomplete-field.component.html' -}) -export class DatasetProfileEditorDmpsAutoCompleteFieldComponent implements OnInit { - - @Input() form: UntypedFormGroup; - private data: DmpsAutoCompleteFieldDataEditorModel = new DatasetsAutoCompleteFieldDataEditorModel(); - - ngOnInit() { - this.data.type = DatasetProfileInternalDmpEntitiesType.Dmps; - } -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-datasets/description-template-editor-external-datasets-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-datasets/description-template-editor-external-datasets-field.component.html index 2d4f2bf0a..baf41e90c 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-datasets/description-template-editor-external-datasets-field.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-datasets/description-template-editor-external-datasets-field.component.html @@ -1,22 +1,26 @@
-
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-EXTERNAL-DATASETS-TITLE' +
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-EXTERNAL-DATASETS-TITLE' | translate}}
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} - - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-EXTERNAL-DATASETS-PLACEHOLDER' | translate}} - - {{form.get('data').get('label').getError('backendError').message}} - - -
+
+ + {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-EXTERNAL-DATASETS-PLACEHOLDER' | translate}} + + {{form.get('data').get('label').getError('backendError').message}} + +
+
+ + + {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.EXTERNAL-DATASET-TYPE-NAME' | translate}} + + + {{enumUtils.toDescriptionTemplateFieldDataExternalDatasetTypeString(type)}} + + {{form.get('data').get('type').getError('backendError').message}} + +
+ \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/auto-complete/description-template-editor-auto-complete-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-select/description-template-editor-external-select-field.component.html similarity index 92% rename from dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/auto-complete/description-template-editor-auto-complete-field.component.html rename to dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-select/description-template-editor-external-select-field.component.html index d6cbb123a..0a22a829d 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/auto-complete/description-template-editor-auto-complete-field.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-select/description-template-editor-external-select-field.component.html @@ -26,12 +26,12 @@ - -
+{{this.form.get('data').get('sources').value | json}} +
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-METHOD' | translate}} - {{method.value}} + {{enumUtils.toDescriptionTemplateExternalSelectHttpMethodTypeString(method)}} {{singleForm.get('method').getError('backendError').message}} @@ -70,7 +70,7 @@ {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-METHOD' | translate}} - {{method.value}} + {{enumUtils.toDescriptionTemplateExternalSelectHttpMethodTypeString(method)}} {{singleForm.get('auth').get('method').getError('backendError').message}} @@ -83,7 +83,7 @@ {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-TYPE' | translate}} - {{type.value}} + {{enumUtils.toDescriptionTemplateExternalSelectAuthTypeString(type)}} {{singleForm.get('auth').get('type').getError('backendError').message}} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/auto-complete/description-template-editor-auto-complete-field.component.scss b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-select/description-template-editor-external-select-field.component.scss similarity index 100% rename from dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/auto-complete/description-template-editor-auto-complete-field.component.scss rename to dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-select/description-template-editor-external-select-field.component.scss diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-select/description-template-editor-external-select-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-select/description-template-editor-external-select-field.component.ts new file mode 100644 index 000000000..c1d082200 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/external-select/description-template-editor-external-select-field.component.ts @@ -0,0 +1,33 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { UntypedFormArray, UntypedFormGroup } from '@angular/forms'; +import { DescriptionTemplateExternalSelectSourceEditorModel } from '../../../description-template-editor.model'; +import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { DescriptionTemplateExternalSelectHttpMethodType } from '@app/core/common/enum/description-template-external-select-http-method-type'; +import { DescriptionTemplateExternalSelectAuthType } from '@app/core/common/enum/description-template-external-select-auth-type'; + +@Component({ + selector: 'app-description-template-editor-external-select-field-component', + styleUrls: ['./description-template-editor-external-select-field.component.scss'], + templateUrl: './description-template-editor-external-select-field.component.html' +}) +export class DescriptionTemplateEditorExternalSelectFieldComponent implements OnInit { + + @Input() form: UntypedFormGroup; + methodTypeValues = this.enumUtils.getEnumValues(DescriptionTemplateExternalSelectHttpMethodType); + authTypeValues = this.enumUtils.getEnumValues(DescriptionTemplateExternalSelectAuthType); + + constructor ( + public enumUtils: EnumUtils + ) {} + + ngOnInit() { + } + + addSource() { + (this.form.get('data').get('sources')).push(new DescriptionTemplateExternalSelectSourceEditorModel().buildForm()); + } + + removeSource(index: number) { + (this.form.get('data').get('sources')).removeAt(index); + } +} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/internal-dmp-entities/dataset-profile-editor-internal-dmp-entities-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/internal-dmp-entities/dataset-profile-editor-internal-dmp-entities-field.component.html deleted file mode 100644 index 26d4cff98..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/internal-dmp-entities/dataset-profile-editor-internal-dmp-entities-field.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
- - - {{enumUtils.toDatasetProfileInternalDmpEntitiesTypeString(options.Researchers)}} - {{enumUtils.toDatasetProfileInternalDmpEntitiesTypeString(options.Datasets)}} - {{enumUtils.toDatasetProfileInternalDmpEntitiesTypeString(options.Dmps)}} - - - - - -
diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/internal-dmp-entities/dataset-profile-editor-internal-dmp-entities-field.component.scss b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/internal-dmp-entities/dataset-profile-editor-internal-dmp-entities-field.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/internal-dmp-entities/dataset-profile-editor-internal-dmp-entities-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/internal-dmp-entities/dataset-profile-editor-internal-dmp-entities-field.component.ts deleted file mode 100644 index 63c74dd1e..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/internal-dmp-entities/dataset-profile-editor-internal-dmp-entities-field.component.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; -import { DatasetProfileInternalDmpEntitiesType } from '@app/core/common/enum/dataset-profile-internal-dmp-entities-type'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; -import { DatasetsAutoCompleteFieldDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/datasets-autocomplete-field-data-editor-mode'; -import { DmpsAutoCompleteFieldDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/dmps-autocomplete-field-data-editor-model'; -import { ResearchersAutoCompleteFieldDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/researchers-auto-complete-field-data-editor-model'; -import { BaseComponent } from '@common/base/base.component'; -import { takeUntil } from 'rxjs/operators'; - -@Component({ - selector: 'app-dataset-profile-internal-dmp-entities-field-component', - styleUrls: ['./dataset-profile-editor-internal-dmp-entities-field.component.scss'], - templateUrl: './dataset-profile-editor-internal-dmp-entities-field.component.html' -}) -export class DatasetProfileEditorInternalDmpEntitiesFieldComponent extends BaseComponent implements OnInit { - @Input() form: UntypedFormGroup; - options = DatasetProfileInternalDmpEntitiesType; - - constructor( - public enumUtils: EnumUtils - ) { super() } - - ngOnInit() { - this.setupListeners(); - } - - setupListeners() { - this.form.get('data').get('type').valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(x => { - if (this.form.get('data')) { this.form.removeControl('data'); } - if (x === DatasetProfileInternalDmpEntitiesType.Researchers) { - this.form.addControl('data', new ResearchersAutoCompleteFieldDataEditorModel().buildForm()); - } else if (x === DatasetProfileInternalDmpEntitiesType.Datasets) { - this.form.addControl('data', new DatasetsAutoCompleteFieldDataEditorModel().buildForm()); - } - else if (x === DatasetProfileInternalDmpEntitiesType.Dmps) { - this.form.addControl('data', new DmpsAutoCompleteFieldDataEditorModel().buildForm()); - } - this.setupListeners(); - }) - } -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/multiplicity-field/description-template-editor-multiplicity-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-and-multiplicity-field/description-template-editor-label-and-multiplicity-field.component.html similarity index 100% rename from dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/multiplicity-field/description-template-editor-multiplicity-field.component.html rename to dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-and-multiplicity-field/description-template-editor-label-and-multiplicity-field.component.html diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dataset-identifier/dataset-profile-editor-dataset-identifier-field.component.scss b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-and-multiplicity-field/description-template-editor-label-and-multiplicity-field.component.scss similarity index 100% rename from dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/dataset-identifier/dataset-profile-editor-dataset-identifier-field.component.scss rename to dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-and-multiplicity-field/description-template-editor-label-and-multiplicity-field.component.scss diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-and-multiplicity-field/description-template-editor-label-and-multiplicity-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-and-multiplicity-field/description-template-editor-label-and-multiplicity-field.component.ts new file mode 100644 index 000000000..3cbd60d11 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-and-multiplicity-field/description-template-editor-label-and-multiplicity-field.component.ts @@ -0,0 +1,15 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { UntypedFormGroup } from '@angular/forms'; + +@Component({ + selector: 'app-description-template-editor-label-and-multiplicity-field-component', + styleUrls: ['./description-template-editor-label-and-multiplicity-field.component.scss'], + templateUrl: './description-template-editor-label-and-multiplicity-field.component.html' +}) +export class DescriptionTemplateEditorLabelAndMultiplicityFieldComponent implements OnInit { + + @Input() form: UntypedFormGroup; + + ngOnInit() { + } +} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/placeholder-field/description-template-editor-placeholder-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-field/description-template-editor-label-field.component.html similarity index 100% rename from dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/placeholder-field/description-template-editor-placeholder-field.component.html rename to dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-field/description-template-editor-label-field.component.html diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/multiplicity-field/description-template-editor-multiplicity-field.component.scss b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-field/description-template-editor-label-field.component.scss similarity index 100% rename from dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/multiplicity-field/description-template-editor-multiplicity-field.component.scss rename to dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-field/description-template-editor-label-field.component.scss diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-field/description-template-editor-label-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-field/description-template-editor-label-field.component.ts new file mode 100644 index 000000000..da9dbd8c6 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/label-field/description-template-editor-label-field.component.ts @@ -0,0 +1,15 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { UntypedFormGroup } from '@angular/forms'; + +@Component({ + selector: 'app-description-template-editor-label-field-component', + styleUrls: ['./description-template-editor-label-field.component.scss'], + templateUrl: './description-template-editor-label-field.component.html' +}) +export class DescriptionTemplateEditorLabelFieldComponent implements OnInit { + + @Input() form: UntypedFormGroup; + + ngOnInit() { + } +} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/multiplicity-field/description-template-editor-multiplicity-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/multiplicity-field/description-template-editor-multiplicity-field.component.ts deleted file mode 100644 index a35b25677..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/multiplicity-field/description-template-editor-multiplicity-field.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; - -@Component({ - selector: 'app-description-template-editor-multiplicity-field-component', - styleUrls: ['./description-template-editor-multiplicity-field.component.scss'], - templateUrl: './description-template-editor-multiplicity-field.component.html' -}) -export class DescriptionTemplateEditorMultiplicityFieldComponent implements OnInit { - - @Input() form: UntypedFormGroup; - - ngOnInit() { - } -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/placeholder-field/description-template-editor-placeholder-field.component.scss b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/placeholder-field/description-template-editor-placeholder-field.component.scss deleted file mode 100644 index 3db0dee74..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/placeholder-field/description-template-editor-placeholder-field.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.full-width { - width: 100%; -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/placeholder-field/description-template-editor-placeholder-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/placeholder-field/description-template-editor-placeholder-field.component.ts deleted file mode 100644 index dedc51738..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/placeholder-field/description-template-editor-placeholder-field.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; - -@Component({ - selector: 'app-description-template-editor-placeholder-field-component', - styleUrls: ['./description-template-editor-placeholder-field.component.scss'], - templateUrl: './description-template-editor-placeholder-field.component.html' -}) -export class DescriptionTemplateEditorPlaceholderFieldComponent implements OnInit { - - @Input() form: UntypedFormGroup; - - ngOnInit() { - } -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers-auto-complete/dataset-profile-editor-researchers-auto-complete-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers-auto-complete/dataset-profile-editor-researchers-auto-complete-field.component.html deleted file mode 100644 index f72411c66..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers-auto-complete/dataset-profile-editor-researchers-auto-complete-field.component.html +++ /dev/null @@ -1,13 +0,0 @@ -
- -
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}
- - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} - - - - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RESEARCHERS-PLACEHOLDER' | translate}} - - {{form.get('data').get('label').getError('backendError').message}} - -
diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers-auto-complete/dataset-profile-editor-researchers-auto-complete-field.component.scss b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers-auto-complete/dataset-profile-editor-researchers-auto-complete-field.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers-auto-complete/dataset-profile-editor-researchers-auto-complete-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers-auto-complete/dataset-profile-editor-researchers-auto-complete-field.component.ts deleted file mode 100644 index 723f776d4..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers-auto-complete/dataset-profile-editor-researchers-auto-complete-field.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ResearchersAutoCompleteFieldDataEditorModel } from "../../../../admin/field-data/researchers-auto-complete-field-data-editor-model"; -import { UntypedFormGroup } from "@angular/forms"; -import { Input, Component, OnInit } from "@angular/core"; -import { DatasetProfileInternalDmpEntitiesType } from "../../../../../../../core/common/enum/dataset-profile-internal-dmp-entities-type"; - -@Component({ - selector: 'app-dataset-profile-editor-researchers-auto-complete-field-component', - styleUrls: ['./dataset-profile-editor-researchers-auto-complete-field.component.scss'], - templateUrl: './dataset-profile-editor-researchers-auto-complete-field.component.html' -}) -export class DatasetProfileEditorResearchersAutoCompleteFieldComponent implements OnInit { - - @Input() form: UntypedFormGroup; - private data: ResearchersAutoCompleteFieldDataEditorModel = new ResearchersAutoCompleteFieldDataEditorModel(); - - ngOnInit() { - this.data.type = DatasetProfileInternalDmpEntitiesType.Researchers; - } -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component.html deleted file mode 100644 index 007731bf5..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
-
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RESEARCHERS-TITLE' - | translate}}
- - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} - - - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RESEARCHERS-PLACEHOLDER' | translate}} - - {{form.get('data').get('label').getError('backendError').message}} - -
diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component.scss b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component.scss deleted file mode 100644 index 3db0dee74..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.full-width { - width: 100%; -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component.ts deleted file mode 100644 index b7ecb9364..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; -import { DatePickerDataEditorModel } from '../../../../admin/field-data/date-picker-data-editor-models'; -import { ExternalDatasetsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/external-datasets-data-editor-models'; -import { DataRepositoriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/data-repositories-data-editor-models'; -import { RegistriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/registries-data-editor-models'; -import { ServicesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/services-data-editor-models'; -import { TagsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/tags-data-editor-models'; -import { ResearchersDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/researchers-data-editor-models'; -import { Router } from '@angular/router'; - -@Component({ - selector: 'app-dataset-profile-editor-researchers-field-component', - styleUrls: ['./dataset-profile-editor-researchers-field.component.scss'], - templateUrl: './dataset-profile-editor-researchers-field.component.html' -}) -export class DatasetProfileEditorResearchersFieldComponent implements OnInit { - - @Input() form: UntypedFormGroup; - private data: ResearchersDataEditorModel = new ResearchersDataEditorModel(); - - constructor(private router: Router) {} - - ngOnInit() { - if(this.router.url.includes('new')){ - this.form.patchValue({'rdaCommonStandard': 'dmp.contributor'}); - } - if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); } - } -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/tags/dataset-profile-editor-tags-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/tags/dataset-profile-editor-tags-field.component.html deleted file mode 100644 index d3a9f9587..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/tags/dataset-profile-editor-tags-field.component.html +++ /dev/null @@ -1,9 +0,0 @@ -
-
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-TAGS-TITLE' - | translate}}
- - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-TAGS-PLACEHOLDER' | translate}} - - {{form.get('data').get('label').getError('backendError').message}} - -
\ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/tags/dataset-profile-editor-tags-field.component.scss b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/tags/dataset-profile-editor-tags-field.component.scss deleted file mode 100644 index 3db0dee74..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/tags/dataset-profile-editor-tags-field.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.full-width { - width: 100%; -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/tags/dataset-profile-editor-tags-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/tags/dataset-profile-editor-tags-field.component.ts deleted file mode 100644 index 350809a8b..000000000 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/tags/dataset-profile-editor-tags-field.component.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; -import { DatePickerDataEditorModel } from '../../../../admin/field-data/date-picker-data-editor-models'; -import { ExternalDatasetsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/external-datasets-data-editor-models'; -import { DataRepositoriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/data-repositories-data-editor-models'; -import { RegistriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/registries-data-editor-models'; -import { ServicesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/services-data-editor-models'; -import { TagsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/tags-data-editor-models'; -import { Router } from '@angular/router'; - -@Component({ - selector: 'app-dataset-profile-editor-tags-field-component', - styleUrls: ['./dataset-profile-editor-tags-field.component.scss'], - templateUrl: './dataset-profile-editor-tags-field.component.html' -}) -export class DatasetProfileEditorTagsFieldComponent implements OnInit { - - @Input() form: UntypedFormGroup; - private data: TagsDataEditorModel = new TagsDataEditorModel(); - - constructor(private router: Router) {} - - ngOnInit() { - if(this.router.url.includes('new')){ - this.form.patchValue({'rdaCommonStandard': 'dataset.keyword'}); - } - if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); } - } -} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/upload/description-template-editor-upload-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/upload/description-template-editor-upload-field.component.ts index 7a57b2382..0b87d6410 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/upload/description-template-editor-upload-field.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/upload/description-template-editor-upload-field.component.ts @@ -2,6 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms'; import { DescriptionTemplateUploadOption } from '@app/core/model/description-template/description-template'; import { ConfigurationService } from "@app/core/services/configuration/configuration.service"; +import { DescriptionTemplateUploadOptionEditorModel } from '../../../description-template-editor.model'; @Component({ selector: 'app-description-template-editor-upload-field-component', @@ -78,7 +79,7 @@ export class DescriptionTemplateEditorUploadFieldComponent implements OnInit { } addNewRow(type: DescriptionTemplateUploadOption = null) { - const typeListOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel(); + const typeListOptions: DescriptionTemplateUploadOptionEditorModel = new DescriptionTemplateUploadOptionEditorModel(); if (type != null) { typeListOptions.fromModel(type); } diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.html index 29a4040c1..b264e5199 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.html @@ -207,21 +207,21 @@
- + - - - - - - - - - - + + + + + + + + + + diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts index 2d80e067d..0a6528ffd 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts @@ -175,7 +175,6 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS: case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DATASETS: - case DescriptionTemplateFieldType.EXTERNAL_DATASETS: case DescriptionTemplateFieldType.DATA_REPOSITORIES: case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES: case DescriptionTemplateFieldType.PUB_REPOSITORIES: 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 9bd066fdb..c674862a9 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 @@ -5,7 +5,7 @@ import { DescriptionTemplateFieldValidationType } from "@app/core/common/enum/de import { DescriptionTemplateStatus } from "@app/core/common/enum/description-template-status"; import { UserDescriptionTemplateRole } from "@app/core/common/enum/user-description-template-role"; import { DescriptionTemplate, DescriptionTemplateDefinition, DescriptionTemplateExternalSelectSourceBinding, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateLabelData, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection } from "@app/core/model/description-template/description-template"; -import { DescriptionTemplateExternalSelectAuthDataPersist, DescriptionTemplateExternalSelectDataPersist, DescriptionTemplateExternalSelectSourcePersist, DescriptionTemplateBaseFieldDataPersist, DescriptionTemplateSelectOptionPersist, DescriptionTemplateDefinitionPersist, DescriptionTemplateFieldPersist, DescriptionTemplateFieldSetPersist, DescriptionTemplateMultiplicityPersist, DescriptionTemplatePagePersist, DescriptionTemplatePersist, DescriptionTemplateLabelAndMultiplicityDataPersist, DescriptionTemplateRadioBoxDataPersist, DescriptionTemplateRadioBoxOptionPersist, DescriptionTemplateRulePersist, DescriptionTemplateSectionPersist, DescriptionTemplateUploadDataPersist, DescriptionTemplateUploadOptionPersist, DescriptionTemplateSelectDataPersist, UserDescriptionTemplatePersist, DescriptionTemplateExternalDatasetDataPersist, DescriptionTemplateExternalSelectSourceBindingPersist, DescriptionTemplateLabelDataPersist } from "@app/core/model/description-template/description-template-persist"; +import { DescriptionTemplateDefinitionPersist, DescriptionTemplateExternalDatasetDataPersist, DescriptionTemplateExternalSelectAuthDataPersist, DescriptionTemplateExternalSelectDataPersist, DescriptionTemplateExternalSelectSourceBindingPersist, DescriptionTemplateExternalSelectSourcePersist, DescriptionTemplateFieldPersist, DescriptionTemplateFieldSetPersist, DescriptionTemplateLabelAndMultiplicityDataPersist, DescriptionTemplateLabelDataPersist, DescriptionTemplateMultiplicityPersist, DescriptionTemplatePagePersist, DescriptionTemplatePersist, DescriptionTemplateRadioBoxDataPersist, DescriptionTemplateRadioBoxOptionPersist, DescriptionTemplateRulePersist, DescriptionTemplateSectionPersist, DescriptionTemplateSelectDataPersist, DescriptionTemplateSelectOptionPersist, DescriptionTemplateUploadDataPersist, DescriptionTemplateUploadOptionPersist, UserDescriptionTemplatePersist } from "@app/core/model/description-template/description-template-persist"; import { BaseEditorModel } from "@common/base/base-form-editor-model"; import { BackendErrorValidator } from "@common/forms/validation/custom-validator"; import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model"; @@ -822,7 +822,6 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS: case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DATASETS: - case DescriptionTemplateFieldType.EXTERNAL_DATASETS: case DescriptionTemplateFieldType.DATA_REPOSITORIES: case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES: case DescriptionTemplateFieldType.PUB_REPOSITORIES: @@ -1192,9 +1191,7 @@ export class DescriptionTemplateExternalSelectDataEditorModel extends Descriptio formGroup.setControl('multipleSelect', new FormControl({ value: this.multipleSelect, disabled: disabled }, context.getValidation('multipleSelect').validators)); formGroup.setControl('sources', this.formBuilder.array( (this.sources ?? []).map( - (item, index) => new DescriptionTemplateExternalSelectSourceEditorModel( - this.validationErrorModel - ).fromModel(item).buildForm({ + (item, index) => item.buildForm({ rootPath: `${rootPath}sources[${index}].` }), context.getValidation('sources') ))); @@ -1815,6 +1812,7 @@ export class DescriptionTemplateSelectOptionEditorModel implements DescriptionTe // export class DescriptionTemplateUploadDataEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateUploadDataPersist { types: DescriptionTemplateUploadOptionEditorModel[] = []; + maxFileSizeInMB: number; protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); constructor( @@ -1824,6 +1822,7 @@ export class DescriptionTemplateUploadDataEditorModel extends DescriptionTemplat fromModel(item: DescriptionTemplateUploadDataPersist): DescriptionTemplateUploadDataEditorModel { if (item) { super.fromModel(item); + this.maxFileSizeInMB = item.maxFileSizeInMB; if (item.types) { item.types.map(x => this.types.push(new DescriptionTemplateUploadOptionEditorModel(this.validationErrorModel).fromModel(x))); } } return this; @@ -1843,6 +1842,7 @@ export class DescriptionTemplateUploadDataEditorModel extends DescriptionTemplat } const formGroup = super.buildForm({ context, disabled, rootPath }); + formGroup.setControl('maxFileSizeInMB', new FormControl({ value: this.maxFileSizeInMB, disabled: disabled }, context.getValidation('maxFileSizeInMB').validators)); formGroup.setControl('types', this.formBuilder.array( (this.types ?? []).map( (item, index) => new DescriptionTemplateUploadOptionEditorModel( @@ -1860,7 +1860,8 @@ export class DescriptionTemplateUploadDataEditorModel extends DescriptionTemplat }): ValidationContext { const { rootPath = '', validationErrorModel } = params; const baseContext: ValidationContext = super.createValidationContext({ rootPath, validationErrorModel }); - baseContext.validation.push({ key: 'types', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}types`)] }); + baseContext.validation.push({ key: 'types', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}types`)] }); + baseContext.validation.push({ key: 'maxFileSizeInMB', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}maxFileSizeInMB`)] }); return baseContext; } diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.resolver.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.resolver.ts index 09eccc504..8fb221974 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.resolver.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.resolver.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { DescriptionTemplateType } from '@app/core/model/description-template-type/description-template-type'; -import { DescriptionTemplate, DescriptionTemplateExternalSelectData, DescriptionTemplateBaseFieldData, DescriptionTemplateSelectOption, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData } from '@app/core/model/description-template/description-template'; +import { DescriptionTemplate, DescriptionTemplateExternalSelectData, DescriptionTemplateBaseFieldData, DescriptionTemplateSelectOption, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData, DescriptionTemplateExternalDatasetData, DescriptionTemplateExternalSelectSource, DescriptionTemplateExternalSelectAuthData, DescriptionTemplateExternalSelectSourceBinding } from '@app/core/model/description-template/description-template'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; import { BaseEditorResolver } from '@common/base/base-editor.resolver'; @@ -72,6 +72,21 @@ export class DescriptionTemplateEditorResolver extends BaseEditorResolver { [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.options), 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.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.sources), nameof(x => x.url)].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.sources), nameof(x => x.method)].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.sources), nameof(x => x.optionsRoot)].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.sources), nameof(x => x.sourceBinding), 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.sources), nameof(x => x.sourceBinding), 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.sources), nameof(x => x.sourceBinding), nameof(x => x.source)].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.sources), nameof(x => x.hasAuth)].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.sources), nameof(x => x.auth), nameof(x => x.url)].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.sources), nameof(x => x.auth), nameof(x => x.method)].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.sources), nameof(x => x.auth), nameof(x => x.body)].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.sources), nameof(x => x.auth), nameof(x => x.path)].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.sources), nameof(x => x.auth), nameof(x => x.type)].join('.'), + + nameof(x => x.createdAt), nameof(x => x.hash), diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.html index 2e15e615a..b7e3ee410 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.html @@ -24,16 +24,20 @@
-
+ +
+
+
{{field.label}}
- +
+