description templates editor ui fixes.

This commit is contained in:
Diamantis Tziotzios 2024-02-01 15:41:05 +02:00
parent da62f79a73
commit bef333ebc9
50 changed files with 177 additions and 394 deletions

View File

@ -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 {

View File

@ -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))

View File

@ -62,11 +62,6 @@ public class UploadDataPersist extends BaseFieldDataPersist {
protected List<Specification> specifications(UploadDataPersist item) {
List<Specification> 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())),

View File

@ -0,0 +1,3 @@
export enum DescriptionTemplateExternalSelectAuthType {
BEARER = 'Bearer'
}

View File

@ -0,0 +1,4 @@
export enum DescriptionTemplateExternalSelectHttpMethodType {
GET = 'GET',
POST = 'POST'
}

View File

@ -116,6 +116,7 @@ export interface DescriptionTemplateSelectDataPersist extends DescriptionTemplat
export interface DescriptionTemplateUploadDataPersist extends DescriptionTemplateBaseFieldDataPersist {
types: DescriptionTemplateUploadOptionPersist[];
maxFileSizeInMB: number;
}
//

View File

@ -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');
}
}
}

View File

@ -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 { }

View File

@ -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:

View File

@ -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 = (<UntypedFormArray>this.form.get('data').get('sources'));
}
addSource() {
(<UntypedFormArray>this.multiForm).push(new DescriptionTemplateExternalSelectDataEditorModel().buildForm());
}
removeSource(index: number) {
(<UntypedFormArray>this.multiForm).removeAt(index);
}
}

View File

@ -1,10 +0,0 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATASET-IDENTIFIER-TITLE'
| translate}}</h5>
<mat-form-field class="col-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATASET-IDENTIFIER-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string"
[formControl]="form.get('data').get('label')">
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>

View File

@ -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()); }
}
}

View File

@ -1,14 +0,0 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-auto">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox>
<mat-form-field class="col-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATASETS-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string"
[formControl]="form.get('data').get('label')">
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>

View File

@ -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;
}
}

View File

@ -1,14 +0,0 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-auto">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox>
<mat-form-field class="col-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DMPS-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string"
[formControl]="form.get('data').get('label')">
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>

View File

@ -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;
}
}

View File

