mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 19:23:31 +00:00
fix: resolve remaining Teams webhook timestamp errors
- Fix remaining alert.timestamp references in email notifications and Discord/Slack embeds - Replace with alert.triggeredAt || alert.lastUpdate || Date.now() pattern - Resolves RangeError when sending webhook notifications to Teams - Fixes issue #114 completely 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1173,7 +1173,7 @@ class AlertManager extends EventEmitter {
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 8px 0; font-weight: bold; color: #374151;">Time:</td>
|
||||
<td style="padding: 8px 0; color: #6b7280;">${new Date(alert.timestamp).toLocaleString()}</td>
|
||||
<td style="padding: 8px 0; color: #6b7280;">${new Date(alert.triggeredAt || alert.lastUpdate || Date.now()).toLocaleString()}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -1200,7 +1200,7 @@ Metric: ${alert.rule.metric.toUpperCase()}
|
||||
Current Value: ${alert.value}%
|
||||
Threshold: ${alert.threshold}%
|
||||
Status: ${alert.guest.status}
|
||||
Time: ${new Date(alert.timestamp).toLocaleString()}
|
||||
Time: ${new Date(alert.triggeredAt || alert.lastUpdate || Date.now()).toLocaleString()}
|
||||
|
||||
Description: ${alert.rule.description}
|
||||
|
||||
@@ -1296,7 +1296,7 @@ This alert was generated by Pulse monitoring system.
|
||||
footer: {
|
||||
text: 'Pulse Monitoring System'
|
||||
},
|
||||
timestamp: new Date(alert.timestamp).toISOString()
|
||||
timestamp: new Date(alert.triggeredAt || alert.lastUpdate || Date.now()).toISOString()
|
||||
}],
|
||||
// Slack compatible format
|
||||
text: `${severityEmoji[alert.rule.severity] || '📢'} *${alert.rule.name}*`,
|
||||
@@ -1321,7 +1321,7 @@ This alert was generated by Pulse monitoring system.
|
||||
}
|
||||
],
|
||||
footer: 'Pulse Monitoring',
|
||||
ts: Math.floor(alert.timestamp / 1000)
|
||||
ts: Math.floor((alert.triggeredAt || alert.lastUpdate || Date.now()) / 1000)
|
||||
}]
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user