-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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(dashboard): Inoperable dashboard filter slider when range is <= 1 #24012
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## master #24012 +/- ##
==========================================
+ Coverage 67.70% 68.13% +0.43%
==========================================
Files 1918 1941 +23
Lines 74126 75310 +1184
Branches 8052 8166 +114
==========================================
+ Hits 50187 51314 +1127
- Misses 21886 21907 +21
- Partials 2053 2089 +36
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 161 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Pinged a couple of reviewers, but I'm a little nervous that this might cause as many problems as it solves. If your data has a range of integers from 1-10, for example, then this would cause 20 steps in that range, and may cause queries to fail. If this is intended specifically for values between 0 and 1, maybe an agreeable compromise is: |
Hi @rusackas, happy to make that adjustment but a couple questions about it:
Did you mean: Also, I do like
but wondering if you wouldn't prefer
(where |
Thank you for the PR @jfrancos-mai! I think the explicit version is preferable:
|
return Math.min(1, parseFloat(normalizedStepSize)); | ||
}; | ||
|
||
const step = stepHeuristic(min, max); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const step = stepHeuristic(min, max); | |
const step = max - min <= 1 ? stepHeuristic(min, max) : 1; |
@jfrancos-mai just wondering if you still want to follow through on this PR. I hope so, but if not, maybe we should close it, or at least convert it to a draft if you want to come back to it at some point in the future. |
Closing in favor of #27271. |
SUMMARY
antd
's slider, as used in dashboard filters, has a step size of 1 (antd
's default). So when the entire range of numbers is within 1, the slider is inoperable.A few possible solutions -- I chose option (3):
1
is sufficient.This solution preserves the default behavior where the rightmost digit moves up and down by 1, while accounting for the cases where that 1 ought to be after the decimal point. The calculated step-size is the largest such number (but not larger than
1
) that accommodates the minimum number of steps we'd want to have (MIN_NUM_STEPS
)BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Screen.Recording.2023-05-10.at.2.20.35.PM.mov
Screen.Recording.2023-05-10.at.2.21.15.PM.mov
TESTING INSTRUCTIONS
How to reproduce the bug
1
. E.g. a column all of whose values are between 0 and 1.1a. If you don't have such a dataset, edit a dataset using "calculated columns" to create one.
ADDITIONAL INFORMATION
Fixes #24010