Skip to content
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

feat(native-filters): Highlight charts affected by focused native filter #14693

Merged
merged 4 commits into from
May 21, 2021

Conversation

kgabryje
Copy link
Member

SUMMARY

When user focuses on a native filter (hovers over it or opens select menu), highlight all charts in scope of that native filter (by adding a box shadow around it) and hide the charts outside of scope (by setting opacity to 0.3).

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2021-05-18.at.17.54.47.mov

TEST PLAN

Set DASHBOARD_NATIVE_FILTERS feature flag to true.
Add some native filters to the dashboard - be creative with setting their scopes 🙂
Verify that when you hover over Range or Time filter buttons, charts inside the scopes of those filters get highlighted and all other charts are less visible.
Verify that when you open a select menu of Select, Time Column, Time Grain and Group By filters, charts inside the scopes of those filters get highlighted and all other charts are less visible.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

CC: @junlincc @villebro @suddjian

@junlincc junlincc added release:note dashboard:native-filters Related to the native filters of the Dashboard labels May 18, 2021
@graceguo-supercat
Copy link

graceguo-supercat commented May 18, 2021

Could you create a sample dashboard with some Tabs, and set filter scope that is only applicable to those charts inside tab?

@junlincc junlincc added the demo label May 18, 2021
@codecov
Copy link

codecov bot commented May 18, 2021

Codecov Report

Merging #14693 (74c4ec5) into master (32f5f36) will decrease coverage by 0.04%.
The diff coverage is 43.10%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14693      +/-   ##
==========================================
- Coverage   77.51%   77.46%   -0.05%     
==========================================
  Files         958      959       +1     
  Lines       48560    48733     +173     
  Branches     5703     6115     +412     
==========================================
+ Hits        37642    37752     +110     
- Misses      10718    10778      +60     
- Partials      200      203       +3     
Flag Coverage Δ
javascript 72.45% <43.10%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...components/DashboardBuilder/DashboardContainer.tsx 100.00% <ø> (ø)
...ashboard/components/gridComponents/ChartHolder.jsx 77.77% <ø> (+0.94%) ⬆️
...nents/nativeFilters/FilterBar/FilterSets/index.tsx 77.00% <ø> (ø)
superset-frontend/src/dashboard/reducers/types.ts 0.00% <ø> (ø)
...filters/components/GroupBy/GroupByFilterPlugin.tsx 0.00% <0.00%> (ø)
...d/src/filters/components/GroupBy/transformProps.ts 22.22% <0.00%> (-11.12%) ⬇️
...t-frontend/src/filters/components/GroupBy/types.ts 100.00% <ø> (ø)
...src/filters/components/Range/RangeFilterPlugin.tsx 0.00% <0.00%> (ø)
...end/src/filters/components/Range/transformProps.ts 12.50% <0.00%> (-7.50%) ⬇️
...et-frontend/src/filters/components/Select/types.ts 100.00% <ø> (ø)
... and 48 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32f5f36...74c4ec5. Read the comment docs.

@junlincc
Copy link
Member

junlincc commented May 18, 2021

@kgabryje i believe in the original implementation, when there are multiple tabs, tabs light up if any charts in that tab is mapped to a specific filter.

@kgabryje kgabryje closed this May 19, 2021
@kgabryje kgabryje reopened this May 19, 2021
@kgabryje
Copy link
Member Author

kgabryje commented May 19, 2021

@graceguo-supercat @junlincc Thank you for your comments! The charts inside of tabs are correctly highlighted. However, if a chart in filter's scope is in an inactive tab, that tab doesn't get highlighted - I'll try to implement that.
@junlincc Are you sure that tabs were getting highlighted? I don't see the relevant code and there are no tabs highlights in the gif from Grace's comment here #10936 (comment)

