Skip to content

Search the Aliquots and Samples lists by field - #214

Merged
olsonjp merged 1 commit into
mainfrom
field-filters-aliquots-samples
Nov 11, 2026
Merged

olsonjp merged 1 commit into
mainfrom
field-filters-aliquots-samples

Conversation

@olsonjp

@olsonjp olsonjp commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Closes #211

Follow-up for the other lists: #213

What it does

  • Aliquots toolbar, one row: search everything, Sample, Passage, More filters, Search, New Aliquot (right-aligned). Every control is the same height. It wraps on narrow widths: search full width, Sample and Passage side by side, then the rest, and New Aliquot is icon-only at the narrowest.
  • More filters is a button-like summary in the row (with a flipping ▾ and a count of active fields). Its panel opens below the row, by CSS alone (:has()), and opens by itself when one of its fields is in use. It holds Lab member, Date from and Date to (native date pickers, dark-mode aware), Location, Aliquot number, Disposition and Type, each with a one-line hint. Disposition and Type moved here from the toolbar.
  • Matching, and every filled-in field must match (AND):
    • Sample, Lab member, Location: part of the text, ignoring case; every word must appear; "quoted words" stay together. Lab member matches name, username or initials.
    • Passage: exact, ignoring case (p8 does not match p80). A trailing * matches the start (P8*). The rule is in the input's tooltip and repeated at the top of the More panel.
    • Aliquot number: exact, with or without #. Dates: from means on or after, to means on or before, the same date in both means that day. Aliquots with no sample date are never in a range, and the page says how many were left out.
  • Search everything now splits words: every word must match some field, so hela p8 works. "Quoted words" keep the old single-phrase behaviour. The Samples, Sources and Aliquot Types search boxes split words too.
  • Chips and clearing: one removable chip per active filter that states the rule ("Passage is P8", "Sample contains HeLa", "Date from 2025-03-01"). They are links, so no JavaScript, and each removes only its own parameter, keeps the sort and goes back to page 1. Clear all appears with two or more chips and resets the filters, the search words and the pills, keeping the sort. When nothing matches the page lists the active filters, each with a remove link.
  • Shareable: everything is in the page address. The parameter names are f_sample, f_passage, f_member, f_date_from, f_date_to, f_location, f_number (and the existing disposition, aliquot_type, q); treat them as stable.
  • Samples list adopts the same bar with Source, Experiment and Notes fields, chips and Clear all.
  • One definition per list. Each list's fields are described once as a FilterSpec (sample/list_filters.py); the query filters, inputs, chips and suggestions all come from it, through two shared partials. Another list adopts it by writing a spec.
  • Page header reduced to the title and one description line, and the repeated "Aliquots" heading above the table is gone. The header wording no longer says "tube" (a test that asserted the old text is updated).
  • Template comments: the multi-line {# #} that was rendering as visible text is now a {% comment %} block. It was the only one in the project, and a test guards the filter templates.
  • Docs: krill/sample/README.md explains searching by field, linked from docs/README.md.

Decisions to check

Verification

  • sample/tests/test_field_filters.py (55 tests): each field and its rule (passage exact vs *, member by name and initials, location, number, the date range edges and the no-date note), AND across fields, search-everything words and quotes, chips and Clear all (what each removes, what is kept), the More panel (what is in it, when it opens, the count), the toolbar order and header, the empty-result links, and the Samples list. Full suite: 827 tests, OK. No migrations.
  • Not checked by me: how it looks in a browser. The author reviewed the first layout and asked for the fixes made here; the one-row layout, equal heights, the More summary and the narrow-width wrapping have not been reviewed visually.

🤖 Generated with Claude Code

Closes #211.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@olsonjp
olsonjp merged commit 58df0ee into main Nov 11, 2026
1 check passed
@olsonjp
olsonjp deleted the field-filters-aliquots-samples branch November 11, 2026 18:02
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.

Search by specific fields in the Aliquots list (for example Sample X with Passage Y), and later other lists

1 participant