imddevaraj opened a new pull request, #41527:
URL: https://github.com/apache/superset/pull/41527

   ### SUMMARY
   
   Add four quick-select presets to the **Last…** (Common) frame of the date 
range filter — both in the Explore chart builder and in Dashboard native Time 
filters:
   
   - **Last 5 minutes**
   - **Last 15 minutes**
   - **Last 30 minutes**
   - **Last 1 hour**
   
   The new options appear at the top of the radio group, grouped above the 
existing day/week/month presets, giving users a fast path for recent/real-time 
monitoring use cases.
   
   **Backend fix included:** `get_since_until()` had a latent bug where `hour` 
was absent from the last/next/this time-unit regex despite being documented as 
supported. This PR adds `hour` to the pattern so `Last 1 hour` resolves 
correctly. The `get_relative_base()` function already classified `hour` as a 
granular unit (`→ 'now'` base), so no additional changes were needed there.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   **Before:** Common frame shows Last day / Last week / Last month / Last 
quarter / Last year
   
   **After:** Common frame shows Last 5 minutes / Last 15 minutes / Last 30 
minutes / Last 1 hour / Last day / Last week / Last month / Last quarter / Last 
year
   
   ### TESTING INSTRUCTIONS
   
   1. Open any dashboard → **Filters** → **+ Add filter** → **Time range**
   2. Open the time control; the frame selector defaults to **Last**
   3. Verify the four new options appear above `Last day`
   4. Select **Last 15 minutes**, click Apply — charts in scope re-query for 
the last 15 minutes of data
   
   **Unit tests:**
   ```bash
   # Frontend
   cd superset-frontend
   npx jest --testPathPatterns="DateFilterControl/tests/utils" --no-coverage 
--forceExit
   
   # Backend
   pytest 
tests/unit_tests/utils/date_parser_tests.py::test_get_since_until_sub_hour_presets
 -v
   ```
   
   ### ADDITIONAL INFORMATION
   
   - [x] Changes UI
   - [x] Introduces new feature or API
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Includes DB Migration


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to