feat: add Current time-range options for time filter
SUMMARY
This pull request introduces a new "Current" option to the time filter component. The "Current" option allows users to select and view data for the current week, current month, and current year.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After :
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
- [x] Has associated issue: https://github.com/apache/superset/issues/28489
- [ ] Required feature flags:
- [x] 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
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
Hi @rusackas @sfirke , could you please review the PR. Thanks!
also related to #28626 (I hadn't found the other feature request when I created mine).
Looking at the AFTER screenshot, it looks like current calendar week should be from 2024-05-20 to 2024-05-26 instead of 2024-05-20 to today as we may have future data and when I select current calendar week I expect to see those.
Looking at the AFTER screenshot, it looks like current calendar week should be from 2024-05-20 to 2024-05-26 instead of 2024-05-20 to today as we may have future data and when I select current calendar week I expect to see those.
I agree with @michael-s-molina, I have edited my comment above to align with this suggestion.
Hey @sfirke @michael-s-molina , I have made all the changes you mentioned. Could you please review it now? Thanks!
Codecov Report
Attention: Patch coverage is 55.88235% with 15 lines in your changes missing coverage. Please review.
Project coverage is 70.28%. Comparing base (
76d897e) to head (d721931). Report is 1094 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #28637 +/- ##
==========================================
+ Coverage 60.48% 70.28% +9.79%
==========================================
Files 1931 1946 +15
Lines 76236 77531 +1295
Branches 8568 8736 +168
==========================================
+ Hits 46114 54489 +8375
+ Misses 28017 20911 -7106
- Partials 2105 2131 +26
| Flag | Coverage Δ | |
|---|---|---|
| hive | 48.94% <0.00%> (-0.23%) |
:arrow_down: |
| mysql | 77.18% <50.00%> (?) |
|
| postgres | 77.31% <50.00%> (?) |
|
| presto | 53.55% <50.00%> (-0.25%) |
:arrow_down: |
| python | 83.61% <100.00%> (+20.12%) |
:arrow_up: |
| sqlite | 76.76% <50.00%> (?) |
|
| unit | 59.00% <100.00%> (+1.37%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
All checks passed. Please review and merge if possible. Thanks!
@betodealmeida or @villebro is one of you able to review this? I approved, the functionality looks good to me and it's a nice addition that's passing all tests. But I'd like someone who can evaluate the code quality + style and determine if the Codecov warnings are relevant.
/testenv up
@rusackas Ephemeral environment spinning up at http://18.236.146.162:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.
Agreed this is worth shipping as-is, and I'm tempted to merge it, BUT I need to ask the obvious question:
@pranav1699 would you be able/willing to add any tests? I know these time ranges are not particularly well tested, but maybe this is a good excuse to add a few tests that make sure it's calculating the time ranges as expected. This would help affirm expectations around time ranges as discussed/fixed in the thread above.
@rusackas I've added Python unit tests for the current time range. Thanks for suggesting it.
Running CI 🤞
Ephemeral environment shutdown and build artifacts deleted.
Thanks again for this @pranav1699! I hope you will consider future contributions to Superset, I appreciated how thorough your PR code was and your responsiveness 🙏
You're welcome! I'm glad you found my contributions helpful. Thank you for reviewing the changes and all. I'll definitely keep Superset on my radar for future contributions.