Skip to content

fix(react-ui): polish 'Fits in my GPU' filter to use design-system Toggle#10030

Merged
mudler merged 2 commits into
masterfrom
polish/models-fits-gpu-toggle
May 27, 2026
Merged

fix(react-ui): polish 'Fits in my GPU' filter to use design-system Toggle#10030
mudler merged 2 commits into
masterfrom
polish/models-fits-gpu-toggle

Conversation

@localai-bot
Copy link
Copy Markdown
Collaborator

Summary

Polish pass on the Fits in my GPU filter added in #10017.

The filter shipped with a raw <input type=\"checkbox\"> dropped next to the themed range slider, which broke the visual language of the row (browser-default checkbox chrome vs. tokenized slider vs. pill filter buttons above).

This PR re-skins the control to match the rest of the app — no behavior changes.

  • Swap the raw checkbox for the shared <Toggle> component already used by Backends, Settings, Traces, AgentCreate.
  • Adopt the existing filter-bar-group__toggle class, dropping 5 duplicated inline style props.
  • Add a fa-microchip icon to mirror the per-row fit indicator in the table — the toggle now visually links to what it filters on.
  • Add a subtle left divider (border-left: var(--color-border-subtle)) so the filter reads as separate from the context-size slider on its left ("filter a result set" is a different job from "configure VRAM estimation").

Before / After

Before After
Control native <input type=\"checkbox\"> themed <Toggle> track + thumb
Styles 5 inline style props shared filter-bar-group__toggle class
Icon none fa-microchip (matches table row indicator)
Separator none left divider distinguishes filter from slider config

Test plan

  • Open /app/models on a host with detected GPU memory — toggle renders with themed track + microchip icon.
  • Click the toggle — only models whose VRAM estimate fits remain; models with unknown estimate stay visible (existing behavior, preserved).
  • Keyboard tab to the toggle — focus ring appears on the track.
  • Hover the toggle — track brightens (built-in Toggle hover state).
  • Reload the page — toggle state persists via localStorage (existing behavior, preserved).
  • Open on a host with no GPU detected (totalGpuMemory === 0) — toggle is hidden (existing behavior, preserved).
  • Confirm in both light and dark theme.

Follow-ups not in this PR (left for separate decisions):

  • The filter conceptually belongs in the filter-button row above, not the context-slider row — moving it changes mental model, not polish.
  • Copy inconsistency: filters.fitsGpu is "Fits in my GPU" while table.fits is "Fits in GPU" in the same locale file.

Assisted-by: Claude:claude-opus-4-7

mudler added 2 commits May 27, 2026 18:59
…ggle

The recently added VRAM-fit filter in the Models page used a raw
<input type="checkbox"> next to the themed range slider, breaking the
visual language of the rest of the row. Swap it for the shared
<Toggle> component (already used by Backends, Settings, Traces,
AgentCreate), adopt the filter-bar-group__toggle class to drop the
duplicated inline styles, add a fa-microchip icon to mirror the
per-row fit indicator, and add a subtle left divider so the filter
reads as separate from the context-size slider on its left.

Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Two follow-ups on the previous polish pass:

1. Move the toggle from the context-slider row into the filter-button
   row above. The toggle is a filter on the result set, not a config
   for VRAM estimation, so it belongs with the type chips and backend
   select. The context slider stays its own thing.

2. Unify the label copy. The same locale file had "Fits in my GPU"
   for the filter and "Fits in GPU" for the per-row indicator; pick
   the shorter, possessive-free variant everywhere (en/de/es/it/zh-CN).
   Update e2e selectors to match.

Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
@mudler mudler merged commit 02a0e70 into master May 27, 2026
57 of 58 checks passed
@mudler mudler deleted the polish/models-fits-gpu-toggle branch May 27, 2026 19:09
mudler added a commit that referenced this pull request May 27, 2026
…2e (#10031)

* fix(react-ui): force .check() on hidden Toggle input in fits-filter e2e

The polish PR (#10030) swapped the raw <input type=checkbox> for the
shared <Toggle> component, which visually hides its native input via
opacity:0;width:0;height:0. Playwright's .check() waits for visibility
before clicking and times out after 30 s, breaking two UI E2E tests:

  - enabling fits filter hides models that exceed available VRAM
  - fits filter state persists after reload

Pass { force: true } to skip the visibility check; the input is still
the real focusable checkbox and toggles state on click. The companion
.toBeChecked() assertion only reads state and works unchanged.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude:claude-opus-4-7

* fix(react-ui): click visible Toggle track in fits-filter e2e

force:true skips the actionability checks but not the viewport check,
and the Toggle's hidden input has width:0;height:0 so Playwright still
reports "Element is outside of the viewport". Click the visible
.toggle__track inside the filter-bar-group__toggle wrapper instead —
that's what a real user clicks, and label-input association toggles
the wrapped checkbox naturally.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude:claude-opus-4-7

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants