Skip to content

Fleet UI: Unreleased bug fixes to command palette (unsupported screen size, hide fleet picker fleets based on page, add fleet picker empty state) - #47345

Merged
RachelElysia merged 2 commits into
mainfrom
47295-47310-47311-palette
Jun 11, 2026
Merged

Fleet UI: Unreleased bug fixes to command palette (unsupported screen size, hide fleet picker fleets based on page, add fleet picker empty state)#47345
RachelElysia merged 2 commits into
mainfrom
47295-47310-47311-palette

Conversation

@RachelElysia

@RachelElysia RachelElysia commented Jun 10, 2026

Copy link
Copy Markdown
Member

Issue

Closes #47295
Closes #47310
Closes #47311

Description

  • 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

Screenrecording of fixes

Screen.Recording.2026-06-10.at.1.55.08.PM.mov

Testing

  • Added/updated automated tests
  • QA'd all new/changed functionality manually

Summary by CodeRabbit

  • New Features

    • Command palette now intelligently filters available fleet options based on the current page.
  • Improvements

    • Hidden on small screens for improved mobile experience.
    • Added contextual empty state messages for fleet searches with no matches.
  • Tests

    • Expanded test coverage for fleet selection and search scenarios.

- 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
@RachelElysia
RachelElysia requested a review from a team as a code owner June 10, 2026 17:54
Copilot AI review requested due to automatic review settings June 10, 2026 17:54
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.19%. Comparing base (4b6e494) to head (a42ed09).
⚠️ Report is 45 commits behind head on main.

Files with missing lines Patch % Lines
...ntend/components/CommandPalette/CommandPalette.tsx 63.63% 4 Missing ⚠️
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     
Flag Coverage Δ
frontend 57.93% <95.23%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This pull request makes three targeted fixes to the Fleet Spotlight command palette. First, it introduces routing-prefix helper functions (pathSupportsUnassigned and pathSupportsAllFleets) that determine which pages permit fleet switching to "Unassigned" or "All fleets" options. Second, it adds a search-aware empty state to the fleet picker that displays "No fleets match …" when a search yields no results and "No fleets found." when the list is empty. Finally, it integrates these helpers into CommandPalette to filter the fleet list by page context and adds a CSS media query to hide the palette on screens narrower than 768px, preventing it from overlaying the unsupported-screen-size message on small viewports.

Possibly related PRs

  • fleetdm/fleet#46346: Touches CommandPalette and delegates fleet-context URL construction to buildFleetSwitchUrl — strongly related to the pathSupports*/buildFleetSwitchUrl changes in this PR.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the three main changes: command palette visibility on small screens, fleet picker filtering based on page support, and empty state messaging.
Description check ✅ Passed The PR description covers the key changes, references all three closed issues, provides a screen recording, and confirms testing (automated tests and manual QA) were completed.
Linked Issues check ✅ Passed All three linked issues are addressed: #47295 (hide palette below 768px via SCSS), #47310 (filter Unassigned/All fleets based on page rules), #47311 (add empty state to FleetPicker).
Out of Scope Changes check ✅ Passed All file changes directly support the stated objectives: responsive hiding, fleet filtering logic, empty state rendering, and comprehensive test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 47295-47310-47311-palette

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useTeamIdParam configuration doesn’t allow them.
  • Add a cmdk Command.Empty empty-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.

Comment on lines +435 to +443
// 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)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

cdcme
cdcme previously approved these changes Jun 10, 2026
@RachelElysia
RachelElysia marked this pull request as draft June 10, 2026 21:33
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.
@RachelElysia
RachelElysia force-pushed the 47295-47310-47311-palette branch from ff1cff7 to a42ed09 Compare June 11, 2026 14:27
@RachelElysia
RachelElysia force-pushed the 47295-47310-47311-palette branch from a42ed09 to dcbed4b Compare June 11, 2026 15:48
@RachelElysia RachelElysia changed the title Fleet UI: Fix command palette unreleased UX bugs Fleet UI: Unreleased bug fixes to command palette (unsupported screen size, hide fleet picker fleets based on page, add fleet picker empty state) Jun 11, 2026
@RachelElysia
RachelElysia marked this pull request as ready for review June 11, 2026 18:50
@RachelElysia
RachelElysia requested a review from cdcme June 11, 2026 18:50

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
frontend/components/CommandPalette/helpers.tests.ts (1)

898-903: ⚡ Quick win

Add an explicit SOFTWARE_LIBRARY assertion in pathSupportsUnassigned tests.

/software/library depends on inherited unassigned: "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

📥 Commits

Reviewing files that changed from the base of the PR and between ac6f4a3 and dcbed4b.

📒 Files selected for processing (2)
  • frontend/components/CommandPalette/helpers.tests.ts
  • frontend/components/CommandPalette/helpers.ts

@RachelElysia
RachelElysia merged commit 95514a9 into main Jun 11, 2026
39 checks passed
@RachelElysia
RachelElysia deleted the 47295-47310-47311-palette branch June 11, 2026 19:47
RachelElysia added a commit that referenced this pull request Jun 15, 2026
…rted screen size, hide fleet picker fleets based on page, add fleet picker empty state) (#47345) (#47594)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants