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): Add time filters #12946

Closed

Conversation

agatapst
Copy link
Contributor

@agatapst agatapst commented Feb 4, 2021

SUMMARY

The aim of this PR was to create foundations for new native filters' feature: time filters.
User can choose between one more filter type, which is Time.

That's the basics for this feature. What should be added in next PRs:

  • UI improvements (if we want to show modal in modal, how to display very long time "pills" in Filter Bar etc.)
  • Improve Filter Config Modal validation - right now datasource is required, but in case of time filters it should not
  • Implement additional filtering: i.e. inverse
  • Might also take a look on performance - it take more time to show time filters result than select filters result
  • Filter indicator logic needs to be updated

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

time_filters_small

TEST PLAN

Go to config.py and set "DASHBOARD_NATIVE_FILTERS": True,
Go to dashboard and create native filters with filter type "TIME"

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

cc @villebro @simcha90 @junlincc

@agatapst agatapst changed the title feature(native-filters: Add time filters feature(native-filters): Add time filters Feb 4, 2021
@junlincc junlincc added dashboard:native-filters Related to the native filters of the Dashboard hold:testing! On hold for testing labels Feb 4, 2021
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.

First round of comments

@codecov-io
Copy link

codecov-io commented Feb 4, 2021

Codecov Report

Merging #12946 (c2ba1c7) into master (76c225d) will decrease coverage by 7.04%.
The diff coverage is 74.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12946      +/-   ##
==========================================
- Coverage   69.14%   62.09%   -7.05%     
==========================================
  Files        1025      972      -53     
  Lines       48765    46050    -2715     
  Branches     5188     4485     -703     
==========================================
- Hits        33718    28596    -5122     
- Misses      14913    17454    +2541     
+ Partials      134        0     -134     
Flag Coverage Δ
cypress 52.98% <74.35%> (+2.15%) ⬆️
javascript ?
python 67.59% <ø> (-0.04%) ⬇️

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

Impacted Files Coverage Δ
...c/dashboard/components/nativeFilters/FilterBar.tsx 92.00% <ø> (+39.61%) ⬆️
...ard/components/nativeFilters/FilterConfigModal.tsx 79.00% <ø> (+9.10%) ⬆️
...nd/src/dashboard/components/nativeFilters/utils.ts 53.15% <ø> (-30.46%) ⬇️
...tend/src/filters/components/Time/transformProps.ts 0.00% <0.00%> (ø)
superset-frontend/src/filters/utils.ts 50.00% <ø> (-38.89%) ⬇️
...-frontend/src/visualizations/presets/MainPreset.js 100.00% <ø> (ø)
...rset-frontend/src/filters/components/Time/index.ts 75.00% <75.00%> (ø)
...s/controls/DateFilterControl/DateFilterControl.tsx 81.48% <85.18%> (-2.14%) ⬇️
...oard/components/nativeFilters/FilterConfigForm.tsx 77.35% <100.00%> (+2.35%) ⬆️
...nd/src/dashboard/components/nativeFilters/types.ts 100.00% <100.00%> (ø)
... and 422 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 76c225d...c2ba1c7. Read the comment docs.

@agatapst agatapst changed the title feature(native-filters): Add time filters feat(native-filters): Add time filters Feb 4, 2021
@junlincc junlincc requested a review from zhaoyongjie February 4, 2021 16:54
@junlincc
Copy link
Member

junlincc commented Feb 5, 2021

Thank you bringing it so close to the finish line @agatapst !

@villebro should @simcha90 continue to push commits to this branch or should we merge it and open follow up PRs?

@ktmud
Copy link
Member

ktmud commented Feb 5, 2021

Currently the time range filter in FilterBox is not tied to any datasource. It will apply to any chart that is in scope and has a time column specified, regardless if it's using the same datasource or not.

The new time filter in native filters here seems to be tied to a specific datasource and field as users have to specify that when creating one, I'm wondering how this actually works in the dashboard? Will it work like the old Time Range filter in FilterBox, or will it applied only to the charts that use the same datasource and has the selected ds as its time column?

If it's the latter case, we might want to redesign the whole thing to make users select filter type first before selecting datasource ("Datasource" and "Field" should be hidden when they select "Filter type: Time").

@villebro
Copy link
Member

villebro commented Feb 5, 2021

Currently the time range filter in FilterBox is not tied to any datasource. It will apply to any chart that is in scope and has a time column specified, regardless if it's using the same datasource or not.

The new time filter in native filters seems to be tied to a specific datasource and field, I'm wondering how this time filter will actually work in the dashboard?

Will it work like the old Time Range filter in FilterBox, or will it work on the selected ds column on the selected datasource?

This will be changed shortly - the time filter won't be tied to a datasource, and will only have the time picker (no need for datasource, column etc). Also, the date column filter will be ported to native filters, and that one will obviously have a datasource.

If it's the latter case, we might want to redesign the whole thing to make users select filter type first before selecting datasource.

The redesign is currently under discussion, and a change similar to the one you're proposing is in the works

@villebro
Copy link
Member

villebro commented Feb 8, 2021

Closing in favor of #12992 (includes these commits + follow-up commits)

@villebro villebro closed this Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard:native-filters Related to the native filters of the Dashboard hold:testing! On hold for testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants