Fleet UI: Hide empty host summary card on Free-tier Android hosts#49848
Conversation
On Free tier, every child of the summary card is hidden for Android hosts unless the host has OS settings, leaving an empty card above Vitals. Hoist the section visibility into named booleans and skip rendering the Card wrapper entirely when nothing inside would render.
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
This PR prevents the Host details “Summary” card from rendering as an empty shell when all of its child sections are gated off (notably on Fleet Free + Android), addressing the empty card above the Vitals section reported in #49441.
Changes:
- Hoists each section’s render condition into
show*booleans and returns early when none would render, skipping the<Card>entirely. - Updates the JSX to use the new
show*booleans for readability while keeping the underlying conditions unchanged. - Adds a React Testing Library test to assert the summary card renders nothing for a Free-tier Android host with no OS settings.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| frontend/pages/hosts/details/cards/HostSummary/HostSummary.tsx | Adds show* booleans and early return to avoid rendering an empty summary card. |
| frontend/pages/hosts/details/cards/HostSummary/HostSummary.tests.tsx | Adds coverage to ensure the summary card does not render for Free-tier Android hosts when empty. |
| changes/fix-49441-android-free-empty-summary-card | Release note / change entry (content excluded from review by policy). |
Files excluded by content exclusion policy (1)
- changes/fix-49441-android-free-empty-summary-card
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ver iOS/iPadOS - Drop trailing issue ref from the "hide empty card" comment (git blame is the audit trail). - Replace the two "---" literals with DEFAULT_EMPTY_CELL_VALUE from utilities/constants. - Parametrize the empty-card test over Android, iOS, and iPadOS — the fix covers all three, not just Android.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #49848 +/- ##
=======================================
Coverage 67.91% 67.91%
=======================================
Files 3905 3905
Lines 249669 249682 +13
Branches 13179 13190 +11
=======================================
+ Hits 169557 169567 +10
- Misses 64837 64840 +3
Partials 15275 15275
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
Files excluded by content exclusion policy (1)
- changes/fix-49441-android-free-empty-summary-card
Rename the changes file and update the line to reflect that the fix also covers Free-tier iOS/iPadOS hosts with no OS settings, not just Android.
- Switch the empty-return in HostSummary from <></> to null (codebase convention: 171 uses of `return null` vs 25 of `return <></>`). - Widen the return type to JSX.Element | null accordingly. - Type the parametrized empty-card test tuple as [string, HostPlatform, string] so the platform string is checked against HostPlatform, dropping the `as "android" | "ios" | "ipados"` cast.
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
Files excluded by content exclusion policy (1)
- changes/fix-49441-free-tier-empty-summary-card
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
Files excluded by content exclusion policy (1)
- changes/fix-49441-free-tier-empty-summary-card
Self-reviewSmall, well-scoped fix. Behavior is preserved for every populated case; only the empty shell is skipped. Tests cover Free-tier Android, iOS, and iPadOS. No must-fixes. Must fixNone. Should fixNone. Nit
Nice things worth calling out
Test coverageAdequate. The new |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
WalkthroughUpdated 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Issue
Resolves #49441
Description
On Fleet Free, the host details page renders an empty card above the Vitals section for hosts where every summary section is gated off. The reporter flagged this for Android, but the same shape hits iOS and iPadOS too:
!isAndroidHost,!isIosOrIpadosHost)!isPremiumTier)When none apply, the wrapper still renders empty. Hoisted each section's visibility into named
show*booleans and short-circuit to<></>when none are true, so the card is skipped instead of rendering an empty shell. The rendering conditions themselves are unchanged.Screenshot mock returning null instead of the card
Testing
HostSummarytests asserting the card renders nothing for Free-tier Android, iOS, and iPadOS hosts with no OS settingsyarn test --testPathPattern=HostSummary— 12/12 passmake lint-js— 0 errors in touched filesSummary by CodeRabbit