@ -31,6 +31,7 @@ import { EdgeService } from '@core/http/edge.service';
import { EntityViewService } from '@core/http/entity-view.service' ;
import { BroadcastService } from '@core/services/broadcast.service' ;
import { COMMA , ENTER , SEMICOLON } from '@angular/cdk/keycodes' ;
import { AlarmService } from "@core/http/alarm.service" ;
@Component ( {
selector : 'tb-entity-subtype-list' ,
@ -102,6 +103,7 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit,
private deviceService : DeviceService ,
private edgeService : EdgeService ,
private entityViewService : EntityViewService ,
private alarmService : AlarmService ,
private fb : UntypedFormBuilder ) {
this . entitySubtypeListFormGroup = this . fb . group ( {
entitySubtypeList : [ this . entitySubtypeList , this . required ? [ Validators . required ] : [ ] ] ,
@ -164,6 +166,16 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit,
this . entitySubtypes = null ;
} ) ;
break ;
case EntityType . ALARM :
this . placeholder = this . required ? this . translate . instant ( 'alarm.enter-alarm-type' )
: this . translate . instant ( 'alarm.any-type' ) ;
this . secondaryPlaceholder = '+' + this . translate . instant ( 'alarm.alarm-type' ) ;
this . noSubtypesMathingText = 'alarm.no-alarm-types-matching' ;
this . subtypeListEmptyText = 'alarm.alarm-type-list-empty' ;
this . broadcastSubscription = this . broadcast . on ( 'alarmSaved' , ( ) = > {
this . entitySubtypes = null ;
} ) ;
break ;
}
this . filteredEntitySubtypeList = this . entitySubtypeListFormGroup . get ( 'entitySubtype' ) . valueChanges
@ -283,6 +295,9 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit,
case EntityType . ENTITY_VIEW :
subTypesObservable = this . entityViewService . getEntityViewTypes ( { ignoreLoading : true } ) ;
break ;
case EntityType . ALARM :
subTypesObservable = this . alarmService . getAlarmTypes ( { ignoreLoading : true } ) ;
break ;
}
if ( subTypesObservable ) {
this . entitySubtypes = subTypesObservable . pipe (