feat(cross-filters): add cross filters#12662
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12662 +/- ##
==========================================
- Coverage 53.06% 53.00% -0.06%
==========================================
Files 489 489
Lines 17314 17327 +13
Branches 4482 4490 +8
==========================================
- Hits 9187 9185 -2
- Misses 8127 8142 +15
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
ktmud
left a comment
There was a problem hiding this comment.
Could you add more details on the architecture behind this feature?
- Will it only be available to native filters?
- Where are the options in the "Select" chart come from?
- Were there any rejected alternatives during the implementation?
| .filter(type => !registry.get(type).isNativeFilter) | ||
| .filter( | ||
| type => | ||
| isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) || |
There was a problem hiding this comment.
@simchanielsen could you explain why we need this feature flag enabled here (and below)?
There was a problem hiding this comment.
@agatapst DASHBOARD_NATIVE_FILTERS feature flag filter out native filter charts from the view that responsible for creation of charts, because if they will be created as charts they will not can filter other charts, but with new feature of cross-filter functionality they will can to do it, so no need any more filter out them from this view. Because of that FeatureFlag.DASHBOARD_CROSS_FILTERS just cancel DASHBOARD_NATIVE_FILTERS flag
|
I wonder in terms of actual UX, is a separate I remember when we talked about cross-filtering before, the expectation was that clicking on elements in a chart itself will update the filters (be it a table chart cell, or the legend in a line chart). Each chart will have a Is this still the ultimate goal? |
I feel the ultimate goal is to support cross filtering in all charts where it makes sense. But opt-in of course; clicking an item on a chart should only cause cross filtering if explicitly enabled. The following obvious charts come to mind:
etc. Even in the presence of more advanced charts with cross-filtering functionality, the simple select filter used in native filters may very well be something that end users want to place on the dashboard like a chart, especially when there will be lots of selects on a dashboard. To reduce confusion, it would be a good idea to keep these native filter charts separate from regular charts in the chart type selector, e.g. in a separate tab ("charts" vs "native filters"). |
� Conflicts: � superset-frontend/spec/javascripts/dashboard/util/getFormDataWithExtraFilters_spec.ts � superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts
� Conflicts: � superset-frontend/src/dashboard/components/nativeFilters/utils.ts
� Conflicts: � superset-frontend/src/dashboard/components/nativeFilters/utils.ts � superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts
� Conflicts: � superset-frontend/src/explore/components/controls/VizTypeControl.jsx
| if (isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS)) { | ||
| Object.entries(charts).forEach(([key, chart]) => { | ||
| if (isCrossFilter(chart?.formData?.viz_type)) { | ||
| const filterState = nativeFilters.filtersState[key] || {}; | ||
| const { extraFormData: newExtra = {} } = filterState; | ||
| extraFormData = mergeExtraFormData(extraFormData, newExtra); | ||
| } | ||
| }); | ||
| } |
There was a problem hiding this comment.
General comment: it doesn't really matter now, but especially once we start using overrides as opposed to appends, the order in which these get applied will matter. If possible, we should probably think about some way of visually understanding which chart/filter has taken precedent/been overridden.
* feat: add cross filters * refactor: fix CR notes * lint: fix lint * lint: fix lint * chore: pre-commit * refactor: under chage * refactor: move to behaviors * lint: fix lint Co-authored-by: amitmiran137 <amit.miran@nielsen.com>
* master: (30 commits) refactor(native-filters): decouple params from filter config modal (first phase) (apache#13021) fix(native-filters): set currentValue null when empty (apache#13000) Custom superset_config.py + secret envs (apache#13096) Update http error code from 400 to 403 (apache#13061) feat(native-filters): add storybook entry for select filter (apache#13005) feat(native-filters): Time native filter (apache#12992) Force pod restart on config changes (apache#13056) feat(cross-filters): add cross filters (apache#12662) fix(explore): Enable selecting an option not included in suggestions (apache#13029) Improves RTL configuration (apache#13079) Added a note about the ! prefix for breaking changes to CONTRIBUTING.md (apache#13083) chore: lock down npm to v6 (apache#13069) fix: API tests, make them possible to run independently again (apache#13076) fix: add config to disable dataset ownership on the old api (apache#13051) add required * indicator to message content/notif method (apache#12931) fix: Retroactively add granularity param to charts (apache#12960) fix(ci): multiline regex in change detection (apache#13075) feat(style): hide dashboard header by url parameter (apache#12918) fix(explore): pie chart label bugs (apache#13052) fix: Disabled state button transition time (apache#13008) ...
* feat: add cross filters * refactor: fix CR notes * lint: fix lint * lint: fix lint * chore: pre-commit * refactor: under chage * refactor: move to behaviors * lint: fix lint Co-authored-by: amitmiran137 <amit.miran@nielsen.com>
SUMMARY
Add cross filter functionality that gives option to charts to filter other charts
Description according @ktmud questions
1 .This feature is small POC that shows how to support cross-filter functionality between charts.
It partially based on
Native Filtersfunctionality with small differences:setExtraFormDatahook passed to chart that save data in redux nativeFilter domain (same like native filters) (not sure if it will be changed in future or not)isNativeFilters(I think we use this property only for POC, next we will change it to different property for cross-filtering (cc @villebro))"Select" Chart it's a native filter that take options like other charts from explore settings
We looked in implementation of
filter_boxfiltering logic and it's too coupled tofilter_boxstructure and it's decoupling can take a lot of time and can cause regression, so we decided reimplement this logic from scratchNext steps to implement:
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Screen.Recording.2021-01-21.at.16.27.36.mov
TEST PLAN
ADDITIONAL INFORMATION