From 5672c6812ba15d5e1370b1d2545ab1743164b413 Mon Sep 17 00:00:00 2001 From: Viacheslav Klimov Date: Tue, 24 Mar 2026 11:39:25 +0200 Subject: [PATCH] Add AND/OR toggle to filter dialog and dynamic operation labels - Add tb-toggle-select with AND/OR options to filter-dialog - Toggle disabled with tooltip when feature flag is false - Pass operation to key-filter-list via @Input binding - Replace hardcoded AND label with dynamic operation label - Pass operation through to filter-text preview component - Add or-conditions-disabled translation key --- .../components/filter/filter-dialog.component.html | 13 ++++++++++++- .../components/filter/filter-dialog.component.ts | 12 ++++++++++-- .../home/components/filter/filter-text.component.ts | 7 +++++-- .../filter/key-filter-list.component.html | 4 ++-- .../components/filter/key-filter-list.component.ts | 6 ++++++ ui-ngx/src/assets/locale/locale.constant-en_US.json | 1 + 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.html b/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.html index 230c8c8bb7..581dd42c93 100644 --- a/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.html @@ -48,8 +48,19 @@ +
+
filter.key-filters
+ + {{ complexOperationTranslationMap.get(ComplexOperation.AND) | translate }} + {{ complexOperationTranslationMap.get(ComplexOperation.OR) | translate }} + +
+ formControlName="keyFilters" + [operation]="filterFormGroup.get('keyFiltersOperation').value"> diff --git a/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.ts b/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.ts index ec3c9b79f0..465b87b4b1 100644 --- a/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.ts @@ -32,7 +32,8 @@ import { Router } from '@angular/router'; import { DialogComponent } from '@app/shared/components/dialog.component'; import { UtilsService } from '@core/services/utils.service'; import { TranslateService } from '@ngx-translate/core'; -import { Filter, Filters } from '@shared/models/query/query.models'; +import { ComplexOperation, complexOperationTranslationMap, Filter, Filters } from '@shared/models/query/query.models'; +import { getCurrentAuthState } from '@core/auth/auth.selectors'; export interface FilterDialogData { isAdd: boolean; @@ -59,6 +60,10 @@ export class FilterDialogComponent extends DialogComponent, protected router: Router, @Inject(MAT_DIALOG_DATA) public data: FilterDialogData, @@ -87,11 +92,13 @@ export class FilterDialogComponent extends DialogComponent) { this.requiredClass = false; if (value && value.length) { - this.filterText = keyFiltersToText(this.translate, this.datePipe, value); + this.filterText = keyFiltersToText(this.translate, this.datePipe, value, this.operation); } else { if (this.required && !this.disabled) { this.filterText = this.addFilterPrompt; diff --git a/ui-ngx/src/app/modules/home/components/filter/key-filter-list.component.html b/ui-ngx/src/app/modules/home/components/filter/key-filter-list.component.html index ba5fbfc250..a772c765fd 100644 --- a/ui-ngx/src/app/modules/home/components/filter/key-filter-list.component.html +++ b/ui-ngx/src/app/modules/home/components/filter/key-filter-list.component.html @@ -38,7 +38,7 @@ formArrayName="keyFilters" *ngFor="let keyFilterControl of keyFiltersFormArray.controls; let $index = index">
- filter.operation.and + {{ complexOperationTranslationMap.get(operation) | translate }}
@@ -85,7 +85,7 @@
- +
diff --git a/ui-ngx/src/app/modules/home/components/filter/key-filter-list.component.ts b/ui-ngx/src/app/modules/home/components/filter/key-filter-list.component.ts index aad686707d..8951764a4b 100644 --- a/ui-ngx/src/app/modules/home/components/filter/key-filter-list.component.ts +++ b/ui-ngx/src/app/modules/home/components/filter/key-filter-list.component.ts @@ -30,6 +30,8 @@ import { } from '@angular/forms'; import { Observable, Subject } from 'rxjs'; import { + ComplexOperation, + complexOperationTranslationMap, EntityKeyType, entityKeyTypeTranslationMap, KeyFilterInfo, @@ -71,6 +73,10 @@ export class KeyFilterListComponent implements ControlValueAccessor, Validator, @Input() entityId: EntityId; + @Input() operation: ComplexOperation = ComplexOperation.AND; + + complexOperationTranslationMap = complexOperationTranslationMap; + keyFilterListFormGroup: UntypedFormGroup; entityKeyTypeTranslations = entityKeyTypeTranslationMap; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 4fdc707c1e..1f4da168c7 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -3610,6 +3610,7 @@ "order-priority": "Display order", "key-filter": "Key filter", "key-filters": "Key filters", + "or-conditions-disabled": "OR conditions between key filters are disabled by the system administrator.", "key-name": "Key name", "key-name-required": "Key name is required.", "key-type": {