Browse Source

Improve after review

pull/12616/head
Andrii Landiak 2 years ago
parent
commit
bad6451102
  1. 2
      application/src/main/java/org/thingsboard/server/service/notification/rule/trigger/ResourcesShortageTriggerProcessor.java
  2. 4
      dao/src/main/java/org/thingsboard/server/dao/notification/DefaultNotifications.java
  3. 6
      ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.ts

2
application/src/main/java/org/thingsboard/server/service/notification/rule/trigger/ResourcesShortageLimitTriggerProcessor.java → application/src/main/java/org/thingsboard/server/service/notification/rule/trigger/ResourcesShortageTriggerProcessor.java

@ -25,7 +25,7 @@ import org.thingsboard.server.common.data.notification.rule.trigger.config.Resou
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class ResourcesShortageLimitTriggerProcessor implements NotificationRuleTriggerProcessor<ResourcesShortageTrigger, ResourcesShortageNotificationRuleTriggerConfig> { public class ResourcesShortageTriggerProcessor implements NotificationRuleTriggerProcessor<ResourcesShortageTrigger, ResourcesShortageNotificationRuleTriggerConfig> {
@Override @Override
public boolean matchesFilter(ResourcesShortageTrigger trigger, ResourcesShortageNotificationRuleTriggerConfig triggerConfig) { public boolean matchesFilter(ResourcesShortageTrigger trigger, ResourcesShortageNotificationRuleTriggerConfig triggerConfig) {

4
dao/src/main/java/org/thingsboard/server/dao/notification/DefaultNotifications.java

@ -397,11 +397,11 @@ public class DefaultNotifications {
.name("Resources shortage notification") .name("Resources shortage notification")
.type(NotificationType.RESOURCES_SHORTAGE) .type(NotificationType.RESOURCES_SHORTAGE)
.subject("Warning: ${resource} shortage") .subject("Warning: ${resource} shortage")
.text("The ${resource} usage is on the rise (currently at ${usage}%). Immediate action required to prevent system instability.") .text("${resource} usage is at ${usage}%).")
.icon("warning") .icon("warning")
.rule(DefaultRule.builder() .rule(DefaultRule.builder()
.name("Resources shortage") .name("Resources shortage")
.triggerConfig(ResourcesShortageNotificationRuleTriggerConfig.builder().resource(Resource.CPU.name()).cpuThreshold(90).storageThreshold(90).ramThreshold(90).build()) .triggerConfig(ResourcesShortageNotificationRuleTriggerConfig.builder().resource(Resource.CPU.name()).cpuThreshold(80).storageThreshold(80).ramThreshold(80).build())
.description("Send notification to system admins when resources shortage is running low") .description("Send notification to system admins when resources shortage is running low")
.build()) .build())
.color(RED_COLOR) .color(RED_COLOR)

6
ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.ts

@ -347,9 +347,9 @@ export class RuleNotificationDialogComponent extends
this.resourceUsageShortageTemplateForm = this.fb.group({ this.resourceUsageShortageTemplateForm = this.fb.group({
triggerConfig: this.fb.group({ triggerConfig: this.fb.group({
cpuThreshold: [.9, [Validators.min(0), Validators.max(1)]], cpuThreshold: [.8, [Validators.min(0), Validators.max(1)]],
ramThreshold: [.9, [Validators.min(0), Validators.max(1)]], ramThreshold: [.8, [Validators.min(0), Validators.max(1)]],
storageThreshold: [.9, [Validators.min(0), Validators.max(1)]] storageThreshold: [.8, [Validators.min(0), Validators.max(1)]]
}) })
}); });

Loading…
Cancel
Save