Dashboards: Allow custom quick time ranges specified in dashboard model (#93724)

* TimeRangePicker: allow to customize quick ranges per dashboard

* TimeRangePicker: show selected custom time range using its name

* rangeutil: add tests for describeTextRange + quickRanges

* Fix up tests, and add an extra case for hidden time ranges

* Don't construct an object to find options, add findRangeInOptions util

* fix type errors detected by TypeScript

---------

Co-authored-by: joshhunt <josh@trtr.co>
This commit is contained in:
Sergey Naumov
2025-02-04 14:36:28 +00:00
committed by GitHub
co-authored by joshhunt
parent cfae9d20d2
commit eb2f8182c0
10 changed files with 96 additions and 28 deletions
@@ -136,6 +136,18 @@ The grid has a negative gravity that moves panels up if there is empty space abo
"now": true,
"hidden": false,
"nowDelay": "",
"quick_ranges": [
{
"display": "Last 6 hours"
"from": "now-6h",
"to": "now"
},
{
"display": "Last 7 days"
"from": "now-7d",
"to": "now"
}
],
"refresh_intervals": [
"5s",
"10s",
@@ -163,6 +175,7 @@ Usage of the fields is explained below:
| **now** | |
| **hidden** | whether timepicker is hidden or not |
| **nowDelay** | override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values. |
| **quick_ranges** | custom quick ranges |
| **refresh_intervals** | interval options available in the refresh picker dropdown |
| **status** | |
| **type** | |