Skip to content

feat(ui/filters): searchable filter dropdown + bulk selection + query responsiveness#862

Open
akira69 wants to merge 7 commits intoDonkie:masterfrom
akira69:feat/ui-filter-search-upstream-split
Open

feat(ui/filters): searchable filter dropdown + bulk selection + query responsiveness#862
akira69 wants to merge 7 commits intoDonkie:masterfrom
akira69:feat/ui-filter-search-upstream-split

Conversation

@akira69
Copy link
Copy Markdown

@akira69 akira69 commented Feb 24, 2026

Summary

This PR makes the filament and spool list filters easier to use on larger datasets:

  • searchable filter popovers
  • Select All, Select None, and Clear for the visible filter options
  • backend search/index support to keep the affected list paths responsive

Review cleanup also carried forward the PR861 malformed-saved-state hardening into useSavedState, and removed split contamination that did not belong in this PR (spoolman/import_externaldb.py and a stray spool_count locale entry).

filtering
image
image

What Changed

  • Added searchable dropdown filtering to the affected table filters.
  • Added bulk filter actions that operate on the currently visible searched options.
  • Added backend search/query plumbing plus additive filament/spool search indexes.
  • Added /filament-name so the UI can populate filament-name filters without fetching full filament rows.
  • Guarded useSavedState parsing so malformed persisted state falls back to defaults and self-heals on reload.
  • Removed unrelated split artifacts from this branch.

Database Impact

  • Adds Alembic index migrations:
    • b76f1b4c3f5a (filament/vendor search indexes)
    • f1a3d9c2c4e1 (spool search indexes)
  • Migration type: additive indexes only.
  • No destructive schema or data rewrite.

Testing Performed

  • cd client && ./node_modules/.bin/eslint src/components/column.tsx src/components/otherModels.tsx src/utils/filtering.ts src/utils/saveload.ts
  • cd client && ./node_modules/.bin/prettier --check src/components/column.tsx src/components/otherModels.tsx src/utils/filtering.ts src/utils/saveload.ts public/locales/en/common.json
  • uv run ruff check spoolman/api/v1/filament.py spoolman/api/v1/other.py spoolman/api/v1/spool.py spoolman/database/filament.py spoolman/database/spool.py spoolman/database/utils.py migrations/versions/2026_02_11_1700-b76f1b4c3f5a_filament_search_indexes.py migrations/versions/2026_02_11_1710-f1a3d9c2c4e1_spool_search_indexes.py
  • cd client && npm ci && VITE_APIURL=/api/v1 npm run build
  • Local runtime: cd /Users/dfinch/Code/Spoolman_Labels/worktrees/pr862 && PATH=.venv/bin:$PATH SPOOLMAN_DIR_DATA=/tmp/spoolman_pr_862_data uv run uvicorn spoolman.main:app --host 0.0.0.0 --port 9862
  • Playwright on http://localhost:9862
    • seeded local vendor/filament/spool rows through the local API
    • verified filament manufacturer filter search narrows options
    • verified filament manufacturer Select All filters the table to the visible searched option
    • verified filament manufacturer Select None removes the searched selection and restores the full row set
    • verified filament material filter search plus Select All
    • verified filament material Clear
    • verified a selected material filter persists across reload and clears back to the full row set
    • verified spool filter search by vendor text plus Select All
    • injected malformed savedStates-spoolList-showArchived localStorage and verified the spool page still loaded and the saved state healed back to false
  • Observed PR862 startup migrations applying on the local PR DB:
    • b76f1b4c3f5a
    • f1a3d9c2c4e1

Test Checklist

  • Filament manufacturer filter search narrows the visible options
  • Select All checks all currently visible options and filters the filament list accordingly
  • Select None unchecks the currently visible searched option and restores the full filament row set
  • Clear removes the selected material filter values and restores the full filament row set
  • Selected material filter state persists across reload
  • Spool filter search can match vendor text and filter to the expected spool row
  • Malformed persisted savedStates-spoolList-showArchived state recovers without blanking the page
  • Frontend build succeeds with VITE_APIURL=/api/v1
  • Ruff check passes on the backend search/index files
  • Alembic migrations apply on local startup for the PR862 database
  • Backend query responsiveness was profiled with 100+ rows
  • The invalid column-id guard was directly exercised with a malformed table-state payload

@akira69 akira69 force-pushed the feat/ui-filter-search-upstream-split branch from 3d5c031 to 6401376 Compare February 25, 2026 15:19
@akira69 akira69 marked this pull request as draft February 26, 2026 16:47
@akira69 akira69 marked this pull request as ready for review February 26, 2026 17:12
@akira69 akira69 marked this pull request as draft February 27, 2026 20:50
@akira69 akira69 marked this pull request as ready for review March 2, 2026 05:38
@akira69 akira69 closed this Mar 2, 2026
@akira69 akira69 reopened this Mar 2, 2026
akira69 added 3 commits March 3, 2026 10:53
…tterns

- Wrapped selectAllFiltered and selectNoneFiltered in useCallback to prevent unnecessary Button re-renders
- Created useSimpleSortedArrayQuery factory function to eliminate duplicate fetch-and-sort patterns
- Consolidated 5 repeated fetch hooks (Materials, ArticleNumbers, LotNumbers, Locations) into factory calls
- Improved error messages to include endpoint names for better debugging
- All code quality checks pass: ESLint ✓, Prettier ✓
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.

1 participant