@ -1,22 +1,26 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-EXTERNAL-DATASETS-TITLE'
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-EXTERNAL-DATASETS-TITLE'
| translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox>
<mat-form-field class="col-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-EXTERNAL-DATASETS-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string"[formControl]="form.get('data').get('label')">
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
</mat-form-field>
<!-- <mat-form-field class="col-6">
<mat-label>
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.EXTERNAL-DATASET-TYPE-NAME' | translate}}
</mat-label>
<mat-select [formControl]="form.get('data').get('type')">
<mat-option *ngFor="let type of externalDatasetTypeEnumValues" [value]="type">{{enumUtils.toDescriptionTemplateFieldDataExternalDatasetTypeString(type)}}</mat-option>
</mat-select>
<mat-error *ngIf="form.get('data').get('type').hasError('backendError')">{{form.get('data').get('type').getError('backendError').message}}</mat-error>
</mat-form-field> -->
<div class="col-6">
<mat-form-field class="w-100">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-EXTERNAL-DATASETS-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string" [formControl]="form.get('data').get('label')">
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>
<div class="col-6">
<mat-form-field class="w-100">
<mat-label>
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.EXTERNAL-DATASET-TYPE-NAME' | translate}}
</mat-label>
<mat-select [formControl]="form.get('data').get('type')">
<mat-option *ngFor="let type of externalDatasetTypeEnumValues" [value]="type">{{enumUtils.toDescriptionTemplateFieldDataExternalDatasetTypeString(type)}}</mat-option>
</mat-select>
<mat-error *ngIf="form.get('data').get('type').hasError('backendError')">{{form.get('data').get('type').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>
</div>

View File

@ -26,12 +26,12 @@
</div>
</div>
<div *ngFor="let singleForm of multiForm.controls; let i = index" class="row">
{{this.form.get('data').get('sources').value | json}}
<div *ngFor="let singleForm of this.form.get('data').get('sources')?.controls; let i = index" class="row">
<mat-form-field class="col-md-6">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-METHOD' | translate}}</mat-label>
<mat-select [formControl]="singleForm.get('method')">
<mat-option *ngFor="let method of htmlMethods | keyvalue" [value]="method.value">{{method.value}}</mat-option>
<mat-option *ngFor="let method of methodTypeValues" [value]="method">{{enumUtils.toDescriptionTemplateExternalSelectHttpMethodTypeString(method)}}</mat-option>
</mat-select>
<mat-error *ngIf="singleForm.get('method').hasError('backendError')">{{singleForm.get('method').getError('backendError').message}}</mat-error>
</mat-form-field>
@ -70,7 +70,7 @@
<mat-form-field class="col-md-6">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-METHOD' | translate}}</mat-label>
<mat-select [formControl]="singleForm.get('auth').get('method')">
<mat-option *ngFor="let method of htmlMethods | keyvalue" [value]="method.value">{{method.value}}</mat-option>
<mat-option *ngFor="let method of methodTypeValues" [value]="method">{{enumUtils.toDescriptionTemplateExternalSelectHttpMethodTypeString(method)}}</mat-option>
</mat-select>
<mat-error *ngIf="singleForm.get('auth').get('method').hasError('backendError')">{{singleForm.get('auth').get('method').getError('backendError').message}}</mat-error>
</mat-form-field>
@ -83,7 +83,7 @@
<mat-form-field class="col-md-6">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-TYPE' | translate}}</mat-label>
<mat-select [formControl]="singleForm.get('auth').get('type')">
<mat-option *ngFor="let type of authTypes | keyvalue" [value]="type.value">{{type.value}}</mat-option>
<mat-option *ngFor="let type of authTypeValues" [value]="type">{{enumUtils.toDescriptionTemplateExternalSelectAuthTypeString(type)}}</mat-option>
</mat-select>
<mat-error *ngIf="singleForm.get('auth').get('type').hasError('backendError')">{{singleForm.get('auth').get('type').getError('backendError').message}}</mat-error>
</mat-form-field>

View File

@ -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>(DescriptionTemplateExternalSelectHttpMethodType);
authTypeValues = this.enumUtils.getEnumValues<DescriptionTemplateExternalSelectAuthType>(DescriptionTemplateExternalSelectAuthType);
constructor (
public enumUtils: EnumUtils
) {}
ngOnInit() {
}
addSource() {
(<UntypedFormArray>this.form.get('data').get('sources')).push(new DescriptionTemplateExternalSelectSourceEditorModel().buildForm());
}
removeSource(index: number) {
(<UntypedFormArray>this.form.get('data').get('sources')).removeAt(index);
}
}

View File

@ -1,12 +0,0 @@
<div class="row">
<mat-form-field class="col-12">
<mat-select placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-INTERNAL-DMP-ENTITIES-TYPE' | translate}}" [formControl]="this.form.get('data').get('type')">
<mat-option [value]="options.Researchers">{{enumUtils.toDatasetProfileInternalDmpEntitiesTypeString(options.Researchers)}}</mat-option>
<mat-option [value]="options.Datasets">{{enumUtils.toDatasetProfileInternalDmpEntitiesTypeString(options.Datasets)}}</mat-option>
<mat-option [value]="options.Dmps">{{enumUtils.toDatasetProfileInternalDmpEntitiesTypeString(options.Dmps)}}</mat-option>
</mat-select>
</mat-form-field>
<app-dataset-profile-editor-researchers-auto-complete-field-component *ngIf="this.form.get('data').get('type').value === options.Researchers" class="col-12" [form]="form"></app-dataset-profile-editor-researchers-auto-complete-field-component>
<app-dataset-profile-editor-datasets-autocomplete-field-component *ngIf="this.form.get('data').get('type').value === options.Datasets" class="col-12" [form]="form"></app-dataset-profile-editor-datasets-autocomplete-field-component>
<app-dataset-profile-editor-dmps-autocomplete-field-component *ngIf="this.form.get('data').get('type').value === options.Dmps" class="col-12" [form]="form"></app-dataset-profile-editor-dmps-autocomplete-field-component>
</div>

View File

@ -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();
})
}
}

View File

@ -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() {
}
}

View File

@ -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() {
}
}

View File

@ -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() {
}
}

View File

@ -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() {
}
}

View File

@ -1,13 +0,0 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-auto">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox>
<mat-form-field class="col-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RESEARCHERS-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string" [formControl]="form.get('data').get('label')">
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>

View File

@ -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;
}
}

View File

@ -1,12 +0,0 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RESEARCHERS-TITLE'
| translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox>
<mat-form-field class="col-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RESEARCHERS-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string" [formControl]="form.get('data').get('label')">
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>

View File

@ -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()); }
}
}

View File

@ -1,9 +0,0 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-TAGS-TITLE'
| translate}}</h5>
<mat-form-field class="col-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-TAGS-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string" [formControl]="form.get('data').get('label')">
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>

View File

@ -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()); }
}
}

View File

@ -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);
}

View File

