From 95f37ee61bfc3a094033c87e20e14ce45f6e54b6 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 27 Oct 2023 11:30:07 +0300 Subject: [PATCH 1/2] UI: Fixed alarm type list width and empty option --- .../home/components/alarm/alarm-filter-config.component.scss | 3 +++ .../shared/components/entity/entity-subtype-list.component.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.scss b/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.scss index 9b0c323a40..16a2f43006 100644 --- a/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.scss +++ b/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.scss @@ -40,6 +40,9 @@ tb-entity-subtype-list { flex: 1; width: 180px; + .mdc-evolution-chip-set__chips { + width: 100%; + } } .mat-mdc-chip { diff --git a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts index cb7cc7b63d..b2ea6a185d 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts @@ -298,7 +298,7 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, } else { result = subTypes.filter(subType => searchText ? subType.toUpperCase().startsWith(searchText.toUpperCase()) : true); } - if (!result.length) { + if (!result.length && searchText.length) { result = [searchText]; } return result; From 900bb9a57ca4ea284f5fe7eb8099cf22ef3d0f6f Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Wed, 1 Nov 2023 12:28:24 +0200 Subject: [PATCH 2/2] UI: Refactoring entity subtype list --- .../components/entity/entity-subtype-list.component.html | 8 ++------ .../components/entity/entity-subtype-list.component.ts | 6 ++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.html b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.html index 44c61d605a..fa2d716530 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.html +++ b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.html @@ -24,7 +24,7 @@ *ngFor="let entitySubtype of entitySubtypeList" [removable]="!disabled" (removed)="remove(entitySubtype)"> - {{entitySubtype}} + {{customTranslate(entitySubtype)}} close - - - {{ translate.get(noSubtypesMathingText, {entitySubtype: searchText}) | async }} - -
diff --git a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts index b2ea6a185d..6661d257b4 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts @@ -33,6 +33,7 @@ import { FloatLabelType, MatFormFieldAppearance, SubscriptSizing } from '@angula import { coerceArray, coerceBoolean } from '@shared/decorators/coercion'; import { PageLink } from '@shared/models/page/page-link'; import { PageData } from '@shared/models/page/page-data'; +import { UtilsService } from '@core/services/utils.service'; @Component({ selector: 'tb-entity-subtype-list', @@ -129,6 +130,7 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, private edgeService: EdgeService, private entityViewService: EntityViewService, private alarmService: AlarmService, + private utils: UtilsService, private fb: FormBuilder) { this.entitySubtypeListFormGroup = this.fb.group({ entitySubtypeList: [this.entitySubtypeList, this.required ? [Validators.required] : []], @@ -372,4 +374,8 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, }, 0); } + customTranslate(entity: string) { + return this.utils.customTranslation(entity, entity); + } + }