diff --git a/dmp-frontend/src/app/core/query/description.lookup.ts b/dmp-frontend/src/app/core/query/description.lookup.ts index 305c5fc94..cfdd72cd9 100644 --- a/dmp-frontend/src/app/core/query/description.lookup.ts +++ b/dmp-frontend/src/app/core/query/description.lookup.ts @@ -5,10 +5,7 @@ import { DescriptionStatus } from '../common/enum/description-status'; import { DmpLookup } from './dmp.lookup'; import { DmpUserRole } from '../common/enum/dmp-user-role'; import { DescriptionTag } from '../model/description/description'; -import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms'; import { ReferenceType } from '../model/reference-type/reference-type'; -import { Reference } from '../model/reference/reference'; -import { ReferenceTypeLookup } from './reference-type.lookup'; import { DescriptionReferenceLookup, ReferenceLookup } from './reference.lookup'; export class DescriptionLookup extends Lookup implements DescriptionFilter { @@ -56,7 +53,7 @@ export interface DescriptionFilter { export class ReferencesWithType { referenceType: ReferenceType; - references: Reference[]; + references: Guid[]; constructor() { } 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 6b5fb3c91..6178eef72 100644 --- a/dmp-frontend/src/app/core/services/reference/reference.service.ts +++ b/dmp-frontend/src/app/core/services/reference/reference.service.ts @@ -150,18 +150,6 @@ export class ReferenceService { }; } - public getInternalMultipleAutoCompleteConfiguration(typeId: Guid, dependencyReferences: Reference[]): MultipleAutoCompleteConfiguration { - return { - initialItems: (excludedItems: any[], data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, dependencyReferences, null)).pipe(map(x => x.filter(r => r.sourceType == ReferenceSourceType.Internal))).pipe(map(x => x)), - filterFn: (searchQuery: string, excludedItems: any[]) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, dependencyReferences, searchQuery)).pipe(map(x => x.filter(r => r.sourceType == ReferenceSourceType.Internal))).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'), - valueAssign: (item: Reference) => item, - uniqueAssign: (item: Reference) => item.source + '_' + item.reference, - }; - } - private buildAutocompleteSearchLookup(typeId: Guid, dependencyReferences: Reference[], like?: string): ReferenceSearchLookup { const lookup: ReferenceSearchLookup = new ReferenceSearchLookup(); lookup.page = { size: 100, offset: 0 }; diff --git a/dmp-frontend/src/app/ui/description/listing/description-listing.component.html b/dmp-frontend/src/app/ui/description/listing/description-listing.component.html index 7aeae1213..d8427e6fc 100644 --- a/dmp-frontend/src/app/ui/description/listing/description-listing.component.html +++ b/dmp-frontend/src/app/ui/description/listing/description-listing.component.html @@ -29,7 +29,8 @@ -
+
diff --git a/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts b/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts index 2669e543c..1174c0107 100644 --- a/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts +++ b/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts @@ -382,10 +382,15 @@ export class DescriptionListingComponent extends BaseListingComponent reference.referenceType != null && reference.references?.length > 0) - ?.flatMap((referencesWithType: ReferencesWithType) => referencesWithType.references?.map(reference => reference.id)) as Guid[]; + ?.flatMap((referencesWithType: ReferencesWithType) => referencesWithType.references) as Guid[]; + + if (references && references?.length > 0) { + lookup.descriptionReferenceSubQuery = this.initializeReferenceLookup(); + lookup.descriptionReferenceSubQuery.referenceIds = references; + } else lookup.descriptionReferenceSubQuery = null; return lookup; } diff --git a/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.ts b/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.ts index 10d688811..0a646ef5e 100644 --- a/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.ts +++ b/dmp-frontend/src/app/ui/description/listing/filtering/description-filter.component.ts @@ -167,7 +167,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent implements }; getReferenceAutocompleteConfiguration(referenceTypeId: Guid, excludedIds: Reference[]): MultipleAutoCompleteConfiguration { - let autocomplete = this.referenceService.getInternalMultipleAutoCompleteConfiguration(referenceTypeId, excludedIds); + let autocomplete = this.referenceService.getMultipleAutoCompleteQueryConfiguration([referenceTypeId]); return autocomplete; };