fix(explore): honor column Label in filter search and pill - #43404
fix(explore): honor column Label in filter search and pill#43404sadpandajoe wants to merge 3 commits into
Conversation
The Explore filter control's column-picker searched only column_name, so a column with a verbose_name (display Label) set could not be found by typing its Label text, even though the Metrics control in the same panel already supports this via optionFilterProps. Add column_name and verbose_name to each subject option and set optionFilterProps accordingly, mirroring the pattern already used by AdhocMetricEditPopover's column select.
A saved filter's pill/clause label was built from translateToSql(), which always renders the technical subject (column_name), so a column with a verbose_name set showed its technical name on the pill instead of the Label -- unlike the Metrics control, which already prefers verbose_name for its default label. Let translateToSql optionally resolve a matching column's verbose_name for display, and pass the available columns through AdhocFilter.getDefaultLabel() from both pill renderers. The SQL/query path (translateToSql() called with no columns, e.g. the Custom SQL tab and getTooltipTitle()) is unchanged and still resolves to the technical column name.
The prior test coverage for the pill-label fix asserted AdhocFilter.getDefaultLabel() directly but never rendered the actual components that call it, so reverting the getDefaultLabel(options) call at either renderer call site would leave every test green. Add a render-level assertion for both AdhocFilterOption and DndFilterSelect (which renders DndAdhocFilterOption) that a column with a verbose_name shows that label on the rendered pill, closing the gap at the layer where the bug is user-visible.
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #43404 +/- ##
=======================================
Coverage 66.74% 66.74%
=======================================
Files 2876 2876
Lines 164228 164238 +10
Branches 37891 37898 +7
=======================================
+ Hits 109617 109625 +8
- Misses 52453 52455 +2
Partials 2158 2158
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Code Review Agent Run #2c70e7Actionable Suggestions - 0Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
When a dataset column has a display Label (
verbose_name) set, the Explore filtercontrol had two related display bugs:
the Label, so searching for the Label text returned no results.
column name instead of the Label — inconsistent with the Metrics control in the
same panel, which already displays the Label correctly for the same column.
The generated SQL and query results were already correct in both cases; this change
is a display/search-matching fix only. Both fixes mirror the existing, working
implementation already used by the Metrics control for the same column metadata.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: searching a filter column by its Label returns no match; a saved filter pill
for a labeled column shows the technical column name (e.g.
num > 500).before.mp4
After: searching by Label matches the column; the saved filter pill shows the Label
(e.g.
total_count > 500), matching how the Metrics control already displays it.Evidence to follow as a comment on this PR.
after.mp4
TESTING INSTRUCTIONS
(e.g. the
birth_namesdataset'snumcolumn, Labeltotal_count).in the results (previously it did not).
total_count > 500) rather thanthe technical column name.
name (e.g.
num > 500) — the underlying query is unaffected by this change.use the technical column name exactly as before.
Automated coverage:
AdhocFilterEditPopoverSimpleTabContent.test.tsx,AdhocFilter.test.ts,AdhocFilterOption.test.tsx,DndFilterSelect.test.tsx.ADDITIONAL INFORMATION