Fleet UI: Unreleased bug fixes to command palette (unsupported screen size, hide fleet picker fleets based on page, add fleet picker empty state) - #47345
Conversation
- Hide overlay + content below 768px so the unsupported screen size
layout takes over without closing the dialog
- Filter "Unassigned" and "All fleets" from the fleet picker on pages
whose useTeamIdParam config rejects them (e.g. Dashboard hides
Unassigned; /settings/fleets/{users,options,settings} hides All) —
matches the in-page team dropdown and avoids silent redirect-to-default
- Add a "No fleets match" / "No fleets found" empty state to FleetPicker
for parity with the other pickers
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #47345 +/- ##
==========================================
- Coverage 67.19% 67.19% -0.01%
==========================================
Files 3151 3271 +120
Lines 227023 227339 +316
Branches 11889 11766 -123
==========================================
+ Hits 152545 152755 +210
- Misses 60740 60845 +105
- Partials 13738 13739 +1
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:
|
WalkthroughThis pull request makes three targeted fixes to the Fleet Spotlight command palette. First, it introduces routing-prefix helper functions ( Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Pull request overview
This PR addresses several UX issues in Fleet’s command palette (Spotlight), primarily around unsupported viewport sizes and fleet switching behavior so the palette behaves consistently with in-page team dropdowns.
Changes:
- Hide the command palette overlay/content below the unsupported breakpoint (<768px) so the UnsupportedScreenSize layout can take over visually.
- Add route-based filtering logic so the fleet picker can hide Unassigned and/or All fleets where the current page’s
useTeamIdParamconfiguration doesn’t allow them. - Add a cmdk
Command.Emptyempty-state to the FleetPicker so “no results” searches don’t render as a blank list, plus tests for the new behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| frontend/components/CommandPalette/helpers.ts | Adds pathSupportsUnassigned / pathSupportsAllFleets helpers and route prefix lists for fleet option filtering. |
| frontend/components/CommandPalette/helpers.tests.ts | Adds unit tests for the new pathname helper functions. |
| frontend/components/CommandPalette/components/FleetPicker.tsx | Adds Command.Empty to show “No fleets found/match” empty states. |
| frontend/components/CommandPalette/components/FleetPicker.tests.tsx | Adds tests covering FleetPicker empty-state behavior (including cmdk filtering). |
| frontend/components/CommandPalette/CommandPalette.tsx | Filters availableTeams in the fleet switcher based on current pathname support for All/Unassigned. |
| frontend/components/CommandPalette/_styles.scss | Hides the palette overlay/content under $break-xs so it doesn’t visually overlap UnsupportedScreenSize. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Pages where the "Unassigned" (id 0) fleet is a valid context. Mirrors each | ||
| // page's `useTeamIdParam({ includeNoTeam })` declaration — anywhere outside | ||
| // this set, picking Unassigned would trigger a redirect-to-default and | ||
| // effectively do nothing, so the fleet picker hides the option entirely. | ||
| const UNASSIGNED_SUPPORTED_PREFIXES = [ | ||
| paths.CONTROLS, // /controls + sub-routes | ||
| paths.SOFTWARE, // /software + sub-routes | ||
| `${paths.ROOT}hosts`, // manage hosts + host details | ||
| `${paths.ROOT}policies`, // policies (manage, details, edit, live, new) |
There was a problem hiding this comment.
@cdcme - putting this back in draft to see how hard would it be to refactor to a unified "should we show unassigned" / "should we show all fleet" code design
Replaces three separate prefix lists with PAGE_FLEET_RULES — one row per path prefix, each declaring overrides off the defaults (all:"native", unassigned:"hidden"). Picker visibility and buildFleetSwitchUrl read from one resolver, so the two dimensions can't drift. Behavior change: /software/library now stays put when switching to Unassigned (inherits unassigned:"native" from /software) instead of bouncing to /hosts/manage?fleet_id=0.
ff1cff7 to
a42ed09
Compare
a42ed09 to
dcbed4b
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
frontend/components/CommandPalette/helpers.tests.ts (1)
898-903: ⚡ Quick winAdd an explicit
SOFTWARE_LIBRARYassertion inpathSupportsUnassignedtests.
/software/librarydepends on inheritedunassigned: "native"behavior from/software; adding a direct assertion here will guard against future rule-table regressions that could hide “Unassigned” in the picker.Suggested test addition
it("returns true for software pages", () => { expect(pathSupportsUnassigned(paths.SOFTWARE)).toBe(true); + expect(pathSupportsUnassigned(paths.SOFTWARE_LIBRARY)).toBe(true); expect(pathSupportsUnassigned(paths.SOFTWARE_TITLE_DETAILS("3"))).toBe( true ); });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/components/CommandPalette/helpers.tests.ts` around lines 898 - 903, Add an explicit assertion checking that pathSupportsUnassigned(paths.SOFTWARE_LIBRARY) returns true in the same test block; locate the test that currently asserts SOFTWARE and SOFTWARE_TITLE_DETAILS (in frontend/components/CommandPalette/helpers.tests.ts) and add expect(pathSupportsUnassigned(paths.SOFTWARE_LIBRARY)).toBe(true) alongside the existing assertions to guard against regressions in the rule table.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@frontend/components/CommandPalette/helpers.tests.ts`:
- Around line 898-903: Add an explicit assertion checking that
pathSupportsUnassigned(paths.SOFTWARE_LIBRARY) returns true in the same test
block; locate the test that currently asserts SOFTWARE and
SOFTWARE_TITLE_DETAILS (in frontend/components/CommandPalette/helpers.tests.ts)
and add expect(pathSupportsUnassigned(paths.SOFTWARE_LIBRARY)).toBe(true)
alongside the existing assertions to guard against regressions in the rule
table.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1c568e40-7ec1-40d2-84b1-de101dc72658
📒 Files selected for processing (2)
frontend/components/CommandPalette/helpers.tests.tsfrontend/components/CommandPalette/helpers.ts
Issue
Closes #47295
Closes #47310
Closes #47311
Description
Screenrecording of fixes
Screen.Recording.2026-06-10.at.1.55.08.PM.mov
Testing
Summary by CodeRabbit
New Features
Improvements
Tests