Skip to content

Commit

Permalink
bugfix webhook notice error (#1504)
Browse files Browse the repository at this point in the history
Co-authored-by: Carpe-Wang <[email protected]>
  • Loading branch information
2 people authored and tomsun28 committed Mar 9, 2024
1 parent 9d9fc8c commit 0fa7168
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ protected String renderContent(NoticeTemplate noticeTemplate, Alert alert) throw
model.put("thresholdId", thresholdId);
}
}

model.put("alarmId", alert.getId());
model.put("status", alert.getStatus());
model.put("monitorIdLabel", bundle.getString("alerter.notify.monitorId"));
Expand Down Expand Up @@ -127,7 +126,6 @@ public void onEvent(SystemConfigChangeEvent event) {
log.info("{} receive system config change event: {}.", this.getClass().getName(), event.getSource());
this.bundle = ResourceBundleUtil.getBundle("alerter");
}

}


19 changes: 9 additions & 10 deletions manager/src/main/resources/templates/2-WebhookTemplate.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{
"alarmId": ${alarmId},
"target": "${target}",
<#if (thresholdId??)>"thresholdId": ${thresholdId},</#if>
"priority": ${priorityValue},
<#if alarmId??>"alarmId": ${alarmId},</#if>
<#if thresholdId??>"thresholdId": "${thresholdId}",</#if>
<#if priorityValue??>"priority": ${priorityValue},</#if>
"content": "${content}",
"status": ${status},
"times": ${times},
<#if status??>"status": ${status},</#if>
<#if times??>"times": ${times},</#if>
"triggerTime": "${triggerTime}",
<#if (restoreTime??)>"restoreTime": "${restoreTime}",</#if>
<#if (tags??)>
<#if restoreTime??>"restoreTime": "${restoreTime}",</#if>
<#if tags??>
"tags": {
<#list tags as key,value>
"${key}": "${value}",
"${key}": "${value}"<#if key_has_next>,</#if>
</#list>
}
</#if>
}</#if>
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.dromara.hertzbeat.manager.service;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.assertj.core.util.Maps;
import org.dromara.hertzbeat.common.entity.alerter.Alert;
import org.dromara.hertzbeat.common.entity.manager.NoticeReceiver;
Expand All @@ -23,7 +22,6 @@

import java.util.List;
import java.util.Map;
import java.util.Set;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
Expand Down

0 comments on commit 0fa7168

Please sign in to comment.