EDM-1997: Show alert title as received from the API by default#343
Conversation
WalkthroughAdded a local helper to resolve alert titles using alert.annotations.summary when available, falling back to the existing translation-based title. Updated the AlertsCard title rendering to use this helper. No exports changed; no data flow, fetching, or error handling modified. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
libs/ui-components/src/components/OverviewPage/Cards/Alerts/AlertsCard.tsx (1)
119-124: Make helper more robust: trim and fall back todescription; add explicit return typePrevents rendering blank/whitespace summaries and covers integrations that populate
descriptioninstead ofsummary. The explicit return type improves readability.-const getAlertTitle = (alert: AlertManagerAlert, defaultTitle: string) => { - if (alert.annotations.summary) { - return alert.annotations.summary; - } - return defaultTitle; -}; +const getAlertTitle = (alert: AlertManagerAlert, defaultTitle: string): string => { + const summary = alert.annotations?.summary?.trim(); + if (summary) return summary; + // Some Alertmanager integrations populate `description` instead of `summary` + const description = alert.annotations?.description?.trim(); + if (description) return description; + return defaultTitle; +};If you’d like, I can add a couple of unit tests to cover:
- summary present
- summary whitespace-only
- description present, summary missing
- both missing (falls back to defaultTitle)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
libs/ui-components/src/components/OverviewPage/Cards/Alerts/AlertsCard.tsx(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
libs/ui-components/src/components/OverviewPage/Cards/Alerts/AlertsCard.tsx (1)
libs/ui-components/src/types/extraTypes.ts (1)
AlertManagerAlert(63-77)
🔇 Additional comments (1)
libs/ui-components/src/components/OverviewPage/Cards/Alerts/AlertsCard.tsx (1)
163-163: LGTM: Correctly prefers API-provided title with a safe fallbackUsing the helper here aligns with the PR objective and preserves backward compatibility when annotations are absent.
By default, show the human-readable message for alerts provided by the API.
Summary by CodeRabbit