From 63e5cde3138a52338855901bdd6818cae18446ed Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 30 Nov 2023 17:28:05 +0200 Subject: [PATCH] fix listing filters --- .../query/description-template-type.lookup.ts | 3 ++ .../src/app/core/query/reference.lookup.ts | 4 +-- .../description-template-type.service.ts | 5 ++- .../services/reference/reference.service.ts | 20 +++++------ .../description-template-listing.component.ts | 7 ++++ ...on-template-listing-filters.component.html | 8 +++++ ...tion-template-listing-filters.component.ts | 15 +++++---- ...ription-template-type-listing.component.ts | 7 ++++ ...mplate-type-listing-filters.component.html | 8 +++++ ...template-type-listing-filters.component.ts | 15 ++++++--- ...p-blueprint-listing-filters.component.html | 10 ++++-- .../listing/language-listing.component.ts | 7 ++++ .../reference-type-listing.component.ts | 8 ++++- .../reference-listing-filters.component.html | 8 +++++ .../reference-listing-filters.component.ts | 25 +++++++++----- .../listing/reference-listing.component.ts | 9 +++++ .../listing/tenant-listing.component.ts | 8 ++++- dmp-frontend/src/assets/i18n/en.json | 33 ++++++++++++++----- .../formatting/common-formatting.module.ts | 10 ++++-- .../formatting/pipes/app-role-type.pipe.ts | 11 +++++++ .../formatting/pipes/reference-type.pipe.ts | 11 +++++++ 21 files changed, 182 insertions(+), 50 deletions(-) create mode 100644 dmp-frontend/src/common/formatting/pipes/app-role-type.pipe.ts create mode 100644 dmp-frontend/src/common/formatting/pipes/reference-type.pipe.ts diff --git a/dmp-frontend/src/app/core/query/description-template-type.lookup.ts b/dmp-frontend/src/app/core/query/description-template-type.lookup.ts index 51f263c12..014358572 100644 --- a/dmp-frontend/src/app/core/query/description-template-type.lookup.ts +++ b/dmp-frontend/src/app/core/query/description-template-type.lookup.ts @@ -1,12 +1,14 @@ import { Lookup } from "@common/model/lookup"; import { Guid } from "@common/types/guid"; import { IsActive } from "../common/enum/is-active.enum"; +import { DescriptionTemplateTypeStatus } from "../common/enum/description-template-type-status"; export class DescriptionTemplateTypeLookup extends Lookup implements DescriptionTemplateTypeFilter { ids: Guid[]; excludedIds: Guid[]; like: string; isActive: IsActive[]; + statuses: DescriptionTemplateTypeStatus[]; constructor() { super(); @@ -18,4 +20,5 @@ export interface DescriptionTemplateTypeFilter { excludedIds: Guid[]; like: string; isActive: IsActive[]; + statuses: DescriptionTemplateTypeStatus[]; } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/query/reference.lookup.ts b/dmp-frontend/src/app/core/query/reference.lookup.ts index d721b390a..36d30aef8 100644 --- a/dmp-frontend/src/app/core/query/reference.lookup.ts +++ b/dmp-frontend/src/app/core/query/reference.lookup.ts @@ -10,7 +10,7 @@ export class ReferenceLookup extends Lookup implements ReferenceFilter { like: string; isActive: IsActive[]; sourceTypes: ReferenceSourceType[]; - referenceTypes: ReferenceType[]; + types: ReferenceType[]; constructor() { super(); @@ -23,5 +23,5 @@ export interface ReferenceFilter { like: string; isActive: IsActive[]; sourceTypes: ReferenceSourceType[]; - referenceTypes: ReferenceType[]; + types: ReferenceType[]; } diff --git a/dmp-frontend/src/app/core/services/description-template-type/description-template-type.service.ts b/dmp-frontend/src/app/core/services/description-template-type/description-template-type.service.ts index fc1ce6762..4b8666439 100644 --- a/dmp-frontend/src/app/core/services/description-template-type/description-template-type.service.ts +++ b/dmp-frontend/src/app/core/services/description-template-type/description-template-type.service.ts @@ -2,7 +2,6 @@ import { Injectable } from '@angular/core'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { DescriptionTemplateType, DescriptionTemplateTypePersist } from '@app/core/model/description-template-type/description-template-type'; import { DescriptionTemplateTypeLookup } from '@app/core/query/description-template-type.lookup'; -import { DmpBlueprintLookup } from '@app/core/query/dmp-blueprint.lookup'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; import { QueryResult } from '@common/model/query-result'; @@ -80,8 +79,8 @@ export class DescriptionTemplateTypeService { valueAssign: (item: DescriptionTemplateType) => item.id, }; - private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DmpBlueprintLookup { - const lookup: DmpBlueprintLookup = new DmpBlueprintLookup(); + private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DescriptionTemplateTypeLookup { + const lookup: DescriptionTemplateTypeLookup = new DescriptionTemplateTypeLookup(); lookup.page = { size: 100, offset: 0 }; if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (ids && ids.length > 0) { lookup.ids = ids; } 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 1d00d6e5d..26c3b5c79 100644 --- a/dmp-frontend/src/app/core/services/reference/reference.service.ts +++ b/dmp-frontend/src/app/core/services/reference/reference.service.ts @@ -71,29 +71,29 @@ export class ReferenceService { // // Autocomplete Commons // - public getSingleAutocompleteConfiguration(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): SingleAutoCompleteConfiguration { + public getSingleAutocompleteConfiguration(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): SingleAutoCompleteConfiguration { return { - initialItems: (data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes)).pipe(map(x => x.items)), - filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, searchQuery)).pipe(map(x => x.items)), - getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, null, null, [selectedItem])).pipe(map(x => x.items[0])), + initialItems: (data?: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes)).pipe(map(x => x.items)), + filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes, searchQuery)).pipe(map(x => x.items)), + getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes, null, null, [selectedItem])).pipe(map(x => x.items[0])), displayFn: (item: Reference) => item.label, titleFn: (item: Reference) => item.label, valueAssign: (item: Reference) => item.id, }; }; - public getMultipleAutoCompleteConfiguration(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): MultipleAutoCompleteConfiguration { + public getMultipleAutoCompleteConfiguration(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): MultipleAutoCompleteConfiguration { return { - initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)), - filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, searchQuery, excludedItems)).pipe(map(x => x.items)), - getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, null, null, selectedItems)).pipe(map(x => x.items)), + initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes, null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)), + filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(types, sourceTypes, searchQuery, excludedItems)).pipe(map(x => x.items)), + getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup(types, sourceTypes, null, null, selectedItems)).pipe(map(x => x.items)), displayFn: (item: Reference) => item.label, titleFn: (item: Reference) => item.label, valueAssign: (item: Reference) => item.id, }; } - private buildAutocompleteLookup(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup { + private buildAutocompleteLookup(types?: ReferenceType[], 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; } @@ -105,7 +105,7 @@ export class ReferenceService { nameof(x => x.label) ] }; - if (referenceTypes && referenceTypes.length > 0) { lookup.referenceTypes = referenceTypes; } + if (types && types.length > 0) { lookup.types = types; } if (sourceTypes && sourceTypes.length > 0) { lookup.sourceTypes = sourceTypes; } lookup.order = { items: [nameof(x => x.label)] }; if (like) { lookup.like = this.filterService.transformLike(like); } diff --git a/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts b/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts index 0ac92ca54..27f0be56f 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts @@ -27,6 +27,7 @@ import { ImportDescriptionTemplateDialogComponent } from './import-description-t import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status'; import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup'; +import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; @Component({ @@ -127,6 +128,12 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent(DataTableDateTimeFormatPipe).withFormat('short') }, + { + prop: nameof(x => x.isActive), + sortable: true, + languageName: 'DESCRIPTION-TEMPLATE-LISTING.FIELDS.IS-ACTIVE', + pipe: this.pipeService.getPipe(IsActiveTypePipe) + }, { alwaysShown: true, cellTemplate: this.actions, diff --git a/dmp-frontend/src/app/ui/admin/description-template/listing/filters/description-template-listing-filters.component.html b/dmp-frontend/src/app/ui/admin/description-template/listing/filters/description-template-listing-filters.component.html index 8f4029f50..f8931ff0d 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/listing/filters/description-template-listing-filters.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/listing/filters/description-template-listing-filters.component.html @@ -20,6 +20,14 @@ {{'DESCRIPTION-TEMPLATE-LISTING.FILTER.IS-ACTIVE' | translate}} +
+ {{'DESCRIPTION-TEMPLATE-LISTING.FILTER.STATUS' | translate}} + + {{enumUtils.toDescriptionTemplateTypeStatusString(descriptionTemplateStatus)}} + + +
+