@ -207,21 +207,21 @@
</div>
<div class="row" [ngSwitch]="form.get('data')?.get('fieldType')?.value " *ngIf="expandView">
<app-description-template-editor-auto-complete-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT" class="col-12" [form]="form"></app-description-template-editor-auto-complete-field-component>
<app-description-template-editor-external-select-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT" class="col-12" [form]="form"></app-description-template-editor-external-select-field-component>
<app-description-template-editor-select-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12" [form]="form"></app-description-template-editor-select-field-component>
<app-description-template-editor-radio-box-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.RADIO_BOX" class="col-12" [form]="form"></app-description-template-editor-radio-box-field-component>
<app-description-template-editor-upload-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.UPLOAD" class="col-12" [form]="form"></app-description-template-editor-upload-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.BOOLEAN_DECISION" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.CHECK_BOX" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.FREE_TEXT" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.TEXT_AREA" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.RICH_TEXT_AREA" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATE_PICKER" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.TAGS" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATASET_IDENTIFIER" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.CURRENCY" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.VALIDATION" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.BOOLEAN_DECISION" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.CHECK_BOX" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.FREE_TEXT" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.TEXT_AREA" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.RICH_TEXT_AREA" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATE_PICKER" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.TAGS" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATASET_IDENTIFIER" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.CURRENCY" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.VALIDATION" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
<app-description-template-editor-external-datasets-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_DATASETS" class="col-12" [form]="form"></app-description-template-editor-external-datasets-field-component>

View File

@ -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:

View File

@ -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;
}

View File

@ -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<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateSelectOption>(x => x.label)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateSelectOption>(x => x.value)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.multipleSelect)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalDatasetData>(x => x.type)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.url)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.method)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.optionsRoot)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.sourceBinding), nameof<DescriptionTemplateExternalSelectSourceBinding>(x => x.label)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.sourceBinding), nameof<DescriptionTemplateExternalSelectSourceBinding>(x => x.value)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.sourceBinding), nameof<DescriptionTemplateExternalSelectSourceBinding>(x => x.source)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.hasAuth)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.auth), nameof<DescriptionTemplateExternalSelectAuthData>(x => x.url)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.auth), nameof<DescriptionTemplateExternalSelectAuthData>(x => x.method)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.auth), nameof<DescriptionTemplateExternalSelectAuthData>(x => x.body)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.auth), nameof<DescriptionTemplateExternalSelectAuthData>(x => x.path)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.sources), nameof<DescriptionTemplateExternalSelectSource>(x => x.auth), nameof<DescriptionTemplateExternalSelectAuthData>(x => x.type)].join('.'),
nameof<DescriptionTemplate>(x => x.createdAt),
nameof<DescriptionTemplate>(x => x.hash),

View File

@ -24,16 +24,20 @@
<app-form-composite-title class="row" [fieldSet]="fieldSet" [path]="path" [isChild]="isChild"></app-form-composite-title>
</div>
<div class="col align-self-center">
<div *ngFor="let field of fieldSet.fields; let i = index;" class="col-12 compositeField">
<!-- <div *ngFor="let field of fieldSet.fields; let i = index;" class="col-12 compositeField"> -->
<div *ngFor="let fieldSetFormGroup of propertiesFormGroup.get('fieldSet.id'); let i = index;" class="col-12 compositeField">
<div *ngFor="let field of fieldSet.fields; let i = index;" class="col-12 compositeField">
<!-- <ng-container *ngIf="this.visibilityRulesService.isVisibleMap[field.id] ?? true"> -->
<ng-container>
<div class="row">
<h5 *ngIf="placeholderTitle" class="col-auto font-weight-bold">{{field.label}}</h5>
</div>
<app-form-field class="col-12 compositeField" [propertiesFormGroup]="propertiesFormGroup" [field]="field" [fieldSet]="fieldSet" [visibilityRulesService]="visibilityRulesService" [datasetProfileId]="datasetProfileId" [isChild]="true"></app-form-field>
<app-form-field class="col-12 compositeField" [propertiesFormGroup]="propertiesFormGroup" [field]="field" [fieldSet]="fieldSet" [fieldSetFormGroup]="fieldSetFormGroup" [visibilityRulesService]="visibilityRulesService" [datasetProfileId]="datasetProfileId" [isChild]="true"></app-form-field>
</ng-container>
</div>
</div>
</div>
<div *ngIf="showDelete" class="col-auto align-self-center">
<button mat-icon-button type="button" class="deleteBtn" (click)="deleteCompositeField();">
<mat-icon>delete</mat-icon>

View File

@ -2321,6 +2321,13 @@
"GET": "GET",
"POST": "POST"
},
"DESCRIPTION-TEMPLATE-EXTERNAL-SELECT-HTTP-METHOD-TYPE": {
"GET": "GET",
"POST": "POST"
},
"DESCRIPTION-TEMPLATE-EXTERNAL-SELECT-AUTH-TYPE": {
"BEARER": "Bearer"
},
"REFERENCE-TYPE": {
"TAXONOMY": "Taxonomy",
"LICENCE": "License",