Browse Source

Merge pull request #10206 from Dmitriymush/bug-fix/alarm-custom-translate

Fixed typeList URL query and alarm filter config translation
pull/10271/head
Igor Kulikov 2 years ago
committed by GitHub
parent
commit
596f0f3111
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.ts
  2. 2
      ui-ngx/src/app/shared/models/alarm.models.ts

10
ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.ts

@ -45,6 +45,7 @@ import { deepClone } from '@core/utils';
import { EntityType } from '@shared/models/entity-type.models';
import { fromEvent, Subscription } from 'rxjs';
import { POSITION_MAP } from '@shared/models/overlay.models';
import { UtilsService } from '@core/services/utils.service';
export const ALARM_FILTER_CONFIG_DATA = new InjectionToken<any>('AlarmFilterConfigData');
@ -127,7 +128,8 @@ export class AlarmFilterConfigComponent implements OnInit, OnDestroy, ControlVal
private translate: TranslateService,
private overlay: Overlay,
private nativeElement: ElementRef,
private viewContainerRef: ViewContainerRef) {
private viewContainerRef: ViewContainerRef,
private utils: UtilsService) {
}
ngOnInit(): void {
@ -298,7 +300,7 @@ export class AlarmFilterConfigComponent implements OnInit, OnDestroy, ControlVal
this.translate.instant(alarmSeverityTranslations.get(s))).join(', '));
}
if (this.alarmFilterConfig?.typeList?.length) {
filterTextParts.push(this.alarmFilterConfig.typeList.join(', '));
filterTextParts.push(this.alarmFilterConfig.typeList.map((type) => this.customTranslate(type)).join(', '));
}
if (this.alarmFilterConfig?.assignedToCurrentUser) {
filterTextParts.push(this.translate.instant('alarm.assigned-to-me'));
@ -313,4 +315,8 @@ export class AlarmFilterConfigComponent implements OnInit, OnDestroy, ControlVal
}
}
private customTranslate(entity: string) {
return this.utils.customTranslation(entity, entity);
}
}

2
ui-ngx/src/app/shared/models/alarm.models.ts

@ -335,7 +335,7 @@ export class AlarmQueryV2 {
let query = this.affectedEntityId ? `/${this.affectedEntityId.entityType}/${this.affectedEntityId.id}` : '';
query += this.pageLink.toQuery();
if (this.typeList && this.typeList.length) {
query += `&typeList=${this.typeList.join(',')}`;
query += `&typeList=${this.typeList.map(type => encodeURIComponent(type)).join(',')}`;
}
if (this.statusList && this.statusList.length) {
query += `&statusList=${this.statusList.join(',')}`;

Loading…
Cancel
Save