Repository navigation
Conversation
A filter set on the Search tab lives in the chart-level `where`, while builder chart types filter per-series via `aggCondition`. Switching chart types reset the filter instead of carrying it over. Carry a single series' aggCondition into `where` when switching to Search/EventPatterns, and the Search `where` into the new series' aggCondition when switching to a builder chart type. Add E2E coverage for both directions. HDX-5602 Co-authored-by: Drew Davis <pulpdrew@gmail.com>
🦋 Changeset detectedLatest commit: 583b550 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
|
| async getLuceneWhere(scope: 'chart' | 'series' = 'chart'): Promise<string> { | ||
| await this.setWhereLanguage('Lucene', scope); | ||
| return this.whereInput(scope).luceneInput.inputValue(); |
There was a problem hiding this comment.
Reader changes filter language
getLuceneWhere switches the input to Lucene before reading it. Both new tests therefore check that the filter text survived, but could pass even if the chart-type switch carried the wrong language. Selecting Lucene also changes the editor’s stored language preference. Check the carried language before changing the input, and cover an SQL filter.
E2E Test Results✅ All tests passed • 396 passed • 1 skipped • 1360s
Tests ran across 4 shards in parallel. |
|
@pulpdrew I think addressing some of the UX issues on this page could also help with carrying the WHERE across chart types. I tried to address this in the Explore prototype: https://hyperdx-oss-git-elizabet-search-view-switcher-hyperdx.vercel.app/explore?source=975eb452c10479ad&where=&select=&whereLanguage=sql&filters=%255B%255D&orderBy=&mode=timeseries&isLive=false I wonder if we could make WHERE, Data Source, and Date top-level controls, along with the chart name/Run/save. Then below those pickers, we could have the series/chart-specific configuration. I think that would make the overall structure a lot clearer. Right now, the page feels a bit confusing, especially when switching between chart types. |
I think that largely makes sense. One tricky aspect of that is that some chart types support independent, per-series WHERE and others only support a single top-level WHERE. We can defer this improvement until we decide it's worth doing the restructuring. |
Why
Filters selected from the Search panel didn't stick when switching to another chart type (e.g. Time Series). On a Search chart the filter lives in the chart-level
whereform field, while builder chart types (Line/Bar/Table/Number/Pie) filter per-series via each series'aggCondition. The display-type switch effect clearedwhereand created a default series with an emptyaggCondition, silently dropping the filter.Fixes HDX-5602.
What
In
EditTimeChartForm's display-type switch effect:where(and its language) into the new single series'aggCondition, instead of starting from an empty condition.aggCondition(and its language) back intowhere. Only when there's exactly one series andwhereis empty, so a filter isn't guessed across multiple series or allowed to clobber an existingwhere.The hidden chart-level
whereis still cleared on the forward switch so the filter isn't applied twice (once globally, once per-series) and stays visible in the per-series WHERE the builder shows.Tests
Added two E2E tests in
chart-explorer.spec.tscovering both directions, plus agetLuceneWherereader on the chart editor component.Linear Issue: HDX-5602