From 64fd1449b9563839528a0abc3689fab3bfd239c3 Mon Sep 17 00:00:00 2001 From: Sofia Papacharalampous Date: Thu, 27 Jun 2024 16:03:29 +0300 Subject: [PATCH] removed preview button from dmp-description-template filter --- .../description-template.service.ts | 14 ++++++++++++++ .../dmp/listing/filtering/dmp-filter.component.ts | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dmp-frontend/src/app/core/services/description-template/description-template.service.ts b/dmp-frontend/src/app/core/services/description-template/description-template.service.ts index 638545d98..053d1a266 100644 --- a/dmp-frontend/src/app/core/services/description-template/description-template.service.ts +++ b/dmp-frontend/src/app/core/services/description-template/description-template.service.ts @@ -170,6 +170,20 @@ export class DescriptionTemplateService { popupItemActionIcon: 'visibility' }; + public buildDescriptionTempalteGroupMultipleAutocompleteConfiguration(preview: boolean = false): MultipleAutoCompleteConfiguration { + + return { + initialItems: (excludedItems: any[], data?: any) => this.query(this.buildDescriptionTempalteGroupAutocompleteLookup([IsActive.Active], null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)), + filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildDescriptionTempalteGroupAutocompleteLookup([IsActive.Active], searchQuery, excludedItems)).pipe(map(x => x.items)), + getSelectedItems: (selectedItems: any[]) => this.query(this.buildDescriptionTempalteGroupAutocompleteLookup([IsActive.Active, IsActive.Inactive], null, null, selectedItems)).pipe(map(x => x.items)), + displayFn: (item: DescriptionTemplate) => item.label, + titleFn: (item: DescriptionTemplate) => item.label, + subtitleFn: (item: DescriptionTemplate) => item.description, + valueAssign: (item: DescriptionTemplate) => item.groupId, + popupItemActionIcon: preview ? 'visibility' : null, + }; + } + public buildDescriptionTempalteGroupAutocompleteLookup(isActive: IsActive[], like?: string, excludedIds?: Guid[], groupIds?: Guid[], excludedGroupIds?: Guid[]): DescriptionTemplateLookup { const lookup: DescriptionTemplateLookup = new DescriptionTemplateLookup(); lookup.page = { size: 100, offset: 0 }; diff --git a/dmp-frontend/src/app/ui/dmp/listing/filtering/dmp-filter.component.ts b/dmp-frontend/src/app/ui/dmp/listing/filtering/dmp-filter.component.ts index 127d075e4..29214b12d 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/filtering/dmp-filter.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/filtering/dmp-filter.component.ts @@ -65,7 +65,7 @@ export class DmpFilterComponent extends BaseCriteriaComponent implements OnInit, ngOnChanges(changes: SimpleChanges): void { if (changes['filterFormGroup']) { - this.descriptionTemplateAutoCompleteConfiguration = this.descriptionTemplateService.descriptionTempalteGroupMultipleAutocompleteConfiguration; + this.descriptionTemplateAutoCompleteConfiguration = this.descriptionTemplateService.buildDescriptionTempalteGroupMultipleAutocompleteConfiguration(); this.dmpBlueprintAutoCompleteConfiguration = this.dmpBlueprintService.multipleAutocompleteConfiguration; this.referenceTypeAutocompleteConfiguration = this.getReferenceTypeAutocompleteConfiguration(); this.referenceAutocompleteConfiguration = new Map();