feat(hosts): notification severity and trend charts on metrics tab#165
Merged
Conversation
Adds two charts to the Monitoring → Metrics tab of each host detail page, both scoped to that specific host: - Severity breakdown (pie/donut): shows the count and percentage of critical / warning / info notifications received for this host - Notification trend (line chart): shows critical & warning notification counts over a selectable time window (1h · 6h · 12h · 24h · 7d · 30d · 3 months) with the same hourly/daily aggregation logic as the global notifications page Server actions getNotificationStats and getNotificationsOverTime now accept an optional hostId parameter which adds resourceType='host' and resourceId=hostId filters, keeping the existing global behaviour unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds host-scoped notification charts to Monitoring → Metrics on every host detail page.
New charts
Both charts sit below the existing Heartbeat Interval chart in the metrics tab.
Implementation
host-notification-charts.tsxin the host detail directory — self-contained, owns its own time-range state and queriesgetNotificationStatsandgetNotificationsOverTimenow accept an optionalhostIdparameter; when provided they addresource_type = 'host'andresource_id = hostIdto the WHERE clause — existing callers (global notifications page) pass nohostIdand are unaffectedcurrentUserIdcontext as the rest of the host page so results are scoped to the viewing user's notifications about this hostTest plan
pnpm run buildpasses with no TypeScript errors🤖 Generated with Claude Code