Wire up date filtering in the Search toolbar - #396
Conversation
qsConfig has accepted dateFields since the search system was built, and
every list's config defaults to ['modified', 'created'], but the Search
component never rendered date inputs - an explicit TODO at the fallback
text input. Lists therefore could not offer date filtering at all.
Search now renders a date-specific control when the selected search
column is one of the qsConfig dateFields: a native date input plus an
operator select (On or after -> __gte, Before -> __lt; the two
operators whose semantics are exact for date-only values against the
API's datetime fields). Submitting calls onSearch with the suffixed
parameter (e.g. created__gte=2026-06-01), which the existing leftover
chip handling already displays and removes; getChipsByKey now labels
such chips with the base column's name ('Created (created__gte)')
instead of the raw key.
First consumers: the Jobs list gains Created and Finished search
columns (finished added to its dateFields), and the Activity Stream
gains a Time column on its timestamp field. Any other list can opt in
by adding a search column whose key is in its dateFields.
New strings follow the convention of awaiting the next routine catalog
extract (English fallback meanwhile).
A value typed for one column survived switching to another. For date columns this was exploitable as an invalid API call: a controlled date input renders a stale text value as an empty-looking field while leaving the submit button enabled (searchValue is still truthy), so clicking submit sent e.g. created__gte=foo to the API. The value is now cleared on column switch; tests cover the leak scenario and Enter-key submission in the date input.
Inside the input group the operator select flex-grew to the full toolbar width, squeezing the date input to zero width - the control looked like a lone dropdown with no way to enter a date. Found in visual review; the select now keeps its natural width and the date input takes the remaining space.
Date filter values stay strings deliberately: they are submitted as ISO dates, which is exactly the format the API expects. Parsing them into Date objects would only force formatting them back.
There was a problem hiding this comment.
Pull request overview
This PR wires up date filtering in the UI search toolbar by rendering a date-specific control for columns whose keys are included in a list’s qsConfig.dateFields, and ensures resulting query params and filter chips are displayed with clearer labeling.
Changes:
- Add a date operator + native date input UI in
Searchthat submits__gte/__lt-suffixed params. - Improve filter chip labeling so date-operator params (e.g.
created__gte) display using the base column name. - Enable date-search columns in initial consumers (Jobs list and Activity Stream) by adding appropriate search columns and
dateFields.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| awx/ui/src/util/qs.js | Clarifies that date field values remain strings for API submission. |
| awx/ui/src/screens/ActivityStream/ActivityStream.js | Adds timestamp as a date-searchable field and exposes a Time search column. |
| awx/ui/src/components/Search/Search.js | Renders date operator + date input UI and submits key__<op> params. |
| awx/ui/src/components/Search/Search.test.js | Adds coverage for date control rendering and submission behavior. |
| awx/ui/src/components/Search/getChipsByKey.js | Labels operator-suffixed date params using the base column name when available. |
| awx/ui/src/components/Search/getChipsByKey.test.js | Tests chip labeling for __gte / __lt params. |
| awx/ui/src/components/JobList/JobList.js | Adds Created/Finished search columns and extends dateFields to include finished. |
| const handleDropdownSelect = ({ target }) => { | ||
| const { key: actualSearchKey } = columns.find( | ||
| ({ name }) => name === target.innerText | ||
| ); | ||
| onShowAdvancedSearch(actualSearchKey === 'advanced'); | ||
| setIsFilterDropdownOpen(false); | ||
| setSearchKey(actualSearchKey); | ||
| // a value typed for the previous key must not leak into the next one - | ||
| // a controlled date input renders a stale text value as an empty field | ||
| // while leaving the submit button enabled, allowing a non-date value | ||
| // through to the API | ||
| setSearchValue(''); | ||
| }; |
isDateOperatorOpen survived column switches, so leaving a date column with the dropdown expanded and returning rendered it pre-opened. The flag now resets alongside the other dropdown state; test covers the switch-away-and-back path.
|
Good catch, fixed: the operator dropdown state now resets when switching search columns, with a test for the switch-away-and-back case. |
|
Heads-up on i18n: this PR introduces four new msgids ( |
cigamit
left a comment
There was a problem hiding this comment.
Tested and working perfectly
SUMMARY
qsConfighas accepteddateFieldssince the search system was built — every list's config defaults to['modified', 'created']— but the Search component never rendered date inputs (an explicit TODO at the fallback text input), so no list could offer date filtering.Search now renders a date-specific control when the selected search column is one of the qsConfig
dateFields:type=dateinput plus an operator select — On or after →__gte, Before →__lt(deliberately the two operators whose semantics are exact when a date-only value meets the API's datetime fields;lte/gton a bare date are off-by-a-day traps)onSearchwith the suffixed param (e.g.created__gte=2026-06-01); the existing leftover-chip handling displays and removes it, andgetChipsByKeynow labels such chips with the base column's name (Created (created__gte)) instead of the raw keyFirst consumers: the Jobs list gains Created and Finished search columns (
finishedadded to its dateFields), and the Activity Stream gains a Time column on itstimestampfield. Any other list opts in by adding a search column whose key is in itsdateFields.Closes the 'date filtering not wired up' entry from the UI known-gaps list.
ISSUE TYPE
COMPONENT NAME
ASCENDER VERSION
ADDITIONAL INFORMATION
Tests: six new Search tests (date control renders for date columns only; default-operator submit; operator switch changes the param; stale-value leak regression; Enter-key submit; plain input preserved otherwise) and a getChipsByKey labeling test.
New UI strings follow the catalog convention (English fallback until the next routine extract). Independent of all five open PRs — verified pairwise with
git merge-tree.