diff --git a/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.html index 5a3e67e198..a3e7d55b60 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.html @@ -215,7 +215,7 @@ notification.filter
@@ -413,7 +413,7 @@ notification.filter + [allowedEntityTypes]="allowEntityTypeForEntitiesLimit">
diff --git a/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.ts index 2a3af20859..8566745ecf 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.ts @@ -36,7 +36,7 @@ import { Router } from '@angular/router'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { NotificationService } from '@core/http/notification.service'; -import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models'; +import { EntityType } from '@shared/models/entity-type.models'; import { deepClone, deepTrim, isDefined } from '@core/utils'; import { Observable, Subject } from 'rxjs'; import { map, takeUntil } from 'rxjs/operators'; @@ -129,9 +129,17 @@ export class RuleNotificationDialogComponent extends apiFeatureTranslationMap = ApiFeatureTranslationMap; entityType = EntityType; - entityTypes = Array.from(entityTypeTranslations.keys()).filter(type => !!this.entityType[type]); isAdd = true; + allowEntityTypeForEntitiesLimit = [ + EntityType.DEVICE, + EntityType.ASSET, + EntityType.CUSTOMER, + EntityType.USER, + EntityType.DASHBOARD, + EntityType.RULE_CHAIN + ]; + selectedIndex = 0; dialogTitle = 'notification.edit-rule'; @@ -143,6 +151,7 @@ export class RuleNotificationDialogComponent extends private triggerTypeFormsMap: Map; private authState: AuthState = getCurrentAuthState(this.store); private authUser: AuthUser = this.authState.authUser; + private _allowEntityTypeForEntityAction: EntityType[]; constructor(protected store: Store, protected router: Router, @@ -428,4 +437,20 @@ export class RuleNotificationDialogComponent extends } return Object.values(TriggerType).filter(type => type !== TriggerType.ENTITIES_LIMIT && type !== TriggerType.API_USAGE_LIMIT); } + + get allowEntityTypeForEntityAction(): EntityType[] { + if (!this._allowEntityTypeForEntityAction) { + const excludeEntityType: Set = new Set([ + EntityType.API_USAGE_STATE, + EntityType.TENANT_PROFILE, + EntityType.RPC, + EntityType.QUEUE, + EntityType.NOTIFICATION, + EntityType.NOTIFICATION_REQUEST, + EntityType.WIDGET_TYPE + ]); + this._allowEntityTypeForEntityAction = Object.values(EntityType).filter(type => !excludeEntityType.has(type)); + } + return this._allowEntityTypeForEntityAction; + } }