diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/QueryCaseConfigEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/QueryCaseConfigEntity.java index c863c4181..ff24ac15d 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/QueryCaseConfigEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/externalfetcher/QueryCaseConfigEntity.java @@ -19,7 +19,7 @@ public class QueryCaseConfigEntity implements QueryCaseConfig { return referenceTypeSourceKey; } - @XmlElement(name = "defaultValue") + @XmlElement(name = "referenceTypeSourceKey") public void setReferenceTypeSourceKey(String referenceTypeSourceKey) { this.referenceTypeSourceKey = referenceTypeSourceKey; } @@ -29,7 +29,7 @@ public class QueryCaseConfigEntity implements QueryCaseConfig { return referenceTypeId; } - @XmlElement(name = "referenceTypeSourceKey") + @XmlElement(name = "referenceTypeId") public void setReferenceTypeId(UUID referenceTypeId) { this.referenceTypeId = referenceTypeId; } diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeDefinitionBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeDefinitionBuilder.java index f90cfd793..bd674ef5f 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeDefinitionBuilder.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/referencetypedefinition/ReferenceTypeDefinitionBuilder.java @@ -63,7 +63,7 @@ public class ReferenceTypeDefinitionBuilder extends BaseBuilder()); m.getSources().addAll(this.builderFactory.builder(ExternalFetcherApiSourceConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, externalApiConfigEntities)); m.getSources().addAll(this.builderFactory.builder(ExternalFetcherStaticOptionSourceConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, staticOptionConfigEntities)); - m.getSources().sort(Comparator.comparing(ExternalFetcherBaseSourceConfiguration::getOrdinal)); + m.getSources().sort(Comparator.comparing(x -> x.getOrdinal() == null ? 0 : x.getOrdinal())); } models.add(m); } diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java index 3ce4f2779..a11793f8f 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java @@ -184,8 +184,12 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService { if (dependencyReference != null){ for (Field field : dependencyReference.getDefinition().getFields()){ - filterValue = filterValue.replaceAll("{" + field.getCode() + "}", field.getValue()); + filterValue = filterValue.replaceAll("\\{" + field.getCode() + "}", field.getValue()); } + filterValue = filterValue.replaceAll("\\{" + Reference._reference + "}", dependencyReference.getReference()); + filterValue = filterValue.replaceAll("\\{" + Reference._label + "}", dependencyReference.getLabel()); + filterValue = filterValue.replaceAll("\\{" + Reference._source + "}", dependencyReference.getSource()); + } } else if (!this.conventionService.isNullOrEmpty(likeValue)) { if (caseConfig.getSeparator() != null) { diff --git a/dmp-db-scema/updates/00.01.060_Insert_values.sql b/dmp-db-scema/updates/00.01.060_Insert_values.sql index b58a054ec..51af89249 100644 --- a/dmp-db-scema/updates/00.01.060_Insert_values.sql +++ b/dmp-db-scema/updates/00.01.060_Insert_values.sql @@ -25,7 +25,7 @@ BEGIN INSERT INTO public."ReferenceType" VALUES ('51225b6a-86a6-48ac-9192-f15096dbcb8a', 'publications', 'publications', 'openaire100falseapplication/json;charset=UTF-8remote00$[''meta''][''pagination''][''page'',''pages'',''count'']{like}*likereference_idoriginalIdlabeltitledescriptiontitlepid[''pid''][''content'']pidTypeField[''pid''][''classid'']$[''results''][*][''result''][''metadata''][''oaf:entity''][''oaf:result'']https://services.openaire.eu/search/v2/api/resources?query=oaftype exact result and {like}&page={page}&size={pageSize}&format=json', 1, '2023-11-16 13:07:20.591433', '2024-02-19 08:23:49.91191', NULL); INSERT INTO public."ReferenceType" VALUES ('538928bb-c7c6-452e-b66d-08e539f5f082', 'funders', 'funders', 'openaire101falseapplication/json; charset=utf-8local00$[*]reference_ididlabelnamedescriptionname$[''refineResults''][''relfunder''][*]https://services.openaire.eu/search/v2/api/publications?&refine=true&fields=relfunder&page={page}&size=0&format=json', 1, '2023-11-16 11:22:57.942097', '2024-02-16 09:16:19.195353', NULL); INSERT INTO public."ReferenceType" VALUES ('5a2112e7-ea99-4cfe-98a1-68665e26726e', 'researchers', 'researchers', 'orcid100falseapplication/json; charset=UTF-8remote00$[''num-found'']^[A-Za-z0-9]+ [A-Za-z0-9]+$ ((given-names:{like1}+AND+family-name:{like2})+OR+(given-names:{like2}+AND+family-name:{like1}))\d{4}-\d{4}-\d{4}-\d{4}orcid:{like}.+given-names:{like}+OR+family-name:{like}*likereference_idorcid-idlabel@{{given-names}} @{{family-names}} (@{{orcid-id}})descriptioninstitution-namefistNamegiven-nameslastNamefamily-names$[''expanded-result''][*]https://pub.orcid.org/v3.0/expanded-search/?q={like}&start={page}&rows={pageSize}', 1, '2023-11-16 18:21:43.272982', '2024-04-17 09:44:53.656849', NULL); - INSERT INTO public."ReferenceType" VALUES ('5b9c284f-f041-4995-96cc-fad7ad13289c', 'grants', 'grants', 'openaire1538928bb-c7c6-452e-b66d-08e539f5f08200falseapplication/json; charset=utf-8remote00$[''meta''][''pagination''][''page'',''pages'',''count'']538928bb-c7c6-452e-b66d-08e539f5f082openaire{like}*likereference_idoriginalIdlabeltitledescriptiontitle$[''results''][*][''result''][''metadata''][''oaf:entity''][''oaf:project'']https://services.openaire.eu/search/v2/api/resources?query=((oaftype exact project) and ((projectcode_nt exact "{like}")or({like})))&page={page}&size={pageSize}&format=json', 1, '2023-11-16 16:41:53.106646', '2024-02-19 12:33:49.420526', NULL); + INSERT INTO public."ReferenceType" VALUES ('5b9c284f-f041-4995-96cc-fad7ad13289c', 'grants', 'grants', 'openaire1538928bb-c7c6-452e-b66d-08e539f5f08200falseapplication/json; charset=utf-8remote00$[''meta''][''pagination''][''page'',''pages'',''count'']{like}*like&fq=(funder exact "{reference}")538928bb-c7c6-452e-b66d-08e539f5f082openairefunderQueryreference_idoriginalIdlabeltitledescriptiontitle$[''results''][*][''result''][''metadata''][''oaf:entity''][''oaf:project'']https://services.openaire.eu/search/v2/api/resources?query=((oaftype exact project) and ((projectcode_nt exact "{like}")or({like}))){funderQuery}&page={page}&size={pageSize}&format=json', 1, '2023-11-16 16:41:53.106646', '2024-04-17 13:13:30.853978', NULL); INSERT INTO public."ReferenceType" VALUES ('7eeffb98-58fb-4921-82ec-e27f32f8e738', 'organisations', 'organisations', 'openaire100falseapplication/json; charset=utf-8remote00$[''meta''][''pagination''][''page'',''pages'',''count'']{like}likereference_idoriginalIdlabellegalnamedescriptionlegalnamepid[''pid''][''content'']pidTypeField[''pid''][''classid'']$[''results''][*][''result''][''metadata''][''oaf:entity''][''oaf:organization'']https://services.openaire.eu/search/v2/api/organizations/?q={like}&page={page}&size={pageSize}&format=json', 1, '2023-11-17 10:13:15.873808', '2024-02-16 15:35:47.874131', NULL); INSERT INTO public."ReferenceType" VALUES ('8ec7556b-749d-4c4a-a4b9-43d064693795', 'journals', 'journals', 'openaire100falseapplication/jsonremote01$[''meta''][''pagination''][''page'',''pages'',''count'']{like}like{"officialname": "{like}", "typology":"journal"}reference_ididlabelofficialnamedescriptionofficialname$[''datasourceInfo''][*]https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING', 1, '2023-11-16 17:40:12.811667', '2024-02-16 09:09:22.816978', NULL); INSERT INTO public."ReferenceType" VALUES ('9ec2000d-95c7-452e-b356-755fc8e2574c', 'services', 'services', 'eosc100falseapplication/json; charset=utf-8remote00$[''from'',''to'',''total'']{like}likereference_ididlabelnamedescriptiondescriptionuriwebpage$[''results''][*]https://providers.eosc-portal.eu/api/service/all?query={like}&from={page}&quantity={pageSize}', 1, '2023-11-16 17:57:22.081053', '2024-02-16 09:07:13.944104', NULL); diff --git a/dmp-frontend/src/app/core/services/reference/reference.service.ts b/dmp-frontend/src/app/core/services/reference/reference.service.ts index bca337b17..fcd8d72b7 100644 --- a/dmp-frontend/src/app/core/services/reference/reference.service.ts +++ b/dmp-frontend/src/app/core/services/reference/reference.service.ts @@ -118,10 +118,10 @@ export class ReferenceService { // // Autocomplete Commons - Search // - public getSingleAutocompleteSearchConfiguration(typeId: Guid): SingleAutoCompleteConfiguration { + public getSingleAutocompleteSearchConfiguration(typeId: Guid, dependencyReferences: Reference[]): SingleAutoCompleteConfiguration { return { - initialItems: (data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId)).pipe(map(x => x)), - filterFn: (searchQuery: string, data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, searchQuery)).pipe(map(x => x)), + initialItems: (data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, dependencyReferences)).pipe(map(x => x)), + filterFn: (searchQuery: string, data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, dependencyReferences, searchQuery)).pipe(map(x => x)), displayFn: (item: Reference) => item.label, subtitleFn: (item: Reference) => item?.sourceType === ReferenceSourceType.External ? this.language.instant('REFERENCE-FIELD-COMPONENT.EXTERNAL-SOURCE') + ': ' + item.source : this.language.instant('REFERENCE-FIELD-COMPONENT.INTERNAL-SOURCE'), titleFn: (item: Reference) => item.label, @@ -130,10 +130,10 @@ export class ReferenceService { }; }; - public getMultipleAutoCompleteSearchConfiguration(typeId: Guid): MultipleAutoCompleteConfiguration { + public getMultipleAutoCompleteSearchConfiguration(typeId: Guid, dependencyReferences: Reference[]): MultipleAutoCompleteConfiguration { return { - initialItems: (excludedItems: any[], data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, null)).pipe(map(x => x)), - filterFn: (searchQuery: string, excludedItems: any[]) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, searchQuery)).pipe(map(x => x)), + initialItems: (excludedItems: any[], data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, dependencyReferences, null)).pipe(map(x => x)), + filterFn: (searchQuery: string, excludedItems: any[]) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, dependencyReferences, searchQuery)).pipe(map(x => x)), displayFn: (item: Reference) => item.label, titleFn: (item: Reference) => item.label, subtitleFn: (item: Reference) => item?.sourceType === ReferenceSourceType.External ? this.language.instant('REFERENCE-FIELD-COMPONENT.EXTERNAL-SOURCE') + ': ' + item.source : this.language.instant('REFERENCE-FIELD-COMPONENT.INTERNAL-SOURCE'), @@ -142,7 +142,7 @@ export class ReferenceService { }; } - private buildAutocompleteSearchLookup(typeId: Guid, like?: string): ReferenceSearchLookup { + private buildAutocompleteSearchLookup(typeId: Guid, dependencyReferences: Reference[], like?: string): ReferenceSearchLookup { const lookup: ReferenceSearchLookup = new ReferenceSearchLookup(); lookup.page = { size: 100, offset: 0 }; lookup.project = { @@ -163,34 +163,7 @@ export class ReferenceService { ] }; lookup.typeId = typeId; - lookup.order = { items: [nameof(x => x.label)] }; - if (like) { lookup.like = this.filterService.transformLike(like); } - return lookup; - } - - private buildAutocompleteSearchSelectedItemsLookup(referenceTypeIds?: Guid[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup { - const lookup: ReferenceLookup = new ReferenceLookup(); - lookup.page = { size: 100, offset: 0 }; - if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } - if (ids && ids.length > 0) { lookup.ids = ids; } - lookup.isActive = [IsActive.Active]; - lookup.project = { - fields: [ - nameof(x => x.id), - nameof(x => x.label), - nameof(x => x.type), - nameof(x => x.description), - [nameof(x => x.definition), nameof(x => x.fields), nameof(x => x.code)].join('.'), - [nameof(x => x.definition), nameof(x => x.fields), nameof(x => x.dataType)].join('.'), - [nameof(x => x.definition), nameof(x => x.fields), nameof(x => x.value)].join('.'), - nameof(x => x.reference), - nameof(x => x.abbreviation), - nameof(x => x.source), - nameof(x => x.sourceType), - ] - }; - if (referenceTypeIds && referenceTypeIds.length > 0) { lookup.typeIds = referenceTypeIds; } - if (sourceTypes && sourceTypes.length > 0) { lookup.sourceTypes = sourceTypes; } + lookup.dependencyReferences = dependencyReferences; lookup.order = { items: [nameof(x => x.label)] }; if (like) { lookup.like = this.filterService.transformLike(like); } return lookup; diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html index a577c8820..4a286aa63 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html @@ -209,4 +209,4 @@ - \ No newline at end of file + diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html index 66a6bb93c..ea6723b88 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html @@ -250,7 +250,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.resolver.ts b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.resolver.ts index ea63a9e38..8dec1ecba 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.resolver.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.resolver.ts @@ -5,7 +5,8 @@ import { Description } from '@app/core/model/description/description'; import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { Dmp, DmpBlueprintValue, DmpContact, DmpDescriptionTemplate, DmpProperties, DmpUser } from '@app/core/model/dmp/dmp'; import { DmpReference, DmpReferenceData } from '@app/core/model/dmp/dmp-reference'; -import { ReferenceType } from '@app/core/model/reference-type/reference-type'; +import { ExternalFetcherBaseSourceConfiguration } from '@app/core/model/external-fetcher/external-fetcher'; +import { ReferenceType, ReferenceTypeDefinition } from '@app/core/model/reference-type/reference-type'; import { Reference } from '@app/core/model/reference/reference'; import { DmpAssociatedUser, User } from '@app/core/model/user/user'; import { DmpService } from '@app/core/services/dmp/dmp.service'; @@ -76,7 +77,7 @@ export class DmpEditorResolver extends BaseEditorResolver { [nameof(x => x.dmpReferences), nameof(x => x.data), nameof(x => x.blueprintFieldId)].join('.'), [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type)].join('.'), + [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.source)].join('.'), [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.reference)].join('.'), [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.sourceType)].join('.'), @@ -120,6 +121,7 @@ export class DmpEditorResolver extends BaseEditorResolver { (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.id)].join('.'), (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.name)].join('.'), (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.code)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.definition), nameof(x=> x.sources), nameof(x=> x.referenceTypeDependencies) , nameof(x => x.id)].join('.'), ] } diff --git a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html index f82199b98..0e7f05cdd 100644 --- a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html +++ b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html @@ -17,4 +17,4 @@
{{'REFERENCE-FIELD.COULD-NOT-FIND-MESSAGE' | translate}} {{'REFERENCE-FIELD.ACTIONS.INSERT-MANUALLY' | translate}} -
\ No newline at end of file +
diff --git a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts index 943eb3af0..e53f86a86 100644 --- a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts +++ b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts @@ -30,6 +30,8 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit { @Input() placeholder: string; @Input() dependencies: UntypedFormGroup = null; + referenceToUse: Reference[]= []; + referenceToUseInitialized = false; multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration; singleAutoCompleteSearchConfiguration: SingleAutoCompleteConfiguration; @@ -41,10 +43,66 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit { ) { super(); } ngOnInit() { - if (this.multiple) { - this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id); + const referenceDepedencyIds = this.referenceType.definition.sources.filter(x => x.referenceTypeDependencies).flatMap(x => x.referenceTypeDependencies).filter(x => x).map(x => x.id); + if (referenceDepedencyIds.length > 0) { + this.referenceToUseInitialized = false; + this.dependencies.valueChanges.pipe(takeUntil(this._destroyed)).subscribe(changes => { + this.resolveReferenceDepedency(referenceDepedencyIds); + }); + this.resolveReferenceDepedency(referenceDepedencyIds); } else { - this.singleAutoCompleteSearchConfiguration = this.referenceService.getSingleAutocompleteSearchConfiguration(this.referenceType.id); + if (this.multiple) { + this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id, null); + } else { + this.singleAutoCompleteSearchConfiguration = this.referenceService.getSingleAutocompleteSearchConfiguration(this.referenceType.id, null); + } + } + } + + resolveReferenceDepedency(referenceDepedencyIds: Guid[]) { + const referenceToUse : Reference[]= []; + Object.keys(this.dependencies.controls).forEach(controlName => { + // (this.dependencies.get(controlName).get('references').value as Reference[]).filter(x=> sourcesWithDependencies.some(y => y.referenceTypeDependencies) x.type.id == this.referenceType.id &&) + const foudReferences: any[] = this.dependencies.get(controlName).get('references')?.value; + if (foudReferences != null) { + for (let i = 0; i < foudReferences.length; i++) { + const foudReference = foudReferences[i]; + if (foudReference?.typeId && referenceDepedencyIds.includes(foudReference.typeId)) { + const typed = foudReference as ReferencePersist; + + referenceToUse.push({ + id: typed.id, + hash: typed.hash, + description: typed.description, + reference: typed.reference, + abbreviation: typed.abbreviation, + source: typed.source, + sourceType: typed.sourceType, + label: typed.label, + definition: typed.definition, + type: { + id: typed.typeId, + } + }) + } else if (foudReference?.type?.id && referenceDepedencyIds.includes(foudReference.type.id)) { + const typed = foudReference as Reference; + if (typed != null) referenceToUse.push(typed); + } + } + } + }); + if (this.referenceToUseInitialized && (!referenceToUse.map(x => x.reference).every(x => this.referenceToUse.map(y => y.reference).includes(x)) || + !this.referenceToUse.map(x => x.reference).every(x => referenceToUse.map(y => y.reference).includes(x)))) { + this.form.setValue(null, {onlySelf: true, emitEvent: false}); + } + + this.referenceToUse = referenceToUse; + this.referenceToUseInitialized = true; + + if (this.multiple) { + this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id, this.referenceToUse); + } else { + this.singleAutoCompleteSearchConfiguration = this.referenceService.getSingleAutocompleteSearchConfiguration(this.referenceType.id, this.referenceToUse); } } @@ -66,7 +124,7 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit { dialogRef.afterClosed() .pipe(takeUntil(this._destroyed)) .subscribe(newResult => { - if (!newResult) { return; } + if (!newResult) { return; } let results = this.form.value as ReferencePersist[]; if (results == undefined) results = []; results.push(newResult); @@ -87,14 +145,6 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit { lookup.typeId = typeId; lookup.order = { items: [nameof(x => x.label)] }; - // const sourcesWithDependencies = this.referenceType.definition.sources.filter(x => x.referenceTypeDependencies); - // if (sourcesWithDependencies.length > 0) { - // Object.keys(this.dependencies.controls).forEach(controlName => { - // (this.dependencies.get(controlName).get('references').value as Reference[]).filter(x=> sourcesWithDependencies.some(y => y.referenceTypeDependencies) x.type.id == this.referenceType.id &&) - // }); - // lookup.dependencyReferences = []; - // } - return lookup; } }