feat: drag to select time histogram for the date filter (#356) - #357
Merged
Merged
Conversation
The date range was four static inputs, which nobody uses to zoom in with: you cannot see where the runs are, so there is nothing to aim at. The filter modal now opens with a bar chart of the runs per time bucket above the range, the way Grafana and Kibana let you pick a period, and the four inputs sit below it as one horizontal row. Dragging across the bars fills the inputs and zooms the chart into the selection, re-bucketing finer, so dragging again drills further down. Clicking one bar selects that bucket, Reset Range goes back to the full span. The window is not state of its own: it is derived from the inputs on every render, so filter profiles and the merge dialogue carry the zoom without knowing that a chart exists. The bars follow every other filter but not the date range itself, through a new "dates" facet of apply_filters_except(), so widening the range brings the runs outside the window straight back. Hovering a bar gives a block per run with the three status rows the run graphs show. No new dependency: Chart.js and the date-fns adapter are already bundled. The brush is pointer handling over the category scale, the bucket separators are drawn by a small inline plugin because Chart.js only puts a gridline under a tick that carries a label, and the tooltip is an element because the one on the canvas is clipped by the chart and paints every line in a single colour. Two things that bundling makes easy to get wrong and that cost a debug round each: an element id is a property of window, so the chart may not be kept under the id of its canvas, and every module ends up in one script, so the new date parser could not be called parse_run_start - the one in common.js parses differently and the overview page broke on it. Also fixes the information popups. They flip above their icon when they would run off the bottom of the window, which still leaves the window when the icon is itself below the fold; the extra filter row made that reachable. They are now clamped to the window. Tests: 5 robot tests in 06_filters, 18 JavaScript tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Merged
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.
Fixes #356
What
The date range was four static inputs, which nobody uses to zoom in with: you cannot see where the runs are, so there is nothing to aim at. The filter modal now opens with a bar chart of the runs per time bucket above the range, the way Grafana and Kibana let you pick a period. The four date/time inputs moved below it into one horizontal row.
The window is not state of its own: it is derived from the four inputs on every render, so filter profiles and the merge dialogue carry the zoom without knowing a chart exists, and the filter pipeline is untouched.
The bars follow every other filter (runs, tags, versions, metadata, custom filters, suite path) but not the date range itself, through a new
"dates"facet of the existingapply_filters_except(). That is what makes widening possible: the runs outside the window come straight back. The amount filter is left out for the same reason it is left out of the option counts.How
No new dependency.
chartjs-plugin-zoomwould have meant a CDN entry plus a local copy for--offlinedependencies, so instead:getValueForPixelgives the bucket index, so a selection always covers whole bars);Bug fixed along the way
Information popups flip above their icon when they would run off the bottom of the window, which still leaves the window when the icon is itself below the fold. The extra filter row made that reachable on the Suite Path row at 800px; they are now clamped to the window.
Notes
Two traps this codebase makes easy to hit, both cost a debugging round:
idis a property ofwindow, so a chart may not be kept under the id of its canvas —window.dateHistogramGraphwas the canvas, and.destroy()silently did not exist;parse_run_start: the one incommon.jsparses differently and the overview page broke on it. It isget_run_start_date()now.No new CLI flag, setting, endpoint or stored state. Every existing element id is unchanged.
Tests
06_filters(bars, drag-zoom, bar click, reset, following the other filters) plus 6 keywords.Checked against a generated 500-run dashboard (70 days, 5-10 runs a day, 41k tests): first render 4.6s, filter modal with histogram 0.85s, drag-zoom and re-bucket 0.55s.
Docs
docs/filtering.mdsections 4 and 5, plus a line inREADME.mdandsetup.py.🤖 Generated with Claude Code