From 950656059287aa129309377e6a7b35441a4df489 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 18 Dec 2025 18:52:27 +0200 Subject: [PATCH] UI: Standardize filter button labels, filter panel and entity naming --- .../alarm-rule-dialog.component.html | 2 +- .../alarm-rule-filter-config.component.html | 4 +- .../alarm-rule-filter-config.component.scss | 1 - .../alarm-rule-filter-config.component.ts | 13 +-- .../alarm-rules/alarm-rules-table-config.ts | 8 +- .../alarm/alarm-filter-config.component.ts | 2 +- .../audit-log/audit-log-filter.component.html | 8 +- .../audit-log/audit-log-filter.component.scss | 9 ++ .../audit-log/audit-log-filter.component.ts | 25 ++++-- .../calculated-fields-table-config.ts | 6 +- .../calculated-field-dialog.component.html | 2 +- ...ulated-fields-filter-config.component.html | 10 +-- ...ulated-fields-filter-config.component.scss | 12 --- ...lculated-fields-filter-config.component.ts | 32 ++++--- .../device/device-info-filter.component.html | 53 +++++++----- .../device/device-info-filter.component.scss | 10 +++ .../device/device-info-filter.component.ts | 85 +++++++++++++------ ...device-profile-autocomplete.component.html | 9 +- .../device-profile-autocomplete.component.ts | 9 +- .../assets/locale/locale.constant-en_US.json | 23 ++--- 20 files changed, 198 insertions(+), 125 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.html b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.html index d9bff11bf0..869b707d98 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.html @@ -65,7 +65,7 @@ class="flex-1" showLabel required - label="{{ 'alarm-rule.target-entity-type' | translate }}" + label="{{ 'entity.entity-type' | translate }}" [filterAllowedEntityTypes]="false" [allowedEntityTypes]="alarmRuleEntityTypeList" formControlName="entityType"> diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-filter-config.component.html b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-filter-config.component.html index 5deddffd87..c9629f00a3 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-filter-config.component.html +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-filter-config.component.html @@ -66,7 +66,7 @@
-
alarm-rule.target-entity-type
+
entity.entity-type
{{ 'alarm-rule.any-type' | translate }} @@ -78,7 +78,7 @@
@if (alarmRuleFilterConfigForm.get('entityType').value) {
-
alarm-rule.target-entities
+
entity.entities
{ this.defaultSortOrder = {property: 'createdTime', direction: Direction.DESC}; this.columns.push(new DateEntityTableColumn('createdTime', 'common.created-time', this.datePipe, '150px')); - this.columns.push(new EntityTableColumn('name', 'alarm-rule.alarm-type', this.pageMode ? '30%' :'33%', + this.columns.push(new EntityTableColumn('name', 'alarm-rule.alarm-type', '33%', entity => this.utilsService.customTranslation(entity.name, entity.name))); if (this.pageMode) { - this.columns.push(new EntityTableColumn('entityType', 'alarm-rule.target-entity-type', '15%', + this.columns.push(new EntityTableColumn('entityType', 'entity.entity-type', '10%', entity => this.translate.instant(entityTypeTranslations.get(entity.entityId.entityType).type))); - this.columns.push(new EntityLinkTableColumn('entityName', 'alarm-rule.target-entity', '30%', + this.columns.push(new EntityLinkTableColumn('entityName', 'entity.entity', '33%', entity => this.utilsService.customTranslation(entity['entityName'], entity['entityName']), entity => getEntityDetailsPageURL(entity.entityId?.id, entity.entityId?.entityType as EntityType), false)); } - this.columns.push(new EntityTableColumn('createRule', 'alarm-rule.severities', this.pageMode ? '15%' :'67%', + this.columns.push(new EntityTableColumn('createRule', 'alarm-rule.severities', this.pageMode ? '23%' : '67%', entity => Object.keys(entity.configuration.createRules).map((severity) => this.translate.instant(alarmSeverityTranslations.get(severity as AlarmSeverity))).join(', '), () => ({}), false)); this.columns.push(new EntityTableColumn('clearRule', 'alarm-rule.cleared', '90px', diff --git a/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.ts b/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.ts index e90071299c..093858a500 100644 --- a/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.ts +++ b/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.ts @@ -107,7 +107,7 @@ export class AlarmFilterConfigComponent implements OnInit, OnDestroy, ControlVal alarmSeverityTranslationMap = alarmSeverityTranslations; - buttonDisplayValue = this.translate.instant('alarm.alarm-filter'); + buttonDisplayValue = this.translate.instant('alarm.alarm-filter-title'); alarmFilterConfigForm: UntypedFormGroup; diff --git a/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.html b/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.html index b97285ba07..8d53bdd99b 100644 --- a/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.html +++ b/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.html @@ -24,14 +24,14 @@ filter_list{{buttonDisplayValue}} -
-
-
+ +
+
audit-log.filter-types
diff --git a/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.scss b/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.scss index 77bd5aea60..ca52472aa1 100644 --- a/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.scss +++ b/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.scss @@ -33,3 +33,12 @@ } } } + +::ng-deep { + .tb-audit-log-config-component { + max-width: 100%; + width: 600px; + min-width: 100%; + flex: 1; + } +} diff --git a/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.ts b/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.ts index e78b38965d..f810eb5df7 100644 --- a/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.ts +++ b/ui-ngx/src/app/modules/home/components/audit-log/audit-log-filter.component.ts @@ -16,16 +16,27 @@ import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; import { TemplatePortal } from '@angular/cdk/portal'; -import { ChangeDetectorRef, Component, DestroyRef, ElementRef, forwardRef, Input, OnInit, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core'; +import { + ChangeDetectorRef, + Component, + DestroyRef, + ElementRef, + forwardRef, + Input, + OnInit, + TemplateRef, + ViewChild, + ViewContainerRef +} from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; +import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms'; import { isDefined, isDefinedAndNotNull } from '@app/core/utils'; import { StringItemsOption } from '@app/shared/components/string-items-list.component'; import { ActionType, actionTypeTranslations, - auditLogFilterEquals, AuditLogFilter, + auditLogFilterEquals, POSITION_MAP, } from '@app/shared/public-api'; import { TranslateService } from '@ngx-translate/core'; @@ -56,9 +67,9 @@ export class AuditLogFilterComponent implements OnInit, ControlValueAccessor { actionTypeTranslations = actionTypeTranslations; - buttonDisplayValue = this.translate.instant('audit-log.filter'); + buttonDisplayValue = this.translate.instant('audit-log.audit-log-filter-title'); - auditLogFilterForm: UntypedFormGroup; + auditLogFilterForm: FormGroup; auditLogOverlayRef: OverlayRef; @@ -68,7 +79,7 @@ export class AuditLogFilterComponent implements OnInit, ControlValueAccessor { private propagateChange = (_: any) => {}; - constructor(private fb: UntypedFormBuilder, + constructor(private fb: FormBuilder, private translate: TranslateService, private overlay: Overlay, private nativeElement: ElementRef, @@ -93,7 +104,7 @@ export class AuditLogFilterComponent implements OnInit, ControlValueAccessor { this.propagateChange = fn; } - registerOnTouched(fn: any): void { + registerOnTouched(_fn: any): void { } setDisabledState(isDisabled: boolean): void { diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts index 56a3cc2a45..e5c57aae2e 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts @@ -136,11 +136,13 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig('name', 'common.name', this.pageMode ? '33%' : '60%', entity => this.utilsService.customTranslation(entity.name, entity.name))); if (this.pageMode) { - this.columns.push(new EntityLinkTableColumn('entityName', 'calculated-fields.target-entity', '33%', + this.columns.push(new EntityTableColumn('entityType', 'entity.entity-type', '10%', + entity => this.translate.instant(entityTypeTranslations.get(entity.entityId.entityType).type))); + this.columns.push(new EntityLinkTableColumn('entityName', 'entity.entity', '33%', entity => this.utilsService.customTranslation(entity['entityName'], entity['entityName']), entity => getEntityDetailsPageURL(entity.entityId?.id, entity.entityId?.entityType as EntityType), false)); } - this.columns.push(new EntityTableColumn('type', 'common.type', this.pageMode ? '33%' : '40%', entity => this.translate.instant(CalculatedFieldTypeTranslations.get(entity.type).name), () => ({whiteSpace: 'nowrap' }))); + this.columns.push(new EntityTableColumn('type', 'common.type', this.pageMode ? '23%' : '40%', entity => this.translate.instant(CalculatedFieldTypeTranslations.get(entity.type).name), () => ({whiteSpace: 'nowrap' }))); this.cellActionDescriptors.push( { diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html index 44c2e702e5..3d669b02c6 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html @@ -62,7 +62,7 @@ class="flex-1" showLabel required - label="{{ 'alarm-rule.target-entity-type' | translate }}" + label="{{ 'entity.entity-type' | translate }}" [filterAllowedEntityTypes]="false" [allowedEntityTypes]="calculatedFieldsEntityTypeList" formControlName="entityType"> diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/table-header/calculated-fields-filter-config.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/table-header/calculated-fields-filter-config.component.html index b3cc3b387a..5f4efea5b8 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/table-header/calculated-fields-filter-config.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/table-header/calculated-fields-filter-config.component.html @@ -21,18 +21,18 @@ -
+
-
alarm-rule.target-entity-type
+
entity.entity-type
{{ 'alarm-rule.any-type' | translate }} @@ -80,7 +80,7 @@
@if (cfFilterForm.get('entityType').value) {
-
alarm-rule.target-entities
+
entity.entities
this.translate.instant(CalculatedFieldTypeTranslations.get(type).name)).join(', ')); + } + if (this.cfFilterConfig?.entityType) { + filterTextParts.push(this.translate.instant( entityTypeTranslations.get(this.cfFilterConfig.entityType).type)); + } + if (!filterTextParts.length) { + this.buttonDisplayValue = this.translate.instant('calculated-fields.calculated-field-filter-title'); + } else { + this.buttonDisplayValue = this.translate.instant('calculated-fields.filter-title') + `: ${filterTextParts.join(', ')}`; + } + } + } + private cfFilterFromFormValue(formValue: any): CalculatedFieldsQuery { return { types: formValue?.types ?? [], diff --git a/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.html b/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.html index c7d97aae23..55b99d8a8d 100644 --- a/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.html +++ b/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.html @@ -33,6 +33,13 @@
+ +