From bad6451102396a2ab1431324deee60a838ad1676 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Fri, 7 Feb 2025 14:30:42 +0200 Subject: [PATCH] Improve after review --- ...rocessor.java => ResourcesShortageTriggerProcessor.java} | 2 +- .../server/dao/notification/DefaultNotifications.java | 4 ++-- .../notification/rule/rule-notification-dialog.component.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) rename application/src/main/java/org/thingsboard/server/service/notification/rule/trigger/{ResourcesShortageLimitTriggerProcessor.java => ResourcesShortageTriggerProcessor.java} (92%) diff --git a/application/src/main/java/org/thingsboard/server/service/notification/rule/trigger/ResourcesShortageLimitTriggerProcessor.java b/application/src/main/java/org/thingsboard/server/service/notification/rule/trigger/ResourcesShortageTriggerProcessor.java similarity index 92% rename from application/src/main/java/org/thingsboard/server/service/notification/rule/trigger/ResourcesShortageLimitTriggerProcessor.java rename to application/src/main/java/org/thingsboard/server/service/notification/rule/trigger/ResourcesShortageTriggerProcessor.java index c9c9a03f55..b7da85e3e0 100644 --- a/application/src/main/java/org/thingsboard/server/service/notification/rule/trigger/ResourcesShortageLimitTriggerProcessor.java +++ b/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 @RequiredArgsConstructor -public class ResourcesShortageLimitTriggerProcessor implements NotificationRuleTriggerProcessor { +public class ResourcesShortageTriggerProcessor implements NotificationRuleTriggerProcessor { @Override public boolean matchesFilter(ResourcesShortageTrigger trigger, ResourcesShortageNotificationRuleTriggerConfig triggerConfig) { diff --git a/dao/src/main/java/org/thingsboard/server/dao/notification/DefaultNotifications.java b/dao/src/main/java/org/thingsboard/server/dao/notification/DefaultNotifications.java index f830665ba6..2716a6492b 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/notification/DefaultNotifications.java +++ b/dao/src/main/java/org/thingsboard/server/dao/notification/DefaultNotifications.java @@ -397,11 +397,11 @@ public class DefaultNotifications { .name("Resources shortage notification") .type(NotificationType.RESOURCES_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") .rule(DefaultRule.builder() .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") .build()) .color(RED_COLOR) 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 7c43dbf9fb..d49cf25d29 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 @@ -347,9 +347,9 @@ export class RuleNotificationDialogComponent extends this.resourceUsageShortageTemplateForm = this.fb.group({ triggerConfig: this.fb.group({ - cpuThreshold: [.9, [Validators.min(0), Validators.max(1)]], - ramThreshold: [.9, [Validators.min(0), Validators.max(1)]], - storageThreshold: [.9, [Validators.min(0), Validators.max(1)]] + cpuThreshold: [.8, [Validators.min(0), Validators.max(1)]], + ramThreshold: [.8, [Validators.min(0), Validators.max(1)]], + storageThreshold: [.8, [Validators.min(0), Validators.max(1)]] }) });