[Feature] Dashboard filter indicators#7908
Conversation
|
Needs rebasing (build error fixed in master) |
89184f3 to
2e92ec9
Compare
Codecov Report
@@ Coverage Diff @@
## master #7908 +/- ##
==========================================
+ Coverage 65.57% 65.69% +0.11%
==========================================
Files 469 486 +17
Lines 22496 22804 +308
Branches 2446 2515 +69
==========================================
+ Hits 14752 14980 +228
- Misses 7624 7696 +72
- Partials 120 128 +8
Continue to review full report at Codecov.
|
etr2460
left a comment
There was a problem hiding this comment.
a bunch of comments, will definitely give another pass too
There was a problem hiding this comment.
nit: should be 'should dispatch removeFilter i think
There was a problem hiding this comment.
maybe just a stylistic preference, but i tend to name constant fixtures like this as OVERRIDE_FILTERS
There was a problem hiding this comment.
maybe note this var in the css file (and vice versa) so that people know where to update it if something changes
There was a problem hiding this comment.
i'd prefer to not disable the lint rule here and just make an additional const in this function if needed
There was a problem hiding this comment.
i'd imagine there's a lodash function or something that already implements this, any reason why we chose to write our own here?
There was a problem hiding this comment.
thanks! Use lodash now.
There was a problem hiding this comment.
we don't translate values in map. the UI component which uses this map will translate the needed value.
ea70f42 to
568ea9c
Compare
|
ping @etr2460 I rebased onto master, added a few unit tests to increase coverage (you have to click the Codecov link to see updated stats), fixed most of comments. Please take a second look. Thanks. |
568ea9c to
4f394b1
Compare
There was a problem hiding this comment.
You don't need this function anymore right?
There was a problem hiding this comment.
thanks. i added this instance method before, because I had difficulty to add unit test, which needs to mock window.location.hash. now i found a better solution here.
There was a problem hiding this comment.
personal preference, but i find it easier to read if we just put this map in the return JSX as well. Co-locating all of it makes it easier to see the whole dom structure
There was a problem hiding this comment.
still not sure if this is needed?
There was a problem hiding this comment.
prefer: const { [action.chartId]: deletedItem, ...updatedFilters };
There was a problem hiding this comment.
thanks! this problem bothered me for a long time. now i knew solution.
There was a problem hiding this comment.
is a z index absolutely needed here? Have we ensured that 10 is appropriate compared to all other possible z indexes?
There was a problem hiding this comment.
be honest, i don't know how to make ensured 10 is appropriate. Just by manual test.
There was a problem hiding this comment.
got it, we should probably make an issue to manage the z-indexes better at some point. this is fine for now though
There was a problem hiding this comment.
not a big fan of transition all, can we explicitly call out what styles should be transitioned over?
There was a problem hiding this comment.
fixed. only width attribute.
b318ea2 to
f0be2fc
Compare
etr2460
left a comment
There was a problem hiding this comment.
just a couple final nits, but otherwise lgtm! I'm super excited to see this go out!
There was a problem hiding this comment.
this doesn't need an argument right? or you can remove the default arg on the function
There was a problem hiding this comment.
We're using react 16.8 now so this can be changed to <> and the closing tag can be </>
There was a problem hiding this comment.
I search the whole code base and found about 9 places used <React.Fragment> but 0 place used <>. Maybe consistency is more important, if this is only a syntax sugar?
There was a problem hiding this comment.
got it, we should probably make an issue to manage the z-indexes better at some point. this is fine for now though
f0be2fc to
9ab3e38
Compare
|
Any updates? Very cool PR.... |
|
This will probably get merged today! |
|
YAY!!!!! |
9ab3e38 to
b02b9a9
Compare

CATEGORY
Choose one
SUMMARY
Implementation
filtersin redux state.Before this PR,
filtersstate is a sub-state indashboardstate:In order to support UI features and in-dashboard navigation functionality, I move
dashboardFilterup to be root-level state in redux store, and it will contain more props about filter value and its layout information:Because
filtersprop is used by a lot of components in dashboard, I added a converter utility functionbuildActiveFilters, which converts rawdashboardFiltersstate into oldfiltersformat so that other components can still usefiltersas before, and won't be affected by this big state change.buildActiveFiltersfunction will be triggered whenever dashboardFilters state is changed, and the converted results will be cached. All other components in dashboard will callgetActiveFiltersto get the cached filters state, and they don't need to run the converter function again and again.In this PR we introduced a new color palette for dashboard filters.
Each filter field is assigned a unique colorKey:
chartId_filter_column_name. This colorKey is used by bother filter badge and filter indicator. Dashboard will pick a color from filter color palette based on colorKey and build a color map. During render time, each filter and indicators in the chart will lookup color code based on its colorKey. Similar tobuildActiveFiltersfunction, dashboardFilter state update will trigger re-build color map.Suppose A is root, B,C,D are top level tabs, F, G are charts under tabs, H is nested tab, M is chart under nested tab. For example, when user lands on M, how to navigate user to a filter component in another root level tab B?
Dashboard stores layout data in flattened tree structure: each parent node contains ids of its children, and every UI component (chart, header, row, column, tabs, etc) keeps all the parent component ids from root to itself (see #6945):
From this parents list it's very easy to find out to select which root tab or nested tab to a specific filter.
dashboardStatehas adirectPathToChildprop, which is the current state of dashboard, holding a path to one of the chart (or any UI component). When user clicks on a filter indicator, dashboard will update itsdirectPathToChildto be target filter's path. Then dashboard will render the correct list of parent tab/tabs, and display filter chart.Filter indicators UI components
/dashboard/container/FilterIndicators.jsx/dashboard/components/FilterIndicatorsContainer.jsx: indicators organizer for each chart. Usually one chart will be applicable for one or more filters, but user can set dashboard metadata that a chart might be immune to all filters in the dashboard, or some filter fields. We only display indicators for applicable filters. The logic to show/group/hide applicable filters for each chart is here./dashboard/components/FilterIndicator.jsxand/dashboard/components/FilterIndicatorGroup.jsx: little colored indicator component for each filter, if chart having > 5 filters, will group them into a group./dashboard/components/FilterTooltipWrapper.jsx: the basic usage ofreact-bootstrap Tooltipcomponents are not enough for our need. We allow user to click on tooltip (especially needed for indicator group) to navigate to actual filter chart. So I added customized wrapper component to trigger/hideOverlaywith some delay./dashboard/components/FilterIndicatorTooltip.jsx: tooltip component for filter. it showscolumn nameand selected values.
If the filter is applicable but not applied, we will show **Not filtered**. If the filter is not applicable to the chart, we will not show indicator.SCREENSHOTS OR ANIMATED GIF
Page landing:
Interact with filter indicator
Navigate from chart to filter
TEST PLAN
CI and manual test.
ADDITIONAL INFORMATION
REVIEWERS
@williaster @michellethomas @etr2460 @xtinec @mistercrunch @kenchendesign
@betodealmeida @khtruong