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 3c54663b7e..ea3c59992c 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 @@ -442,11 +442,16 @@ export class RuleNotificationDialogComponent extends } private allowTriggerTypes(): TriggerType[] { + const sysAdminAllowTriggerTypes = new Set([ + TriggerType.ENTITIES_LIMIT, + TriggerType.API_USAGE_LIMIT, + TriggerType.NEW_PLATFORM_VERSION, + ]); + if (this.isSysAdmin()) { - return [TriggerType.ENTITIES_LIMIT, TriggerType.API_USAGE_LIMIT, TriggerType.NEW_PLATFORM_VERSION]; + return Array.from(sysAdminAllowTriggerTypes); } - return Object.values(TriggerType).filter(type => type !== TriggerType.ENTITIES_LIMIT && type !== TriggerType.API_USAGE_LIMIT - && type !== TriggerType.NEW_PLATFORM_VERSION); + return Object.values(TriggerType).filter(type => !sysAdminAllowTriggerTypes.has(type)); } get allowEntityTypeForEntityAction(): EntityType[] { diff --git a/ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.ts index f1322c1463..5fb10e7374 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.ts @@ -177,11 +177,15 @@ export class TemplateNotificationDialogComponent } private allowNotificationType(): NotificationType[] { + const sysAdminAllowNotificationTypes = new Set([ + NotificationType.ENTITIES_LIMIT, + NotificationType.API_USAGE_LIMIT, + NotificationType.NEW_PLATFORM_VERSION, + ]); + if (this.isSysAdmin()) { - return [NotificationType.GENERAL, NotificationType.ENTITIES_LIMIT, NotificationType.API_USAGE_LIMIT, NotificationType.NEW_PLATFORM_VERSION]; + return [NotificationType.GENERAL, ...sysAdminAllowNotificationTypes]; } - return Object.values(NotificationType) - .filter(type => type !== NotificationType.ENTITIES_LIMIT && type !== NotificationType.API_USAGE_LIMIT - && type !== NotificationType.NEW_PLATFORM_VERSION); + return Object.values(NotificationType).filter(type => !sysAdminAllowNotificationTypes.has(type)); } }