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

fix(native-filters): remove hard-coded default time range #15015

Merged
merged 2 commits into from
Jun 10, 2021

Conversation

villebro
Copy link
Member

@villebro villebro commented Jun 7, 2021

SUMMARY

Currently the time range native filter defaults to "Last week" despite the new default being "No Filter" as introduced in #14661. This PR removes all references to "Last week" and leaves the time range value unset unless explicitly set. Other changes:

  • remove local state and replace with filterState (which the application has control over)
  • remove references to defaultValue (this is now fully handled by the application)

BEFORE

When leaving the default value unset, the value shows up as "Last week":
image

AFTER

Now it defaults to "No filter":
image

When no filter is defined, the filter indicator shows the filter as being unset:
image

TESTING INSTRUCTIONS

Local testing:

  • Tried setting and leaving filter unset
  • Click "Clear all" button - resets to "No filter"
  • Set filter and click "Apply" and see that time filter applies properly

ADDITIONAL INFORMATION

@junlincc junlincc added the dashboard:native-filters Related to the native filters of the Dashboard label Jun 7, 2021
@villebro villebro force-pushed the villebro/default-time-range branch from 3592acd to 550399f Compare June 8, 2021 09:54
@villebro villebro force-pushed the villebro/default-time-range branch from 550399f to 6771a83 Compare June 8, 2021 11:30
@villebro villebro changed the title fix(native-filters): use default for time range from explore fix(native-filters): remove hard-coded default time range Jun 8, 2021
@junlincc
Copy link
Member

junlincc commented Jun 8, 2021

/testenv up FEATURE_DASHBOARD_NATIVE_FILTERS=true

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2021

@junlincc Ephemeral environment spinning up at http://35.163.111.252:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@junlincc
Copy link
Member

junlincc commented Jun 8, 2021

@villebro thanks for the PR! looks like hard coded time range are removed, but filter is not affecting the query. please see video, when i do set time range to last week, dashboard has no change.

Screen.Recording.2021-06-08.at.11.32.17.AM.mov

@junlincc junlincc added the hold! On hold label Jun 8, 2021
@villebro
Copy link
Member Author

villebro commented Jun 9, 2021

@villebro thanks for the PR! looks like hard coded time range are removed, but filter is not affecting the query. please see video, when i do set time range to last week, dashboard has no change.

Screen.Recording.2021-06-08.at.11.32.17.AM.mov

😱 Thanks for testing - will look into this asap and add a test.

@villebro
Copy link
Member Author

villebro commented Jun 9, 2021

@junlincc it's applying fine for me:
image

It appears that the COVID dataset doesn't have a temporal column. Which raises the question, we should probably not show a time filter (or time column filter for that matter) if there are no temporal columns available in the target dataset. However, this same problem applies to Filter Box as well, so I propose leaving that to a later PR.

@junlincc
Copy link
Member

junlincc commented Jun 9, 2021

sounds good. does #15068 make sense? cc @kgabryje @michael-s-molina

@junlincc junlincc added need:review Requires a code review and removed hold! On hold labels Jun 9, 2021
Copy link
Member

@junlincc junlincc left a comment

Choose a reason for hiding this comment

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

thanks again for the fix! product sign-off ✅ @rusackas ready for ya

@zhaoyongjie zhaoyongjie self-requested a review June 10, 2021 04:19
Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

Nice, LGTM.

Notice that this default behavior may produce some slow queries for some database(missing time partition column)

@junlincc junlincc added need:merge The PR is ready to be merged and removed need:review Requires a code review labels Jun 10, 2021
@villebro villebro merged commit 8aaa603 into apache:master Jun 10, 2021
@villebro villebro deleted the villebro/default-time-range branch June 10, 2021 11:49
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

@rosemarie-chiu
Copy link
Contributor

🏷2021.23

henryyeh pushed a commit to preset-io/superset that referenced this pull request Jun 15, 2021
* fix(native-filters): use default for time range from explore

* fix tests

(cherry picked from commit 8aaa603)
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
* fix(native-filters): use default for time range from explore

* fix tests
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
* fix(native-filters): use default for time range from explore

* fix tests
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
* fix(native-filters): use default for time range from explore

* fix tests
@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:native-filters Related to the native filters of the Dashboard need:merge The PR is ready to be merged preset:2021.23 preset-io size/M 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[native-filters]"No filter" state in wrong section of filter indicator
5 participants