Repository navigation
Type-to-filter dropdowns for the aliquot and sample forms (part of #209) - #212
Merged
Merged
Conversation
Part of #209. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #209. This PR does not close it: the Storage and Consumables forms and the box page's assign list are still to do (see "Not in this PR").
The problem
The Parent aliquot dropdown rendered one
<option>per aliquot (about 10,700 in the lab's data), so the form was slow to load and the right aliquot was impossible to find by scrolling. Sample and the other dropdowns could only be scrolled too.What it does
/samples/aliquot-options/?q=..., which returns at most 20 matches and says when there are more (the list then shows "Keep typing to narrow the results"). The page no longer carries thousands of options, and the number of queries does not depend on how many aliquots exist (both are tested).hela p8finds the p8 aliquots of HeLa. A word that is a number, with or without a leading#, also matches the aliquot number, and an aliquot with exactly that number is listed first. Soft-deleted aliquots are not offered.HeLa #1234 · Cells · p8 · 2026-03-05(missing parts are left out).How it is built
static/krill/js/combobox.js(about 300 lines), loaded by the base layout, in the same style as the app's other scripts. No new dependency, no build step.<select>, which stays in the page (visually hidden) and holds the value. Django's fields, validation, prefilled values, form submission and "Create child aliquot" are unchanged; the create page's script that clears the Box field now also notifies the control.<select>is put back so a field never disappears.sample/widgets.py(RemoteSelect,aliquot_choice_label,mark_comboboxes), thealiquot_optionsview, anddata-attributes on the form widgets. Validation of Parent aliquot still uses the full queryset, so any existing aliquot that is posted is accepted and an unknown id is refused.Decisions to check
Not in this PR (still open in #209)
Storage forms (site, device, shelf, rack, box), Consumables forms, and the box detail page's "assign aliquot" list, which also overlaps #207.
Verification
sample/tests/test_combobox.py(28 tests): the endpoint (login required, blank query, case, passage and type, words combined, number with and without#, exact number first, the 20-result limit and themoreflag, deleted excluded, ordering, constant query count); the widget and forms (only a blank option is rendered, a chosen or current parent shows with its label, valid and unknown posted ids, no growth in queries as aliquots are added, which dropdowns are marked); and the pages (the prefilled create-child page ships one option instead of many, the layout loads the script). Full suite: 765 tests, OK. No migrations.Manual checklist for review
hela,p8,#123, a number) and pick a result; the form submits and the child has that parent.🤖 Generated with Claude Code