[WIP][dashboard scoped filter] part 3: merge filter scope settings into dashboard redux state#8522
Conversation
af17619 to
c9f3de9
Compare
etr2460
left a comment
There was a problem hiding this comment.
first pass, i think i need to go through this again though
| const idSet = new Set(affectedChartIds); | ||
| this.refreshCharts([...idSet]); |
There was a problem hiding this comment.
why build a set then make it an array again? just to dedupe? why not make affectedChartIds a Set from the getgo?
There was a problem hiding this comment.
yes. convert to Set is to de-dupe. In the following loop, i need to keep adding array of values into affectedChartIds. I am not sure there is an easier way to add an array of values into Set?
| ); | ||
|
|
||
| this.props.updateDashboardFiltersScope(allFilterFieldScopes); | ||
| this.props.setUnsavedChanges(true); |
There was a problem hiding this comment.
What does passing true here mean? seems like setUnsavedChanges wouldn't require an argument
There was a problem hiding this comment.
this is signature ofsetUnsavedChanges function:
export function setUnsavedChanges(hasUnsavedChanges) {
return { type: SET_UNSAVED_CHANGES, payload: { hasUnsavedChanges } };
}
i need to notify dashboard state that there is unsaved changes, since dashboardFilters state is updated.
| slices: sliceEntities.slices, | ||
| layout: dashboardLayout.present, | ||
| impressionId, | ||
| loadStats: getLoadStatsPerTopLevelComponent({ |
There was a problem hiding this comment.
this is old dashboard perf logging. this prop loadStats is not used anywhere. getLoadStatsPerTopLevelComponent is kind of expensive and frequently being called.
| md.pop("filter_immune_slice_fields", None) | ||
| md["filter_scopes"] = json.loads(data.get("filter_scopes", "{}")) | ||
| else: | ||
| if "filter_immune_slices" not in md: |
There was a problem hiding this comment.
do we have a migration plan for migrating filters over? when will this happen? will we migrate all the form data even if dashboards don't get visited?
There was a problem hiding this comment.
yeah, i think migration from backend is good idea. Users will update/add filter scopes for the active dashboards, but old dashboard will never got updated. I can make a migration once this feature got released and stabled.
For migration, the logic could be very simple: just convert all existed dashboard filters as global scope, and add immune charts if they had immune settings in dashboard metadata.
c9f3de9 to
039d819
Compare
6f0d13b to
03b722e
Compare
3ee5354 to
aa679e8
Compare
Codecov Report
@@ Coverage Diff @@
## feature--dashboard-scoped-filter #8522 +/- ##
===================================================================
- Coverage 66% 66% -0.01%
===================================================================
Files 470 474 +4
Lines 23127 23197 +70
Branches 2485 2484 -1
===================================================================
+ Hits 15265 15311 +46
- Misses 7701 7728 +27
+ Partials 161 158 -3
Continue to review full report at Codecov.
|
|
A few updates in the last commits, based on users and designer's feedack:
|
eecf04f to
3e83142
Compare
superset/assets/src/dashboard/components/FilterIndicatorsContainer.jsx
Outdated
Show resolved
Hide resolved
superset/assets/src/dashboard/components/FilterIndicatorsContainer.jsx
Outdated
Show resolved
Hide resolved
superset/assets/src/dashboard/components/filterscope/FilterScopeModal.jsx
Outdated
Show resolved
Hide resolved
|
|
||
| const NOOP = () => {}; | ||
|
|
||
| const FILTER_SCOPE_CHECKBOX_TREE_ICONS = { |
There was a problem hiding this comment.
Is this the same with FILTER_FIELD_CHECKBOX_TREE_ICONS?
There was a problem hiding this comment.
yes, they were not same at the very first version. now they are same. so i created a shared config.
2bae290 to
015a390
Compare
015a390 to
83269e9
Compare
| ...DASHBOARD_FILTER_SCOPE_GLOBAL, | ||
| ...scopeSettings[column], | ||
| }; | ||
| const immuneChartIds = new Set(filterImmuneSlices.slice()); |
There was a problem hiding this comment.
If you pass the array to Set, probably not need to make a copy.
|
|
||
| // Build a list of fields the slice is immune to filters on | ||
| export default function getEffectiveExtraFilters(filters) { | ||
| const effectiveFilters = []; |
There was a problem hiding this comment.
export default function getEffectiveExtraFilters(filters) {
return Object.entries(filters).map([column, values]) => ({
col: column,
op: 'in',
val: values,
});
}
kristw
left a comment
There was a problem hiding this comment.
a few minor, non-blocking comments.
* [WIP][dashboard scoped filter] part 1: scope selector modal (#8557) * filter scope selector modal * add single-field-edit in multi-edit mode switch * fix code review comments (round 1) * refactory after design review * fix a few props initial value * [WIP][dashboard scoped filter] part 2: add algorithm to convert checked ids to scope object (#8564) * convert ids to scope object * use lodash helpers to make code readable * [WIP][dashboard scoped filter] part 3: merge filter scope settings into dashboard redux state (#8522) * merge filter scope settings into dashboard redux state * fix/add unit tests * minor bug fixes * fix save filter Scopes behavior * resolve review comments * fix save filter scope settings * minor comments * [dashboard scoped filter] Improve scrollbar inside modal (#8553) * improve scroll inside modal * make left pane and right pane scroll separately * fix review comments * force show filter_box as unchecked (#8587)
CATEGORY
Choose one
SUMMARY
For each filter, add a
scopessection into dashboard redux state:TEST PLAN
ADDITIONAL INFORMATION
REVIEWERS