-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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): Setting default value #12465
Conversation
I have a bug. Scenario: import.mov |
Codecov Report
@@ Coverage Diff @@
## master #12465 +/- ##
==========================================
+ Coverage 63.13% 63.40% +0.27%
==========================================
Files 1022 488 -534
Lines 50032 30115 -19917
Branches 4915 0 -4915
==========================================
- Hits 31587 19095 -12492
+ Misses 18245 11020 -7225
+ Partials 200 0 -200
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Whoa... that's some impressive testing! |
@adam-stasiak thanks for thorough testing - as always! 🚀 There is a gif presenting that if problem with editing imported dashboard is fixed, we won't have that bug. |
fc469dd
to
bd07e16
Compare
e4e3f71
to
7945d7c
Compare
7945d7c
to
a59a2e2
Compare
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.
awesome work!
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.
Great work!
Next step, let's make it possible to set multiple default values in the modal, reflect the selection in the filter bar dropdown.
this one is good to go. ✅
a59a2e2
to
3ac260e
Compare
Double checked this - is ok 🟢 |
@agatapst could we resolve conflicts? we probably should have merge this before the other ones🤦🏾♀️ |
This reverts commit bd07e169f009862647327bf3d15e02f98ea8be9b.
3ac260e
to
2d72446
Compare
Conflicts solved, but there were some significant changes to adjust this PR to current master, so please wait with merging - I'll check it one more time. 🟡 Update: works as before 🟢 |
}, [form, filterId]); | ||
|
||
useChangeEffect(datasetId, previous => { | ||
if (previous != null) { |
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.
may better use strict comparison like: ===
to process correctly 0
or empty string?
}); | ||
|
||
useChangeEffect(column, previous => { | ||
if (previous != null) { |
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.
and same here
Hi it looks good work 👍 So I think it can be better use SuperChart here to inject appropriate value selection for default value, I had some PR for it but closed it in favour of yours, because you also implemented it in different way... but I still think that it can be good to use SuperChart here to select default value: |
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.
@simchanielsen Hi, thanks for your suggestions! Yes, you are right - we use Select component for setting default values in all cases. So for range filters it may not work properly. Tbh creating this PR I didn't know that type should be supported, so thanks for checking that. Your solution looks nice - I don't mind closing this PR in favor of yours. My PR is completely based on @villebro @junlincc @rusackas @suddjian I am waiting for your opinion as well. |
I agree with @simchanielsen - we should decouple the filters as much as possible from the filter config modal, so it would be preferable to use |
@simchanielsen thanks for the solution, I do agree we should go this route @agatapst thanks for your great work still:) 🙏 |
Agreed that the other approach makes more sense. Closing this for now. |
SUMMARY
The aim of this PR was to improve setting default value for Native Filters.
The new Default Value Select component was created, which enables to choose default value based on dataset and field.
Now it is possible to set default value for a given filter.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After:
for native filter without children (including editing)
for native filters child
TEST PLAN
Go to
config.py
and set"DASHBOARD_NATIVE_FILTERS": True
Go to dashboards, choose one and create filter or use existing one.
Set default value.
ADDITIONAL INFORMATION
cc @junlincc @villebro @rusackas
@adam-stasiak could you test it?