add dmp blueprint prefilling source and validation prefilling source fixes
This commit is contained in:
parent
141d6346fb
commit
dad32207e3
|
@ -37,6 +37,10 @@ public class SectionEntity {
|
||||||
@XmlElement(name = "descriptionTemplate")
|
@XmlElement(name = "descriptionTemplate")
|
||||||
private List<DescriptionTemplateEntity> descriptionTemplates;
|
private List<DescriptionTemplateEntity> descriptionTemplates;
|
||||||
|
|
||||||
|
@XmlElementWrapper(name = "prefillingSourcesIds")
|
||||||
|
@XmlElement(name = "id")
|
||||||
|
private List<UUID> prefillingSourcesIds;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -86,6 +90,14 @@ public class SectionEntity {
|
||||||
this.descriptionTemplates = descriptionTemplates;
|
this.descriptionTemplates = descriptionTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<UUID> getPrefillingSourcesIds() {
|
||||||
|
return prefillingSourcesIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrefillingSourcesIds(List<UUID> prefillingSourcesIds) {
|
||||||
|
this.prefillingSourcesIds = prefillingSourcesIds;
|
||||||
|
}
|
||||||
|
|
||||||
public List<FieldEntity> getAllField(){
|
public List<FieldEntity> getAllField(){
|
||||||
return this.getFields() != null ? this.getFields() : new ArrayList<>();
|
return this.getFields() != null ? this.getFields() : new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,13 @@ import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
import eu.eudat.commons.types.dmpblueprint.*;
|
import eu.eudat.commons.types.dmpblueprint.*;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.PrefillingSourceEntity;
|
||||||
import eu.eudat.model.builder.BaseBuilder;
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.builder.PrefillingSourceBuilder;
|
||||||
import eu.eudat.model.dmpblueprintdefinition.Section;
|
import eu.eudat.model.dmpblueprintdefinition.Section;
|
||||||
|
import eu.eudat.query.PrefillingSourceQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
@ -24,13 +28,15 @@ import java.util.*;
|
||||||
public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {
|
public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
private final QueryFactory queryFactory;
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public SectionBuilder(
|
public SectionBuilder(
|
||||||
ConventionService conventionService, BuilderFactory builderFactory) {
|
ConventionService conventionService, BuilderFactory builderFactory, QueryFactory queryFactory) {
|
||||||
super(conventionService, new LoggerService(LoggerFactory.getLogger(SectionBuilder.class)));
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(SectionBuilder.class)));
|
||||||
this.builderFactory = builderFactory;
|
this.builderFactory = builderFactory;
|
||||||
|
this.queryFactory = queryFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SectionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
public SectionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
@ -48,6 +54,7 @@ public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {
|
||||||
//Not Bulk Build because is XML no interaction with db
|
//Not Bulk Build because is XML no interaction with db
|
||||||
FieldSet descriptionTemplatesFields = fields.extractPrefixed(this.asPrefix(Section._descriptionTemplates));
|
FieldSet descriptionTemplatesFields = fields.extractPrefixed(this.asPrefix(Section._descriptionTemplates));
|
||||||
FieldSet fieldsFields = fields.extractPrefixed(this.asPrefix(Section._fields));
|
FieldSet fieldsFields = fields.extractPrefixed(this.asPrefix(Section._fields));
|
||||||
|
FieldSet prefillingSourcesFields = fields.extractPrefixed(this.asPrefix(Section._prefillingSources));
|
||||||
|
|
||||||
List<Section> models = new ArrayList<>();
|
List<Section> models = new ArrayList<>();
|
||||||
for (SectionEntity d : data) {
|
for (SectionEntity d : data) {
|
||||||
|
@ -67,6 +74,10 @@ public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {
|
||||||
List<ReferenceTypeFieldEntity> referenceFieldEntities = d.getFields().stream().filter(x-> DmpBlueprintFieldCategory.ReferenceType.equals(x.getCategory())).map(x-> (ReferenceTypeFieldEntity)x).toList();
|
List<ReferenceTypeFieldEntity> referenceFieldEntities = d.getFields().stream().filter(x-> DmpBlueprintFieldCategory.ReferenceType.equals(x.getCategory())).map(x-> (ReferenceTypeFieldEntity)x).toList();
|
||||||
m.getFields().addAll(this.builderFactory.builder(ReferenceFieldBuilder.class).authorize(this.authorize).build(fieldsFields, referenceFieldEntities));
|
m.getFields().addAll(this.builderFactory.builder(ReferenceFieldBuilder.class).authorize(this.authorize).build(fieldsFields, referenceFieldEntities));
|
||||||
}
|
}
|
||||||
|
if (!prefillingSourcesFields.isEmpty() && d.getPrefillingSourcesIds() != null) {
|
||||||
|
List<PrefillingSourceEntity> prefillingSourceEntities = this.queryFactory.query(PrefillingSourceQuery.class).authorize(this.authorize).ids(d.getPrefillingSourcesIds()).collectAs(prefillingSourcesFields);
|
||||||
|
m.setPrefillingSources(this.builderFactory.builder(PrefillingSourceBuilder.class).authorize(this.authorize).build(prefillingSourcesFields, prefillingSourceEntities));
|
||||||
|
}
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package eu.eudat.model.dmpblueprintdefinition;
|
package eu.eudat.model.dmpblueprintdefinition;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.model.PrefillingSource;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -27,6 +29,9 @@ public class Section {
|
||||||
public final static String _descriptionTemplates = "descriptionTemplates";
|
public final static String _descriptionTemplates = "descriptionTemplates";
|
||||||
private List<DescriptionTemplate> descriptionTemplates;
|
private List<DescriptionTemplate> descriptionTemplates;
|
||||||
|
|
||||||
|
public final static String _prefillingSources = "prefillingSources";
|
||||||
|
private List<PrefillingSource> prefillingSources;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +87,14 @@ public class Section {
|
||||||
public void setDescriptionTemplates(List<DescriptionTemplate> descriptionTemplates) {
|
public void setDescriptionTemplates(List<DescriptionTemplate> descriptionTemplates) {
|
||||||
this.descriptionTemplates = descriptionTemplates;
|
this.descriptionTemplates = descriptionTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PrefillingSource> getPrefillingSources() {
|
||||||
|
return prefillingSources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrefillingSources(List<PrefillingSource> prefillingSources) {
|
||||||
|
this.prefillingSources = prefillingSources;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,10 @@ public class SectionPersist {
|
||||||
|
|
||||||
public static final String _descriptionTemplates = "descriptionTemplates";
|
public static final String _descriptionTemplates = "descriptionTemplates";
|
||||||
|
|
||||||
|
private List<UUID> prefillingSourcesIds= null;
|
||||||
|
|
||||||
|
public static final String _prefillingSourcesIds = "prefillingSourcesIds";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -101,6 +105,14 @@ public class SectionPersist {
|
||||||
this.descriptionTemplates = descriptionTemplates;
|
this.descriptionTemplates = descriptionTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<UUID> getPrefillingSourcesIds() {
|
||||||
|
return prefillingSourcesIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrefillingSourcesIds(List<UUID> prefillingSourcesIds) {
|
||||||
|
this.prefillingSourcesIds = prefillingSourcesIds;
|
||||||
|
}
|
||||||
|
|
||||||
@Component(SectionPersistValidator.ValidatorName)
|
@Component(SectionPersistValidator.ValidatorName)
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public static class SectionPersistValidator extends BaseValidator<SectionPersist> {
|
public static class SectionPersistValidator extends BaseValidator<SectionPersist> {
|
||||||
|
|
|
@ -91,7 +91,11 @@ public class PrefillingSourceDefinitionFieldPersist {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<Specification> specifications(PrefillingSourceDefinitionFieldPersist item) {
|
protected List<Specification> specifications(PrefillingSourceDefinitionFieldPersist item) {
|
||||||
return Arrays.asList();
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isEmpty(item.getCode()))
|
||||||
|
.failOn(PrefillingSourceDefinitionFieldPersist._code).failWith(messageSource.getMessage("Validation_Required", new Object[]{PrefillingSourceDefinitionFieldPersist._code}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,9 @@ public class PrefillingSourceDefinitionPersist {
|
||||||
private ExternalFetcherApiSourceConfigurationPersist getConfiguration;
|
private ExternalFetcherApiSourceConfigurationPersist getConfiguration;
|
||||||
public static final String _getConfiguration = "getConfiguration";
|
public static final String _getConfiguration = "getConfiguration";
|
||||||
|
|
||||||
|
private Boolean getEnabled;
|
||||||
|
public static final String _getEnabled = "getEnabled";
|
||||||
|
|
||||||
private List<PrefillingSourceDefinitionFieldPersist> fields;
|
private List<PrefillingSourceDefinitionFieldPersist> fields;
|
||||||
public static final String _fields = "fields";
|
public static final String _fields = "fields";
|
||||||
|
|
||||||
|
@ -42,6 +45,14 @@ public class PrefillingSourceDefinitionPersist {
|
||||||
this.getConfiguration = getConfiguration;
|
this.getConfiguration = getConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getGetEnabled() {
|
||||||
|
return getEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGetEnabled(Boolean getEnabled) {
|
||||||
|
this.getEnabled = getEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public List<PrefillingSourceDefinitionFieldPersist> getFields() {
|
public List<PrefillingSourceDefinitionFieldPersist> getFields() {
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
@ -82,11 +93,11 @@ public class PrefillingSourceDefinitionPersist {
|
||||||
.on(PrefillingSourceDefinitionPersist._searchConfiguration)
|
.on(PrefillingSourceDefinitionPersist._searchConfiguration)
|
||||||
.over(item.getSearchConfiguration())
|
.over(item.getSearchConfiguration())
|
||||||
.using(() -> this.validatorFactory.validator(ExternalFetcherApiSourceConfigurationPersist.ExternalFetcherApiSourceConfigurationPersistValidator.class)),
|
.using(() -> this.validatorFactory.validator(ExternalFetcherApiSourceConfigurationPersist.ExternalFetcherApiSourceConfigurationPersistValidator.class)),
|
||||||
// this.refSpec() TODO
|
this.refSpec()
|
||||||
// .iff(() -> !this.isNull(item.getGetConfiguration()))
|
.iff(() -> !this.isNull(item.getGetConfiguration()) && item.getGetEnabled())
|
||||||
// .on(PrefillingSourceDefinitionPersist._getConfiguration)
|
.on(PrefillingSourceDefinitionPersist._getConfiguration)
|
||||||
// .over(item.getGetConfiguration())
|
.over(item.getGetConfiguration())
|
||||||
// .using(() -> this.validatorFactory.validator(ExternalFetcherApiSourceConfigurationPersist.ExternalFetcherApiSourceConfigurationPersistValidator.class)),
|
.using(() -> this.validatorFactory.validator(ExternalFetcherApiSourceConfigurationPersist.ExternalFetcherApiSourceConfigurationPersistValidator.class)),
|
||||||
this.navSpec()
|
this.navSpec()
|
||||||
.iff(() -> !this.isListNullOrEmpty(item.getFields()))
|
.iff(() -> !this.isListNullOrEmpty(item.getFields()))
|
||||||
.on(PrefillingSourceDefinitionPersist._fields)
|
.on(PrefillingSourceDefinitionPersist._fields)
|
||||||
|
|
|
@ -216,6 +216,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
||||||
data.setLabel(persist.getLabel());
|
data.setLabel(persist.getLabel());
|
||||||
data.setOrdinal(persist.getOrdinal());
|
data.setOrdinal(persist.getOrdinal());
|
||||||
data.setHasTemplates(persist.getHasTemplates());
|
data.setHasTemplates(persist.getHasTemplates());
|
||||||
|
data.setPrefillingSourcesIds(persist.getPrefillingSourcesIds());
|
||||||
if (!this.conventionService.isListNullOrEmpty(persist.getFields())) {
|
if (!this.conventionService.isListNullOrEmpty(persist.getFields())) {
|
||||||
data.setFields(new ArrayList<>());
|
data.setFields(new ArrayList<>());
|
||||||
for (FieldPersist fieldPersist : persist.getFields()) {
|
for (FieldPersist fieldPersist : persist.getFields()) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
|
||||||
if (persist.getSearchConfiguration() != null ) {
|
if (persist.getSearchConfiguration() != null ) {
|
||||||
data.setSearchConfiguration(this.buildExternalFetcherApiConfigEntity(persist.getSearchConfiguration()));
|
data.setSearchConfiguration(this.buildExternalFetcherApiConfigEntity(persist.getSearchConfiguration()));
|
||||||
}
|
}
|
||||||
if (persist.getGetConfiguration() != null ) {
|
if (persist.getGetConfiguration() != null && persist.getGetEnabled()) {
|
||||||
data.setGetConfiguration(this.buildExternalFetcherApiConfigEntity(persist.getGetConfiguration()));
|
data.setGetConfiguration(this.buildExternalFetcherApiConfigEntity(persist.getGetConfiguration()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { DmpBlueprintSystemFieldType } from "@app/core/common/enum/dmp-blueprint
|
||||||
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
|
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
|
||||||
import { Guid } from "@common/types/guid";
|
import { Guid } from "@common/types/guid";
|
||||||
import { ReferenceType } from "../reference-type/reference-type";
|
import { ReferenceType } from "../reference-type/reference-type";
|
||||||
|
import { PrefillingSource } from "../prefilling-source/prefilling-source";
|
||||||
|
|
||||||
|
|
||||||
export interface DmpBlueprint extends BaseEntity {
|
export interface DmpBlueprint extends BaseEntity {
|
||||||
|
@ -28,6 +29,7 @@ export interface DmpBlueprintDefinitionSection {
|
||||||
fields: FieldInSection[];
|
fields: FieldInSection[];
|
||||||
hasTemplates: boolean;
|
hasTemplates: boolean;
|
||||||
descriptionTemplates?: DescriptionTemplatesInSection[];
|
descriptionTemplates?: DescriptionTemplatesInSection[];
|
||||||
|
prefillingSources: PrefillingSource[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DescriptionTemplatesInSection {
|
export interface DescriptionTemplatesInSection {
|
||||||
|
@ -87,6 +89,7 @@ export interface DmpBlueprintDefinitionSectionPersist {
|
||||||
fields: FieldInSectionPersist[];
|
fields: FieldInSectionPersist[];
|
||||||
hasTemplates: boolean;
|
hasTemplates: boolean;
|
||||||
descriptionTemplates?: DescriptionTemplatesInSectionPersist[];
|
descriptionTemplates?: DescriptionTemplatesInSectionPersist[];
|
||||||
|
prefillingSourcesIds: Guid[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DescriptionTemplatesInSectionPersist {
|
export interface DescriptionTemplatesInSectionPersist {
|
||||||
|
|
|
@ -176,8 +176,8 @@ export class EnumUtils {
|
||||||
|
|
||||||
toExternalFetcherSourceTypeString(status: ExternalFetcherSourceType): string {
|
toExternalFetcherSourceTypeString(status: ExternalFetcherSourceType): string {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case ExternalFetcherSourceType.API: return this.language.instant('TYPES.REFERENCE-TYPE-SOURCE-TYPE.API');
|
case ExternalFetcherSourceType.API: return this.language.instant('TYPES.EXTERNAL-FETCHER-SOURCE-TYPE.API');
|
||||||
case ExternalFetcherSourceType.STATIC: return this.language.instant('TYPES.REFERENCE-TYPE-SOURCE-TYPE.STATIC');
|
case ExternalFetcherSourceType.STATIC: return this.language.instant('TYPES.EXTERNAL-FETCHER-SOURCE-TYPE.STATIC');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,8 +191,8 @@ export class EnumUtils {
|
||||||
|
|
||||||
toExternalFetcherApiHTTPMethodTypeString(status: ExternalFetcherApiHTTPMethodType): string {
|
toExternalFetcherApiHTTPMethodTypeString(status: ExternalFetcherApiHTTPMethodType): string {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case ExternalFetcherApiHTTPMethodType.GET: return this.language.instant('TYPES.REFERENCE-TYPE-EXTERNAL-API-HTTP-METHOD-TYPE.GET');
|
case ExternalFetcherApiHTTPMethodType.GET: return this.language.instant('TYPES.EXTERNAL-FETCHER-API-HTTP-METHOD-TYPE.GET');
|
||||||
case ExternalFetcherApiHTTPMethodType.POST: return this.language.instant('TYPES.REFERENCE-TYPE-EXTERNAL-API-HTTP-METHOD-TYPE.POST');
|
case ExternalFetcherApiHTTPMethodType.POST: return this.language.instant('TYPES.EXTERNAL-FETCHER-API-HTTP-METHOD-TYPE.POST');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -247,6 +247,13 @@
|
||||||
</div>
|
</div>
|
||||||
<mat-error *ngIf="section.get('descriptionTemplates').hasError('backendError')">{{section.get('descriptionTemplates').getError('backendError').message}}</mat-error>
|
<mat-error *ngIf="section.get('descriptionTemplates').hasError('backendError')">{{section.get('descriptionTemplates').getError('backendError').message}}</mat-error>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="section.get('hasTemplates').value == true">
|
||||||
|
<mat-form-field class="col-6">
|
||||||
|
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.PREFILLING-SOURCES' | translate}}</mat-label>
|
||||||
|
<app-multiple-auto-complete [formControl]="section.get('prefillingSourcesIds')" [configuration]="prefillingSourceService.multipleAutocompleteConfiguration"></app-multiple-auto-complete>
|
||||||
|
<mat-error *ngIf="section.get('prefillingSourcesIds').hasError('backendError')">{{section.get('prefillingSourcesIds').getError('backendError').message}}</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -42,6 +42,7 @@ import { DmpBlueprintEditorResolver } from './dmp-blueprint-editor.resolver';
|
||||||
import { DmpBlueprintEditorService } from './dmp-blueprint-editor.service';
|
import { DmpBlueprintEditorService } from './dmp-blueprint-editor.service';
|
||||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||||
import { SemanticsService } from '@app/core/services/semantic/semantics.service';
|
import { SemanticsService } from '@app/core/services/semantic/semantics.service';
|
||||||
|
import { PrefillingSourceService } from '@app/core/services/prefilling-source/prefilling-source.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -124,7 +125,8 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
||||||
private matomoService: MatomoService,
|
private matomoService: MatomoService,
|
||||||
public descriptionTemplateService: DescriptionTemplateService,
|
public descriptionTemplateService: DescriptionTemplateService,
|
||||||
public referenceTypeService: ReferenceTypeService,
|
public referenceTypeService: ReferenceTypeService,
|
||||||
public semanticsService: SemanticsService
|
public semanticsService: SemanticsService,
|
||||||
|
public prefillingSourceService: PrefillingSourceService
|
||||||
) {
|
) {
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService);
|
||||||
}
|
}
|
||||||
|
@ -223,7 +225,6 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
||||||
|
|
||||||
formSubmit(): void {
|
formSubmit(): void {
|
||||||
this.formService.touchAllFormFields(this.formGroup);
|
this.formService.touchAllFormFields(this.formGroup);
|
||||||
console.log(this.formGroup);
|
|
||||||
if (!this.isFormValid()) {
|
if (!this.isFormValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,7 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef
|
||||||
fields: FieldInSectionEditorModel[] = [];
|
fields: FieldInSectionEditorModel[] = [];
|
||||||
hasTemplates: boolean;
|
hasTemplates: boolean;
|
||||||
descriptionTemplates?: DescriptionTemplatesInSectionEditorModel[] = [];
|
descriptionTemplates?: DescriptionTemplatesInSectionEditorModel[] = [];
|
||||||
|
prefillingSourcesIds: Guid[]= [];
|
||||||
|
|
||||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||||
|
|
||||||
|
@ -189,6 +190,7 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef
|
||||||
this.hasTemplates = item.hasTemplates;
|
this.hasTemplates = item.hasTemplates;
|
||||||
if (item.fields) { item.fields.map(x => this.fields.push(new FieldInSectionEditorModel(this.validationErrorModel).fromModel(x))); }
|
if (item.fields) { item.fields.map(x => this.fields.push(new FieldInSectionEditorModel(this.validationErrorModel).fromModel(x))); }
|
||||||
if (item.descriptionTemplates) { item.descriptionTemplates.map(x => this.descriptionTemplates.push(new DescriptionTemplatesInSectionEditorModel(this.validationErrorModel).fromModel(x))); }
|
if (item.descriptionTemplates) { item.descriptionTemplates.map(x => this.descriptionTemplates.push(new DescriptionTemplatesInSectionEditorModel(this.validationErrorModel).fromModel(x))); }
|
||||||
|
if (item.prefillingSources) this.prefillingSourcesIds = item.prefillingSources.map(x => x.id);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +229,8 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef
|
||||||
disabled: disabled
|
disabled: disabled
|
||||||
})
|
})
|
||||||
), context.getValidation('descriptionTemplates').validators
|
), context.getValidation('descriptionTemplates').validators
|
||||||
)
|
),
|
||||||
|
prefillingSourcesIds: [{ value: this.prefillingSourcesIds, disabled: disabled }, context.getValidation('prefillingSourcesIds').validators],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +249,7 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef
|
||||||
baseValidationArray.push({ key: 'hasTemplates', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}hasTemplates`)] });
|
baseValidationArray.push({ key: 'hasTemplates', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}hasTemplates`)] });
|
||||||
baseValidationArray.push({ key: 'fields', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}fields`)] });
|
baseValidationArray.push({ key: 'fields', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}fields`)] });
|
||||||
baseValidationArray.push({ key: 'descriptionTemplates', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}descriptionTemplates`)] });
|
baseValidationArray.push({ key: 'descriptionTemplates', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}descriptionTemplates`)] });
|
||||||
|
baseValidationArray.push({ key: 'prefillingSourcesIds', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}prefillingSourcesIds`)] });
|
||||||
baseValidationArray.push({ key: 'hash', validators: [] });
|
baseValidationArray.push({ key: 'hash', validators: [] });
|
||||||
|
|
||||||
baseContext.validation = baseValidationArray;
|
baseContext.validation = baseValidationArray;
|
||||||
|
@ -263,7 +267,7 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef
|
||||||
validationErrorModel
|
validationErrorModel
|
||||||
});
|
});
|
||||||
|
|
||||||
['id', 'label', 'ordinal', 'description', 'hasTemplates', 'hash'].forEach(keyField => {
|
['id', 'label', 'ordinal', 'description', 'hasTemplates', 'prefillingSourcesIds', 'hash'].forEach(keyField => {
|
||||||
const control = formGroup?.get(keyField);
|
const control = formGroup?.get(keyField);
|
||||||
control?.clearValidators();
|
control?.clearValidators();
|
||||||
control?.addValidators(context.getValidation(keyField).validators);
|
control?.addValidators(context.getValidation(keyField).validators);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||||
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||||
|
import { PrefillingSource } from '@app/core/model/prefilling-source/prefilling-source';
|
||||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||||
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
|
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
|
||||||
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
|
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
|
||||||
|
@ -46,6 +47,10 @@ export class DmpBlueprintEditorResolver extends BaseEditorResolver {
|
||||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.label)].join('.'),
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.label)].join('.'),
|
||||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.minMultiplicity)].join('.'),
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.minMultiplicity)].join('.'),
|
||||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.maxMultiplicity)].join('.'),
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.maxMultiplicity)].join('.'),
|
||||||
|
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.prefillingSources), nameof<PrefillingSource>(x => x.id)].join('.'),
|
||||||
|
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.prefillingSources), nameof<PrefillingSource>(x => x.label)].join('.'),
|
||||||
|
|
||||||
nameof<DmpBlueprint>(x => x.createdAt),
|
nameof<DmpBlueprint>(x => x.createdAt),
|
||||||
nameof<DmpBlueprint>(x => x.hash),
|
nameof<DmpBlueprint>(x => x.hash),
|
||||||
nameof<DmpBlueprint>(x => x.isActive)
|
nameof<DmpBlueprint>(x => x.isActive)
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<app-external-fetcher-source-component [formGroup]="formGroup.get('definition').get('searchConfiguration')" [validationErrorModel]="editorModel.validationErrorModel" [validationRootPath]="'definition.searchConfiguration.'"></app-external-fetcher-source-component>
|
<app-external-fetcher-source-component [formGroup]="formGroup.get('definition').get('searchConfiguration')" [validationErrorModel]="editorModel.validationErrorModel" [validationRootPath]="'definition.searchConfiguration.'"></app-external-fetcher-source-component>
|
||||||
<div>
|
<div>
|
||||||
<mat-checkbox [formControl]="formGroup.get('definition').get('getEnabled')">
|
<mat-checkbox [formControl]="formGroup.get('definition').get('getEnabled')" (change)="getEnabledChanged($event)">
|
||||||
{{'PREFILLING-SOURCE-EDITOR.FIELDS.GET-SOURCE-CONFIGURATION' | translate}}
|
{{'PREFILLING-SOURCE-EDITOR.FIELDS.GET-SOURCE-CONFIGURATION' | translate}}
|
||||||
<mat-error *ngIf="formGroup.get('definition').get('getEnabled').hasError('backendError')">{{formGroup.get('definition').get('getEnabled').getError('backendError').message}}</mat-error>
|
<mat-error *ngIf="formGroup.get('definition').get('getEnabled').hasError('backendError')">{{formGroup.get('definition').get('getEnabled').getError('backendError').message}}</mat-error>
|
||||||
<mat-error *ngIf="formGroup.get('definition').get('getEnabled').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('definition').get('getEnabled').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
|
|
|
@ -25,9 +25,10 @@ import { TranslateService } from '@ngx-translate/core';
|
||||||
import { map, takeUntil } from 'rxjs/operators';
|
import { map, takeUntil } from 'rxjs/operators';
|
||||||
import { PrefillingSourceEditorResolver } from './prefilling-source-editor.resolver';
|
import { PrefillingSourceEditorResolver } from './prefilling-source-editor.resolver';
|
||||||
import { PrefillingSourceEditorService } from './prefilling-source-editor.service';
|
import { PrefillingSourceEditorService } from './prefilling-source-editor.service';
|
||||||
import { PrefillingSourceEditorModel } from './prefilling-source-editor.model';
|
import { PrefillingSourceDefinitionEditorModel, PrefillingSourceEditorModel } from './prefilling-source-editor.model';
|
||||||
import { ResultFieldsMappingConfigurationEditorModel } from '@app/ui/external-fetcher/external-fetcher-source-editor.model';
|
import { ResultFieldsMappingConfigurationEditorModel } from '@app/ui/external-fetcher/external-fetcher-source-editor.model';
|
||||||
import { SemanticsService } from '@app/core/services/semantic/semantics.service';
|
import { SemanticsService } from '@app/core/services/semantic/semantics.service';
|
||||||
|
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-prefilling-source-editor-component',
|
selector: 'app-prefilling-source-editor-component',
|
||||||
|
@ -110,9 +111,6 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
||||||
this.addFieldMapping("label", "searchConfiguration");
|
this.addFieldMapping("label", "searchConfiguration");
|
||||||
this.addFieldMapping("description", "searchConfiguration");
|
this.addFieldMapping("description", "searchConfiguration");
|
||||||
|
|
||||||
this.addFieldMapping("prefilling_id", "getConfiguration");
|
|
||||||
this.addFieldMapping("label", "getConfiguration");
|
|
||||||
this.addFieldMapping("description", "getConfiguration");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshData(): void {
|
refreshData(): void {
|
||||||
|
@ -145,6 +143,12 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
||||||
}
|
}
|
||||||
|
|
||||||
formSubmit(): void {
|
formSubmit(): void {
|
||||||
|
PrefillingSourceEditorModel.reApplyDefinitionValidators(
|
||||||
|
{
|
||||||
|
formGroup: this.formGroup,
|
||||||
|
validationErrorModel: this.editorModel.validationErrorModel
|
||||||
|
}
|
||||||
|
)
|
||||||
this.formService.touchAllFormFields(this.formGroup);
|
this.formService.touchAllFormFields(this.formGroup);
|
||||||
// if (!this.isFormValid()) {
|
// if (!this.isFormValid()) {
|
||||||
// return;
|
// return;
|
||||||
|
@ -181,6 +185,18 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
||||||
this.formService.validateAllFormFields(this.formGroup);
|
this.formService.validateAllFormFields(this.formGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getEnabledChanged(event: MatCheckboxChange){
|
||||||
|
if(event.checked == true){
|
||||||
|
const definition = new PrefillingSourceDefinitionEditorModel(this.editorModel.validationErrorModel);
|
||||||
|
definition.buildGetConfiguration(this.formGroup.get('definition') as UntypedFormGroup, "definition.");
|
||||||
|
|
||||||
|
this.addFieldMapping("prefilling_id", "getConfiguration");
|
||||||
|
this.addFieldMapping("label", "getConfiguration");
|
||||||
|
this.addFieldMapping("description", "getConfiguration");
|
||||||
|
this.submitFields();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// fields
|
// fields
|
||||||
|
@ -206,7 +222,7 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
||||||
fieldForm.markAsDirty();
|
fieldForm.markAsDirty();
|
||||||
|
|
||||||
this.removeFieldMapping((this.formGroup.get('definition').get('searchConfiguration') as FormGroup), fieldCode);
|
this.removeFieldMapping((this.formGroup.get('definition').get('searchConfiguration') as FormGroup), fieldCode);
|
||||||
this.removeFieldMapping((this.formGroup.get('definition').get('getConfiguration') as FormGroup), fieldCode);
|
if(this.formGroup.get('definition').get('getEnabled').value == true) this.removeFieldMapping((this.formGroup.get('definition').get('getConfiguration') as FormGroup), fieldCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
submitFields(): void {
|
submitFields(): void {
|
||||||
|
@ -216,7 +232,7 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
||||||
for (let i = 0; i < fieldsFormArray.length; i++) {
|
for (let i = 0; i < fieldsFormArray.length; i++) {
|
||||||
const code = fieldsFormArray.at(i).get('code').value;
|
const code = fieldsFormArray.at(i).get('code').value;
|
||||||
this.addFieldMapping(code, "searchConfiguration");
|
this.addFieldMapping(code, "searchConfiguration");
|
||||||
this.addFieldMapping(code, "getConfiguration");
|
if(this.formGroup.get('definition').get('getEnabled').value == true) this.addFieldMapping(code, "getConfiguration");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { Validation, ValidationContext } from "@common/forms/validation/validati
|
||||||
|
|
||||||
export class PrefillingSourceEditorModel extends BaseEditorModel implements PrefillingSourcePersist {
|
export class PrefillingSourceEditorModel extends BaseEditorModel implements PrefillingSourcePersist {
|
||||||
label: string;
|
label: string;
|
||||||
definition: PrefillingSourceDefinitionEditorModel = new PrefillingSourceDefinitionEditorModel();
|
definition: PrefillingSourceDefinitionEditorModel = new PrefillingSourceDefinitionEditorModel(this.validationErrorModel);
|
||||||
permissions: string[];
|
permissions: string[];
|
||||||
|
|
||||||
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
|
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
|
||||||
|
@ -57,9 +57,9 @@ export class PrefillingSourceEditorModel extends BaseEditorModel implements Pref
|
||||||
}): void {
|
}): void {
|
||||||
|
|
||||||
const { formGroup, validationErrorModel } = params;
|
const { formGroup, validationErrorModel } = params;
|
||||||
const control = formGroup?.get('definition');
|
|
||||||
PrefillingSourceDefinitionEditorModel.reapplyValidators({
|
PrefillingSourceDefinitionEditorModel.reapplyValidators({
|
||||||
formArray: control.get('fields') as UntypedFormArray,
|
formGroup: formGroup?.get('definition') as UntypedFormGroup,
|
||||||
rootPath: `definition.`,
|
rootPath: `definition.`,
|
||||||
validationErrorModel: validationErrorModel
|
validationErrorModel: validationErrorModel
|
||||||
});
|
});
|
||||||
|
@ -73,7 +73,7 @@ export class PrefillingSourceEditorModel extends BaseEditorModel implements Pref
|
||||||
|
|
||||||
export class PrefillingSourceDefinitionEditorModel implements PrefillingSourceDefinitionPersist {
|
export class PrefillingSourceDefinitionEditorModel implements PrefillingSourceDefinitionPersist {
|
||||||
fields: PrefillingSourceDefinitionFieldEditorModel[] = [];
|
fields: PrefillingSourceDefinitionFieldEditorModel[] = [];
|
||||||
searchConfiguration: ExternalFetcherBaseSourceConfigurationEditorModel = new ExternalFetcherBaseSourceConfigurationEditorModel();
|
searchConfiguration: ExternalFetcherBaseSourceConfigurationEditorModel = new ExternalFetcherBaseSourceConfigurationEditorModel(this.validationErrorModel);
|
||||||
getConfiguration: ExternalFetcherBaseSourceConfigurationEditorModel;
|
getConfiguration: ExternalFetcherBaseSourceConfigurationEditorModel;
|
||||||
getEnabled = false;
|
getEnabled = false;
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ export class PrefillingSourceDefinitionEditorModel implements PrefillingSourceDe
|
||||||
getEnabled: [{ value: this.getEnabled, disabled: disabled }, context.getValidation('getEnabled').validators],
|
getEnabled: [{ value: this.getEnabled, disabled: disabled }, context.getValidation('getEnabled').validators],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.getConfiguration != null) {
|
if (this.getEnabled == true) {
|
||||||
form.addControl('getConfiguration', this.getConfiguration.buildForm({
|
form.addControl('getConfiguration', this.getConfiguration.buildForm({
|
||||||
rootPath: `${rootPath}getConfiguration.`
|
rootPath: `${rootPath}getConfiguration.`
|
||||||
}));
|
}));
|
||||||
|
@ -130,6 +130,17 @@ export class PrefillingSourceDefinitionEditorModel implements PrefillingSourceDe
|
||||||
return form;
|
return form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildGetConfiguration(
|
||||||
|
form: UntypedFormGroup,
|
||||||
|
rootPath?: string
|
||||||
|
){
|
||||||
|
form.addControl('getConfiguration', new ExternalFetcherBaseSourceConfigurationEditorModel(this.validationErrorModel)
|
||||||
|
.buildForm({
|
||||||
|
rootPath: `${rootPath}getConfiguration.`
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static createValidationContext(params: {
|
static createValidationContext(params: {
|
||||||
rootPath?: string,
|
rootPath?: string,
|
||||||
validationErrorModel: ValidationErrorModel
|
validationErrorModel: ValidationErrorModel
|
||||||
|
@ -148,18 +159,32 @@ export class PrefillingSourceDefinitionEditorModel implements PrefillingSourceDe
|
||||||
}
|
}
|
||||||
|
|
||||||
static reapplyValidators(params: {
|
static reapplyValidators(params: {
|
||||||
formArray: UntypedFormArray,
|
formGroup: UntypedFormGroup,
|
||||||
validationErrorModel: ValidationErrorModel,
|
validationErrorModel: ValidationErrorModel,
|
||||||
rootPath: string
|
rootPath: string
|
||||||
}): void {
|
}): void {
|
||||||
const { validationErrorModel, rootPath, formArray } = params;
|
const { validationErrorModel, rootPath, formGroup } = params;
|
||||||
formArray?.controls?.forEach(
|
(formGroup.get('fields') as UntypedFormArray).controls?.forEach(
|
||||||
(control, index) => PrefillingSourceDefinitionFieldEditorModel.reapplyValidators({
|
(control, index) => PrefillingSourceDefinitionFieldEditorModel.reapplyValidators({
|
||||||
formGroup: control as UntypedFormGroup,
|
formGroup: control as UntypedFormGroup,
|
||||||
rootPath: `${rootPath}fields[${index}].`,
|
rootPath: `${rootPath}fields[${index}].`,
|
||||||
validationErrorModel: validationErrorModel
|
validationErrorModel: validationErrorModel
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ExternalFetcherBaseSourceConfigurationEditorModel.reapplyValidators({
|
||||||
|
formGroup: formGroup.get('searchConfiguration') as UntypedFormGroup,
|
||||||
|
rootPath: `${rootPath}searchConfiguration.`,
|
||||||
|
validationErrorModel: validationErrorModel
|
||||||
|
});
|
||||||
|
|
||||||
|
if(formGroup.get('getEnabled').value == true){
|
||||||
|
ExternalFetcherBaseSourceConfigurationEditorModel.reapplyValidators({
|
||||||
|
formGroup: formGroup.get('getConfiguration') as UntypedFormGroup,
|
||||||
|
rootPath: `${rootPath}getConfiguration.`,
|
||||||
|
validationErrorModel: validationErrorModel
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||||
import { QueryCaseConfigEditorModel, QueryConfigEditorModel, StaticOptionEditorModel } from './external-fetcher-source-editor.model';
|
import { ExternalFetcherBaseSourceConfigurationEditorModel, QueryCaseConfigEditorModel, QueryConfigEditorModel, StaticOptionEditorModel } from './external-fetcher-source-editor.model';
|
||||||
import { Guid } from '@common/types/guid';
|
import { Guid } from '@common/types/guid';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -34,7 +34,16 @@ export class ExternalFetcherSourceComponent extends BaseComponent implements OnI
|
||||||
) { super(); }
|
) { super(); }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
console.log(this.referenceTypeSourceIndex);
|
}
|
||||||
|
|
||||||
|
private reApplyValidators(){
|
||||||
|
ExternalFetcherBaseSourceConfigurationEditorModel.reapplyValidators(
|
||||||
|
{
|
||||||
|
formGroup: this.formGroup,
|
||||||
|
validationErrorModel: this.validationErrorModel,
|
||||||
|
rootPath: this.validationRootPath
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -51,6 +60,8 @@ export class ExternalFetcherSourceComponent extends BaseComponent implements OnI
|
||||||
removeQuery(queryIndex: number): void {
|
removeQuery(queryIndex: number): void {
|
||||||
const formArray = (this.formGroup.get('queries') as FormArray);
|
const formArray = (this.formGroup.get('queries') as FormArray);
|
||||||
formArray.removeAt(queryIndex);
|
formArray.removeAt(queryIndex);
|
||||||
|
this.reApplyValidators();
|
||||||
|
formArray.markAsDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// cases
|
// cases
|
||||||
|
@ -65,6 +76,8 @@ export class ExternalFetcherSourceComponent extends BaseComponent implements OnI
|
||||||
removeCase(queryIndex: number, index: number): void {
|
removeCase(queryIndex: number, index: number): void {
|
||||||
const formArray = (this.formGroup.get('queries') as FormArray).at(queryIndex).get('cases') as FormArray;
|
const formArray = (this.formGroup.get('queries') as FormArray).at(queryIndex).get('cases') as FormArray;
|
||||||
formArray.removeAt(index);
|
formArray.removeAt(index);
|
||||||
|
this.reApplyValidators();
|
||||||
|
formArray.markAsDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
|
@ -88,6 +101,8 @@ export class ExternalFetcherSourceComponent extends BaseComponent implements OnI
|
||||||
removeOption(optionIndex: number): void {
|
removeOption(optionIndex: number): void {
|
||||||
const formArray = (this.formGroup.get('options') as FormArray);
|
const formArray = (this.formGroup.get('options') as FormArray);
|
||||||
formArray.removeAt(optionIndex);
|
formArray.removeAt(optionIndex);
|
||||||
|
this.reApplyValidators();
|
||||||
|
formArray.markAsDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
setReferenceTypeDependenciesMap(ids: Guid[], index: number){
|
setReferenceTypeDependenciesMap(ids: Guid[], index: number){
|
||||||
|
|
|
@ -1681,7 +1681,8 @@
|
||||||
"OPTIONS-ROOT": "Options Root",
|
"OPTIONS-ROOT": "Options Root",
|
||||||
"LABEL": "Label",
|
"LABEL": "Label",
|
||||||
"VALUE": "Value"
|
"VALUE": "Value"
|
||||||
}
|
},
|
||||||
|
"PREFILLING-SOURCES":"Prefilling Sources"
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
"ADD-FIELD": "Add Field",
|
"ADD-FIELD": "Add Field",
|
||||||
|
@ -2364,11 +2365,11 @@
|
||||||
"TEXT": "Text",
|
"TEXT": "Text",
|
||||||
"DATE": "Date"
|
"DATE": "Date"
|
||||||
},
|
},
|
||||||
"REFERENCE-TYPE-SOURCE-TYPE": {
|
"EXTERNAL-FETCHER-SOURCE-TYPE": {
|
||||||
"API": "API",
|
"API": "API",
|
||||||
"STATIC": "Static"
|
"STATIC": "Static"
|
||||||
},
|
},
|
||||||
"REFERENCE-TYPE-EXTERNAL-API-HTTP-METHOD-TYPE": {
|
"EXTERNAL-FETCHER-API-HTTP-METHOD-TYPE": {
|
||||||
"GET": "GET",
|
"GET": "GET",
|
||||||
"POST": "POST"
|
"POST": "POST"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue