-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
refactor(native-filters): update dataMask and ExtraFormData schema #13983
Conversation
LGTM, Let's see what CI reveals |
ownFilters
to ownState
dataMask
structure
� Conflicts: � superset-frontend/src/explore/components/DataTablesPane/index.tsx
� Conflicts: � superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterSets/utils/index.ts � superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
� Conflicts: � superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx � superset-frontend/src/filters/components/Select/transformProps.ts � superset-frontend/src/filters/components/Select/types.ts
dataMask
structuredataMask
structure
FYI: marking this as WIP until all |
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.
Codecov Report
@@ Coverage Diff @@
## master #13983 +/- ##
==========================================
- Coverage 79.93% 79.85% -0.08%
==========================================
Files 943 943
Lines 47772 47745 -27
Branches 6019 6050 +31
==========================================
- Hits 38185 38126 -59
- Misses 9468 9497 +29
- Partials 119 122 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
� Conflicts: � superset-frontend/spec/javascripts/dashboard/fixtures/mockNativeFilters.ts � superset-frontend/src/dashboard/actions/hydrate.js � superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterSets/FiltersHeader.tsx � superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Header/index.tsx � superset-frontend/src/dashboard/util/activeAllDashboardFilters.ts
…et into own_state
❗ Please consider rebasing your branch to avoid db migration conflicts. |
dataMask
structureapplied_time_extras = form_data.get("applied_time_extras", {}) | ||
form_data["applied_time_extras"] = applied_time_extras |
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.
applied_time_extras
are no longer needed for filter indicators
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.
Looks good, left a couple of comments
superset/constants.py
Outdated
"time_range": "time_range", | ||
} | ||
|
||
EXTRA_FORM_DATA_OVERRIDE_EXTRA_KEYS = [ |
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.
nit: we could use a set
here
|
||
|
||
def upgrade(): | ||
bind = op.get_bind() |
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.
There's some complexity here, would be nice to place the entire logic here: https://github.com/apache/superset/tree/master/superset/migrations/shared
Then add some tests to assert that the migrations works has expected
LGTM! It seems that there's still the old structure used in |
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! Added some suggestions.
dashboards = ( | ||
session.query(Dashboard) | ||
.filter(Dashboard.json_metadata.like('%"filter_sets_configuration"%')) | ||
.all() | ||
) | ||
changed_filter_sets, changed_filters = 0, 0 | ||
for dashboard in dashboards: |
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.
dashboards = ( | |
session.query(Dashboard) | |
.filter(Dashboard.json_metadata.like('%"filter_sets_configuration"%')) | |
.all() | |
) | |
changed_filter_sets, changed_filters = 0, 0 | |
for dashboard in dashboards: | |
dashboards = ( | |
session.query(Dashboard) | |
.filter(Dashboard.json_metadata.like('%"filter_sets_configuration"%')) | |
) | |
changed_filter_sets, changed_filters = 0, 0 | |
for dashboard in dashboards.yield_per(100): |
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.
Thanks - this is a great pattern! As this is behind a FF, I don't expect we'll have lots of these dashboards. Also in the interest of CI time and unblocking other PRs that are dependent on this I think I'll just merge now, but I can open up a follow up PR to implement this.
dashboards = ( | ||
session.query(Dashboard) | ||
.filter(Dashboard.json_metadata.like('%"filter_sets_configuration"%')) | ||
.all() | ||
) | ||
changed_filter_sets, changed_filters = 0, 0 | ||
for dashboard in dashboards: |
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.
dashboards = ( | |
session.query(Dashboard) | |
.filter(Dashboard.json_metadata.like('%"filter_sets_configuration"%')) | |
.all() | |
) | |
changed_filter_sets, changed_filters = 0, 0 | |
for dashboard in dashboards: | |
dashboards = ( | |
session.query(Dashboard) | |
.filter(Dashboard.json_metadata.like('%"filter_sets_configuration"%')) | |
) | |
changed_filter_sets, changed_filters = 0, 0 | |
for dashboard in dashboards.yield_per(100): |
…pache#13983) * refactor: updates usage of `ownFilters` to `ownState` * refactor: update dataMask (final) * lint: fix lint * refactor: revert feat * fix: fix missed chart configuration * add filter set migration * apply new changes * fix migration revision * update migration * fix jest mock * js lint * fix test types * update tests and types * remove append_form_data from tests * fix findExistingFilterSet tests * add migration test Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
SUMMARY
This PR implements native filter and cross filter API simplification efforts introduced in apache-superset/superset-ui#1040 and apache-superset/superset-ui#1053 . The following changes are done:
setDataMask
hook now has new structure:append_form_data
andoverride_form_data
fields inExtraFormData
type are moved up one level into the main filter objectcurrentValue
removed from formData now it passed in props.filterState.valueownState
andfilterState
filter_select
was attached to filterBoxesviz.py
Affected areas:
TEST PLAN
All frontend + backend unit tests have been updated, and a test for the migration has been added to ensure that both up and down migrations produce expected results.
ADDITIONAL INFORMATION
DASHBOARD_NATIVE_FILTERS_SET
feature flag