-
Notifications
You must be signed in to change notification settings - Fork 16.6k
fix: extra filters for chart data endpoint #10359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current logic generates an invalid filter (picked up by TS linter in superset-ui).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be 2020 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fc5df9a to
01473ce
Compare
| op: Array.isArray(values) ? 'IN' : '=', | ||
| val: values, | ||
| })) | ||
| .filter(filter => filter.val !== null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when user clear out a filter, it's value will be null, and we need to send out this to backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@graceguo-supercat when the filter is cleared, the filter will be removed, thus triggering a filter event (tested that it works properly on both legacy and new charts). Having an undefined value for a binary or set filter is also invalid according to the type declarations on superset-ui, so if this is the case we probably need to make changes there. See https://github.com/apache-superset/superset-ui/blob/97e7ba99d0efc363805a415f5f1a646f781ba1fb/packages/superset-ui-query/src/types/Query.ts#L8-L22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree!
rusackas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
graceguo-supercat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* fix: extra filters * fix old test and add new test * add test for null filter value * leave lowercase until all operators are fully uppercased * bump packages * rename test
This reverts commit 3c39b26.
* fix: extra filters * fix old test and add new test * add test for null filter value * leave lowercase until all operators are fully uppercased * bump packages * rename test
* fix: extra filters * fix old test and add new test * add test for null filter value * leave lowercase until all operators are fully uppercased * bump packages * rename test

SUMMARY
Currently Filter Box events aren't being properly reflected in the new chart data endpoint requests. This was because
extra_filtersweren't being properly merged with filters from the chart data payload. The bulk of the fix was done insuperset-ui( apache-superset/superset-ui#688 ), and updates@superset-ui/chartto the most recent released version.TEST PLAN
CI + new tests.
SCREENSHOTS
Below are screenshots of a Filter Box with changing legacy charts (Name Line, Multiformat Line) and one new chart (Name Cloud, ECharts Multiformat).
BEFORE
Previously Filter Box changes (date range, time grain, gender selector) were NOT reflected in the viz' calling the new chart data endpoint (Name Cloud, ECharts Multiformat).


AFTER
As can be seen, changes in the Filter Box are reflected properly in all charts.


ADDITIONAL INFORMATION