@@ -72,7 +72,7 @@ const DashboardContainer: FC<DashboardContainerProps> = ({ topLevelTabs }) => {
activeKey={activeKey}
renderTabBar={() => <></>}
fullWidth={false}
animated
animated={false}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disabled animation as it was breaking native filters - when user switched tab, margin-left: 100% style was set on tab content, which was covering native filters panel, causing the user to be unable to click native filters... And the animation looked ugly with native filters panel anyway 😛

@junlincc
Copy link
Member

Are you sure that tabs were getting highlighted?

got it, that was in the design but never implemented....😅 ;let's spend a day or 2 to add this feature in a seperate PR

  • highlight other tabs that have charts scoped to the filter, when user is in a different tab.

  • when user switch to the highlighted tab, user see highlighted charts in tab

  • please open a separate PR to disable animation in tab globally @ktmud

  • please open a separate PR to grey out filters that are not scoped to a specific tag.

@junlincc junlincc added the need:review Requires a code review label May 19, 2021
@graceguo-supercat
Copy link

graceguo-supercat commented May 19, 2021

@junlincc Are you sure that tabs were getting highlighted? I don't see the relevant code and there are no tabs highlights in the gif from Grace's comment here #10936 (comment)

For filter_box, we don't highlight tabs when only charts inside inactive tab will be impacted. We had this behavior is because filter_box could be placed inside tab. So that if a filter_box only has smaller tab scope, it should be placed inside the tab. It is possible that user sets a filter_box is applicable to multiple tabs but hide the filter_box inside a nested tab, but this case is small (why would someone do that?)

For build-in filter components, things are a little different: every filter component become globally visible in the dashboard, not matter it is applicable to single nested tab or multiple top-level tabs. This change might need us to think about the highlight behavior:

  • When a filter component is applicable to a nested tab and currently user can not see the nested tab, filter component should be inactive (not in the current implementation but i assume this is in the near future), i think we still should highlight the scope even for the inactive filter component, so that user will know why the filter is not active now and what is its real scope. We should highlight the parent tab which is visible for the user when the charts are deep nested under other tabs.

  • When a filter component is applicable to one more charts/tabs in the current active tab, filter component is active, we should highlight charts and tabs, so that behavior is consistent with above case.

want to hear ideas from @junlincc and @mihir174

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few non-blocking comments, LGTM!

export interface SetBooststapData {
export interface SetBootstrapData {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gave me fond memories of C++ https://www.boost.org/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆 Ah boost... I remember that I was so happy when C++11 (I think?) was released and they added a lot of stuff from boost to std 😄

Comment on lines 43 to 44
setFocusedFilter: () => void;
unsetFocusedFilter: () => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplification idea: we could move the setDataMask, setFocusedFilter and unsetFocusedFilter into a shared interface/type PluginFilterHooks in filters/components/types.ts and then just & them into PluginFilterGroupByProps and the others.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done!

Comment on lines +24 to +25
height: ${({ height }) => height}px;
width: ${({ width }) => width}px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh one of these again 👍

@junlincc
Copy link
Member

junlincc commented May 20, 2021

@graceguo-supercat

for current iteration - we will grey out filters that are not scoped to tabs from the filter bar, as just a visual suggestion that the specific filter won’t apply in the current scope(instead of disabling it). This should reach feature parity with filter box highlighting behavior

For range filter, blue circle will be greyed out; for time range, color darker grey on hovering
Screen Shot 2021-05-20 at 9 57 41 AM

Above change will be made in separate PRs

We can discuss next iteration, including grouping or foldering filters to tabs(but not now). 🙏

@kgabryje please go ahead and merge your PR, I will take a deeper look once multiple native filter PRs are all merged.
cc @michael-s-molina

Copy link

@junlin-qa junlin-qa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving a batch of native filter PRs, will test all as a whole ASAP.

@kgabryje kgabryje merged commit c831655 into apache:master May 21, 2021
graceguo-supercat pushed a commit to graceguo-supercat/superset that referenced this pull request May 23, 2021
…ter (apache#14693)

* Highlight charts affected by focused native filter

* Remove tabs animation on dashboard

* Remove a test that checks for "animated={true}" prop on tabs

* Move hooks types to a separate interface

(cherry picked from commit c831655)
@junlincc junlincc added this to In progress in Native dashboard filters via automation May 27, 2021
@junlincc junlincc moved this from In progress to Done in Native dashboard filters May 27, 2021
@junlincc junlincc removed the demo label May 28, 2021
@junlincc junlincc added the dashboard:indicator Related to the filter indicator of a Dashboard label May 28, 2021
@pseudoPixels
Copy link

This feature is very intuitive and useful for dashboard users.
However, for some reason this feature is not working for our case (using Superset 1.2). Is there any special feature flag or so that we need to set to enable this? We do not get any error log/info, not sure whats we are missing. Can anyone please hint on it for possible issue? Many thanks all :)

@villebro
Copy link
Member

villebro commented Aug 4, 2021

This feature is very intuitive and useful for dashboard users.
However, for some reason this feature is not working for our case (using Superset 1.2). Is there any special feature flag or so that we need to set to enable this? We do not get any error log/info, not sure whats we are missing. Can anyone please hint on it for possible issue? Many thanks all :)

I don't believe this PR made it into 1.2 - however, this should be available in 1.3 (forthcoming)

cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
…ter (apache#14693)

* Highlight charts affected by focused native filter

* Remove tabs animation on dashboard

* Remove a test that checks for "animated={true}" prop on tabs

* Move hooks types to a separate interface
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
…ter (apache#14693)

* Highlight charts affected by focused native filter

* Remove tabs animation on dashboard

* Remove a test that checks for "animated={true}" prop on tabs

* Move hooks types to a separate interface
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
…ter (apache#14693)

* Highlight charts affected by focused native filter

* Remove tabs animation on dashboard

* Remove a test that checks for "animated={true}" prop on tabs

* Move hooks types to a separate interface
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels dashboard:indicator Related to the filter indicator of a Dashboard dashboard:native-filters Related to the native filters of the Dashboard need:review Requires a code review release:note size/L 🚢 1.3.0
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

7 participants