Change default entity action notification; fix default rules names

This commit is contained in:
ViacheslavKlimov 2023-04-27 14:08:59 +03:00
parent c542bb9b16
commit e8179271d2
2 changed files with 5 additions and 5 deletions

View File

@ -109,7 +109,7 @@ public class DefaultNotificationSettingsService implements NotificationSettingsS
defaultNotifications.create(tenantId, DefaultNotifications.newAlarm, tenantAdmins.getId()); defaultNotifications.create(tenantId, DefaultNotifications.newAlarm, tenantAdmins.getId());
defaultNotifications.create(tenantId, DefaultNotifications.alarmUpdate, tenantAdmins.getId()); defaultNotifications.create(tenantId, DefaultNotifications.alarmUpdate, tenantAdmins.getId());
defaultNotifications.create(tenantId, DefaultNotifications.deviceAction, tenantAdmins.getId()); defaultNotifications.create(tenantId, DefaultNotifications.entityAction, tenantAdmins.getId());
defaultNotifications.create(tenantId, DefaultNotifications.deviceActivity, tenantAdmins.getId()); defaultNotifications.create(tenantId, DefaultNotifications.deviceActivity, tenantAdmins.getId());
defaultNotifications.create(tenantId, DefaultNotifications.alarmComment, tenantAdmins.getId()); defaultNotifications.create(tenantId, DefaultNotifications.alarmComment, tenantAdmins.getId());
defaultNotifications.create(tenantId, DefaultNotifications.alarmAssignment, affectedUser.getId()); defaultNotifications.create(tenantId, DefaultNotifications.alarmAssignment, affectedUser.getId());

View File

@ -179,13 +179,13 @@ public class DefaultNotifications {
.description("Send notification to tenant admins when any alarm is updated or cleared") .description("Send notification to tenant admins when any alarm is updated or cleared")
.build()) .build())
.build(); .build();
public static final DefaultNotification deviceAction = DefaultNotification.builder() public static final DefaultNotification entityAction = DefaultNotification.builder()
.name("Device action notification") .name("Entity action notification")
.type(NotificationType.ENTITY_ACTION) .type(NotificationType.ENTITY_ACTION)
.subject("${entityType} was ${actionType}") .subject("${entityType} was ${actionType}")
.text("${entityType} '${entityName}' was ${actionType} by user ${userEmail}") .text("${entityType} '${entityName}' was ${actionType} by user ${userEmail}")
.icon("info").color(null) .icon("info").color(null)
.button("Go to device").link("/devices/${entityId}") .button("Go to ${entityType:lowerCase}").link("/${entityType:lowerCase}s/${entityId}")
.rule(DefaultRule.builder() .rule(DefaultRule.builder()
.name("Device created") .name("Device created")
.triggerConfig(EntityActionNotificationRuleTriggerConfig.builder() .triggerConfig(EntityActionNotificationRuleTriggerConfig.builder()
@ -341,7 +341,7 @@ public class DefaultNotifications {
public NotificationRule toRule(NotificationTemplateId templateId, NotificationTargetId... targets) { public NotificationRule toRule(NotificationTemplateId templateId, NotificationTargetId... targets) {
DefaultRule defaultRule = this.rule; DefaultRule defaultRule = this.rule;
NotificationRule rule = new NotificationRule(); NotificationRule rule = new NotificationRule();
rule.setName(name); rule.setName(defaultRule.getName());
rule.setTemplateId(templateId); rule.setTemplateId(templateId);
rule.setTriggerType(defaultRule.getTriggerConfig().getTriggerType()); rule.setTriggerType(defaultRule.getTriggerConfig().getTriggerType());
rule.setTriggerConfig(defaultRule.getTriggerConfig()); rule.setTriggerConfig(defaultRule.getTriggerConfig());