Browse Source

UI: Optimize filter allow notification type

pull/8334/head
Vladyslav_Prykhodko 4 years ago
parent
commit
eda7cf3619
  1. 11
      ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.ts
  2. 12
      ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.ts

11
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[] {

12
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));
}
}

Loading…
Cancel
Save