mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Schema V2: Adjust quick_ranges in time settings and remove time_options (#100135)
* adjut quickRanges type in v2 * clean up unused time_options property * remove deprecated time_options property on time picker * add schema migration for time_options * adjust test
This commit is contained in:
parent
e60e217a23
commit
d1dee968c3
@ -2212,8 +2212,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "No untranslated strings in text props. Wrap text with <Trans /> or use t()", "7"],
|
||||
[0, 0, 0, "No untranslated strings in text props. Wrap text with <Trans /> or use t()", "8"],
|
||||
[0, 0, 0, "No untranslated strings in text props. Wrap text with <Trans /> or use t()", "9"],
|
||||
[0, 0, 0, "No untranslated strings in text props. Wrap text with <Trans /> or use t()", "10"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "11"]
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "10"]
|
||||
],
|
||||
"public/app/features/alerting/unified/components/rule-editor/GrafanaFolderAndLabelsStep.tsx:5381": [
|
||||
[0, 0, 0, "No untranslated strings in text props. Wrap text with <Trans /> or use t()", "0"]
|
||||
|
@ -1118,18 +1118,6 @@
|
||||
"1d"
|
||||
],
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"2h",
|
||||
" 6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"type": "timepicker"
|
||||
},
|
||||
"timezone": "browser",
|
||||
|
@ -1639,8 +1639,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Panel Tests - Graph",
|
||||
|
@ -490,17 +490,6 @@
|
||||
"1h",
|
||||
"2h",
|
||||
"1d"
|
||||
],
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
]
|
||||
},
|
||||
"timezone": "browser",
|
||||
|
@ -3408,8 +3408,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Panel Tests - Polystat",
|
||||
|
@ -312,7 +312,6 @@
|
||||
"now": true,
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"status": "Stable",
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"],
|
||||
"type": "timepicker"
|
||||
},
|
||||
"timezone": "browser",
|
||||
|
@ -537,8 +537,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Datasource tests - MSSQL",
|
||||
|
@ -2831,8 +2831,7 @@
|
||||
"to": "2018-03-15T13:55:01.000Z"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Datasource tests - MSSQL (unit test)",
|
||||
|
@ -541,8 +541,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Datasource tests - MySQL",
|
||||
|
@ -2643,8 +2643,7 @@
|
||||
"to": "2018-03-15T13:55:01.000Z"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Datasource tests - MySQL (unittest)",
|
||||
|
@ -577,8 +577,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Datasource tests - Postgres",
|
||||
|
@ -2621,8 +2621,7 @@
|
||||
"to": "2018-03-15T13:55:01.000Z"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Datasource tests - Postgres (unittest)",
|
||||
|
@ -1092,7 +1092,6 @@
|
||||
"now": true,
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"status": "Stable",
|
||||
"time_options": ["5m", "15m", "1h", "2h", " 6h", "12h", "24h", "2d", "7d", "30d"],
|
||||
"type": "timepicker"
|
||||
},
|
||||
"timezone": "browser",
|
||||
|
@ -1326,8 +1326,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "New Features in v6.2",
|
||||
|
@ -240,17 +240,6 @@
|
||||
"1h",
|
||||
"2h",
|
||||
"1d"
|
||||
],
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
]
|
||||
},
|
||||
"timezone": "",
|
||||
|
@ -654,8 +654,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["2s", "5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["2s", "5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Bar Gauge Demo",
|
||||
|
@ -1423,17 +1423,6 @@
|
||||
"1h",
|
||||
"2h",
|
||||
"1d"
|
||||
],
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
]
|
||||
},
|
||||
"timezone": "",
|
||||
|
@ -519,8 +519,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Panel Tests - Bar Gauge 2",
|
||||
|
@ -2202,8 +2202,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Lazy Loading",
|
||||
|
@ -893,8 +893,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Panel Tests - With & Without title",
|
||||
|
@ -254,8 +254,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Panel Tests - Gauge Multi Series",
|
||||
|
@ -1319,8 +1319,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Panel Tests - Gauge",
|
||||
|
@ -372,8 +372,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Panel Tests - Graph - Gradient Area Fills",
|
||||
|
@ -569,8 +569,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Panel Tests - Graph Time Regions",
|
||||
|
@ -1639,8 +1639,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Panel Tests - Graph",
|
||||
|
@ -3408,8 +3408,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Panel Tests - Polystat",
|
||||
|
@ -440,8 +440,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Panel Tests - Table",
|
||||
|
@ -562,8 +562,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Panel Tests - Graph NG - Gradient Area Fills",
|
||||
|
@ -1132,8 +1132,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Panel tests - Slow Queries & Annotations",
|
||||
|
@ -684,8 +684,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "utc",
|
||||
"title": "Panel Tests - Time zone support",
|
||||
|
@ -151,17 +151,6 @@
|
||||
"1h",
|
||||
"2h",
|
||||
"1d"
|
||||
],
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
]
|
||||
},
|
||||
"timezone": "",
|
||||
|
@ -5376,17 +5376,6 @@
|
||||
"1d"
|
||||
],
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"type": "timepicker"
|
||||
},
|
||||
"timezone": "browser",
|
||||
|
@ -151,17 +151,6 @@
|
||||
"1h",
|
||||
"2h",
|
||||
"1d"
|
||||
],
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
]
|
||||
},
|
||||
"timezone": "",
|
||||
|
@ -5376,17 +5376,6 @@
|
||||
"1d"
|
||||
],
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"type": "timepicker"
|
||||
},
|
||||
"timezone": "browser",
|
||||
|
@ -138,12 +138,12 @@ The grid has a negative gravity that moves panels up if there is empty space abo
|
||||
"nowDelay": "",
|
||||
"quick_ranges": [
|
||||
{
|
||||
"display": "Last 6 hours"
|
||||
"display": "Last 6 hours",
|
||||
"from": "now-6h",
|
||||
"to": "now"
|
||||
},
|
||||
{
|
||||
"display": "Last 7 days"
|
||||
"display": "Last 7 days",
|
||||
"from": "now-7d",
|
||||
"to": "now"
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ lineage: schemas: [{
|
||||
|
||||
// Version of the JSON schema, incremented each time a Grafana update brings
|
||||
// changes to said schema.
|
||||
schemaVersion: uint16 | *39
|
||||
schemaVersion: uint16 | *41
|
||||
|
||||
// Version of the dashboard, incremented each time the dashboard is updated.
|
||||
version?: uint32
|
||||
@ -473,8 +473,6 @@ lineage: schemas: [{
|
||||
hidden?: bool | *false
|
||||
// Interval options available in the refresh picker dropdown.
|
||||
refresh_intervals?: [...string] | *["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
// Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard.
|
||||
time_options?: [...string] | *["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
// Quick ranges for time picker.
|
||||
quick_ranges?: [...#TimeOption]
|
||||
// Override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values.
|
||||
|
@ -1178,8 +1178,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Grafana metrics",
|
||||
|
@ -1394,8 +1394,7 @@
|
||||
},
|
||||
"timepicker": {
|
||||
"now": true,
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Prometheus 2.0 Stats",
|
||||
|
@ -825,8 +825,7 @@
|
||||
},
|
||||
"timepicker": {
|
||||
"now": true,
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Prometheus Stats",
|
||||
|
@ -681,17 +681,12 @@ export interface TimePickerConfig {
|
||||
* Interval options available in the refresh picker dropdown.
|
||||
*/
|
||||
refresh_intervals?: Array<string>;
|
||||
/**
|
||||
* Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard.
|
||||
*/
|
||||
time_options?: Array<string>;
|
||||
}
|
||||
|
||||
export const defaultTimePickerConfig: Partial<TimePickerConfig> = {
|
||||
hidden: false,
|
||||
quick_ranges: [],
|
||||
refresh_intervals: ['5s', '10s', '30s', '1m', '5m', '15m', '30m', '1h', '2h', '1d'],
|
||||
time_options: ['5m', '15m', '1h', '6h', '12h', '24h', '2d', '7d', '30d'],
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1205,7 +1200,7 @@ export const defaultDashboard: Partial<Dashboard> = {
|
||||
graphTooltip: DashboardCursorSync.Off,
|
||||
links: [],
|
||||
panels: [],
|
||||
schemaVersion: 39,
|
||||
schemaVersion: 41,
|
||||
tags: [],
|
||||
timezone: 'browser',
|
||||
};
|
||||
|
@ -447,6 +447,12 @@ QueryGroupKind: {
|
||||
spec: QueryGroupSpec
|
||||
}
|
||||
|
||||
TimeRangeOption: {
|
||||
display: string | *"Last 6 hours"
|
||||
from: string | *"now-6h"
|
||||
to: string | *"now"
|
||||
}
|
||||
|
||||
// Time configuration
|
||||
// It defines the default time config for the time picker, the refresh picker for the specific dashboard.
|
||||
TimeSettingsSpec: {
|
||||
@ -463,7 +469,7 @@ TimeSettingsSpec: {
|
||||
// Interval options available in the refresh picker dropdown.
|
||||
autoRefreshIntervals: [...string] | *["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"] // v1: timepicker.refresh_intervals
|
||||
// Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard.
|
||||
quickRanges: [...string] | *["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"] // v1: timepicker.time_options , not exposed in the UI
|
||||
quickRanges?: [...TimeRangeOption] // v1: timepicker.quick_ranges , not exposed in the UI
|
||||
// Whether timepicker is visible or not.
|
||||
hideTimepicker: bool // v1: timepicker.hidden
|
||||
// Day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday".
|
||||
|
@ -15,7 +15,6 @@ export const handyTestingSchema: DashboardV2Spec = {
|
||||
from: 'now-1h',
|
||||
hideTimepicker: false,
|
||||
nowDelay: '1m',
|
||||
quickRanges: [],
|
||||
timezone: 'UTC',
|
||||
to: 'now',
|
||||
weekStart: 'monday',
|
||||
|
@ -620,6 +620,18 @@ export const defaultQueryGroupKind = (): QueryGroupKind => ({
|
||||
spec: defaultQueryGroupSpec(),
|
||||
});
|
||||
|
||||
export interface TimeRangeOption {
|
||||
display: string;
|
||||
from: string;
|
||||
to: string;
|
||||
}
|
||||
|
||||
export const defaultTimeRangeOption = (): TimeRangeOption => ({
|
||||
display: "Last 6 hours",
|
||||
from: "now-6h",
|
||||
to: "now",
|
||||
});
|
||||
|
||||
// Time configuration
|
||||
// It defines the default time config for the time picker, the refresh picker for the specific dashboard.
|
||||
export interface TimeSettingsSpec {
|
||||
@ -638,8 +650,8 @@ export interface TimeSettingsSpec {
|
||||
// v1: timepicker.refresh_intervals
|
||||
autoRefreshIntervals: string[];
|
||||
// Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard.
|
||||
// v1: timepicker.time_options , not exposed in the UI
|
||||
quickRanges: string[];
|
||||
// v1: timepicker.quick_ranges , not exposed in the UI
|
||||
quickRanges?: TimeRangeOption[];
|
||||
// Whether timepicker is visible or not.
|
||||
// v1: timepicker.hidden
|
||||
hideTimepicker: boolean;
|
||||
@ -668,17 +680,6 @@ export const defaultTimeSettingsSpec = (): TimeSettingsSpec => ({
|
||||
"1h",
|
||||
"2h",
|
||||
"1d",
|
||||
],
|
||||
quickRanges: [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d",
|
||||
],
|
||||
hideTimepicker: false,
|
||||
fiscalYearStartMonth: 0,
|
||||
|
@ -48,8 +48,6 @@ type TimePickerConfig struct {
|
||||
Hidden *bool `json:"hidden,omitempty"`
|
||||
// Interval options available in the refresh picker dropdown.
|
||||
RefreshIntervals []string `json:"refresh_intervals,omitempty"`
|
||||
// Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard.
|
||||
TimeOptions []string `json:"time_options,omitempty"`
|
||||
// Quick ranges for time picker.
|
||||
QuickRanges []TimeOption `json:"quick_ranges,omitempty"`
|
||||
// Override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values.
|
||||
@ -61,7 +59,6 @@ func NewTimePickerConfig() *TimePickerConfig {
|
||||
return &TimePickerConfig{
|
||||
Hidden: (func(input bool) *bool { return &input })(false),
|
||||
RefreshIntervals: []string{"5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"},
|
||||
TimeOptions: []string{"5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"},
|
||||
}
|
||||
}
|
||||
|
||||
@ -927,7 +924,7 @@ func NewSpec() *Spec {
|
||||
Editable: (func(input bool) *bool { return &input })(true),
|
||||
GraphTooltip: (func(input DashboardCursorSync) *DashboardCursorSync { return &input })(DashboardCursorSyncOff),
|
||||
FiscalYearStartMonth: (func(input uint8) *uint8 { return &input })(0),
|
||||
SchemaVersion: 39,
|
||||
SchemaVersion: 41,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,8 +209,7 @@
|
||||
},
|
||||
"timepicker": {
|
||||
"now": true,
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Prometheus 2.0 Stats",
|
||||
|
@ -30,17 +30,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
|
@ -134,17 +134,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
|
@ -134,17 +134,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
|
@ -134,17 +134,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
|
@ -134,17 +134,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
|
@ -134,17 +134,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
|
@ -134,17 +134,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
|
@ -134,17 +134,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
|
@ -134,17 +134,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
|
@ -134,17 +134,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
|
@ -134,17 +134,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
],
|
||||
"refresh_intervals": [
|
||||
"5s",
|
||||
"10s",
|
||||
|
@ -210,17 +210,6 @@
|
||||
"1h",
|
||||
"2h",
|
||||
"1d"
|
||||
],
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
]
|
||||
},
|
||||
"timezone": "",
|
||||
|
@ -661,7 +661,6 @@ const customHomeDashboardV2Spec = {
|
||||
to: 'now',
|
||||
autoRefresh: '',
|
||||
autoRefreshIntervals: ['5s', '10s', '30s', '1m', '5m', '15m', '30m', '1h', '2h', '1d'],
|
||||
quickRanges: ['5m', '15m', '1h', '6h', '12h', '24h', '2d', '7d', '30d'],
|
||||
hideTimepicker: false,
|
||||
fiscalYearStartMonth: 0,
|
||||
},
|
||||
|
@ -584,7 +584,6 @@ describe('DashboardSceneSerializer', () => {
|
||||
to: '',
|
||||
autoRefresh: '',
|
||||
autoRefreshIntervals: [],
|
||||
quickRanges: [],
|
||||
hideTimepicker: false,
|
||||
fiscalYearStartMonth: 0,
|
||||
timezone: '',
|
||||
@ -646,7 +645,6 @@ describe('DashboardSceneSerializer', () => {
|
||||
from: 'now-1h',
|
||||
hideTimepicker: false,
|
||||
nowDelay: undefined,
|
||||
quickRanges: [],
|
||||
timezone: 'browser',
|
||||
to: 'now',
|
||||
});
|
||||
|
@ -4,6 +4,7 @@ import { DashboardV2Spec } from '@grafana/schema/dist/esm/schema/dashboard/v2alp
|
||||
import { AnnoKeyDashboardSnapshotOriginalUrl } from 'app/features/apiserver/types';
|
||||
import { DashboardWithAccessInfo } from 'app/features/dashboard/api/types';
|
||||
import { SaveDashboardAsOptions } from 'app/features/dashboard/components/SaveDashboard/types';
|
||||
import { DASHBOARD_SCHEMA_VERSION } from 'app/features/dashboard/state/DashboardMigrator';
|
||||
import {
|
||||
getPanelPluginCounts,
|
||||
getV1SchemaVariables,
|
||||
@ -185,7 +186,7 @@ export class V2DashboardSerializer
|
||||
|
||||
if (this.initialSaveModel) {
|
||||
return {
|
||||
schemaVersion: 40,
|
||||
schemaVersion: DASHBOARD_SCHEMA_VERSION,
|
||||
uid: s.state.uid,
|
||||
title: this.initialSaveModel.title,
|
||||
panels_count: panelPluginIds.length || 0,
|
||||
|
@ -280,7 +280,7 @@ exports[`transformSceneToSaveModel Given a scene with rows Should transform back
|
||||
],
|
||||
"preload": false,
|
||||
"refresh": "",
|
||||
"schemaVersion": 40,
|
||||
"schemaVersion": 41,
|
||||
"tags": [
|
||||
"templating",
|
||||
"gdev",
|
||||
@ -548,7 +548,7 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho
|
||||
],
|
||||
"preload": false,
|
||||
"refresh": "5m",
|
||||
"schemaVersion": 40,
|
||||
"schemaVersion": 41,
|
||||
"tags": [
|
||||
"tag1",
|
||||
"tag2",
|
||||
@ -906,7 +906,7 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr
|
||||
],
|
||||
"preload": false,
|
||||
"refresh": "",
|
||||
"schemaVersion": 40,
|
||||
"schemaVersion": 41,
|
||||
"tags": [
|
||||
"gdev",
|
||||
"graph-ng",
|
||||
|
@ -195,7 +195,6 @@ exports[`transformSceneToSaveModelSchemaV2 should transform scene to save model
|
||||
"from": "now-1h",
|
||||
"hideTimepicker": false,
|
||||
"nowDelay": "1m",
|
||||
"quickRanges": [],
|
||||
"timezone": "UTC",
|
||||
"to": "now",
|
||||
"weekStart": "monday",
|
||||
|
@ -185,7 +185,6 @@ describe('transformSceneToSaveModel', () => {
|
||||
timepicker: {
|
||||
...dashboard_to_load1.timepicker,
|
||||
refresh_intervals: ['5m', '15m', '30m', '1h'],
|
||||
time_options: ['5m', '15m', '30m'],
|
||||
hidden: true,
|
||||
},
|
||||
links: [{ ...NEW_LINK, title: 'Link 1' }],
|
||||
|
@ -89,7 +89,6 @@ export function transformSceneToSaveModelSchemaV2(scene: DashboardScene, isSnaps
|
||||
to: timeRange.to,
|
||||
autoRefresh: refreshPicker?.state.refresh || '',
|
||||
autoRefreshIntervals: refreshPicker?.state.intervals,
|
||||
quickRanges: [], //FIXME is coming timepicker.time_options,
|
||||
hideTimepicker: controlsState?.hideTimeControls ?? false,
|
||||
weekStart: timeRange.weekStart,
|
||||
fiscalYearStartMonth: timeRange.fiscalYearStartMonth,
|
||||
@ -502,7 +501,11 @@ function validateDashboardSchemaV2(dash: unknown): dash is DashboardV2Spec {
|
||||
if (!('autoRefreshIntervals' in dash.timeSettings) || !Array.isArray(dash.timeSettings.autoRefreshIntervals)) {
|
||||
throw new Error('AutoRefreshIntervals is not an array');
|
||||
}
|
||||
if (!('quickRanges' in dash.timeSettings) || !Array.isArray(dash.timeSettings.quickRanges)) {
|
||||
if (
|
||||
'quickRanges' in dash.timeSettings &&
|
||||
dash.timeSettings.quickRanges &&
|
||||
!Array.isArray(dash.timeSettings.quickRanges)
|
||||
) {
|
||||
throw new Error('QuickRanges is not an array');
|
||||
}
|
||||
if (!('hideTimepicker' in dash.timeSettings) || typeof dash.timeSettings.hideTimepicker !== 'boolean') {
|
||||
|
@ -166,7 +166,6 @@ export function restore(version: number, restoredFrom?: number) {
|
||||
},
|
||||
timepicker: {
|
||||
refresh_intervals: ['5s', '10s', '30s', '1m', '5m', '15m', '30m', '1h', '2h', '1d'],
|
||||
time_options: ['5m', '15m', '1h', '6h', '12h', '24h', '2d', '7d', '30d'],
|
||||
},
|
||||
timezone: 'utc',
|
||||
title: 'History Dashboard',
|
||||
|
@ -113,8 +113,19 @@ describe('ResponseTransformers', () => {
|
||||
timepicker: {
|
||||
refresh_intervals: ['5s', '10s', '30s'],
|
||||
hidden: false,
|
||||
time_options: ['5m', '15m', '1h'],
|
||||
nowDelay: '1m',
|
||||
quick_ranges: [
|
||||
{
|
||||
display: 'Last 6 hours',
|
||||
from: 'now-6h',
|
||||
to: 'now',
|
||||
},
|
||||
{
|
||||
display: 'Last 7 days',
|
||||
from: 'now-7d',
|
||||
to: 'now',
|
||||
},
|
||||
],
|
||||
},
|
||||
fiscalYearStartMonth: 1,
|
||||
weekStart: 'monday',
|
||||
@ -462,7 +473,7 @@ describe('ResponseTransformers', () => {
|
||||
expect(spec.timeSettings.autoRefresh).toBe(dashboardV1.refresh);
|
||||
expect(spec.timeSettings.autoRefreshIntervals).toEqual(dashboardV1.timepicker?.refresh_intervals);
|
||||
expect(spec.timeSettings.hideTimepicker).toBe(dashboardV1.timepicker?.hidden);
|
||||
expect(spec.timeSettings.quickRanges).toEqual(dashboardV1.timepicker?.time_options);
|
||||
expect(spec.timeSettings.quickRanges).toEqual(dashboardV1.timepicker?.quick_ranges);
|
||||
expect(spec.timeSettings.nowDelay).toBe(dashboardV1.timepicker?.nowDelay);
|
||||
expect(spec.timeSettings.fiscalYearStartMonth).toBe(dashboardV1.fiscalYearStartMonth);
|
||||
expect(spec.timeSettings.weekStart).toBe(dashboardV1.weekStart);
|
||||
@ -655,7 +666,18 @@ describe('ResponseTransformers', () => {
|
||||
autoRefresh: '5m',
|
||||
autoRefreshIntervals: ['5s', '10s', '30s'],
|
||||
hideTimepicker: false,
|
||||
quickRanges: ['5m', '15m', '1h'],
|
||||
quickRanges: [
|
||||
{
|
||||
display: 'Last 6 hours',
|
||||
from: 'now-6h',
|
||||
to: 'now',
|
||||
},
|
||||
{
|
||||
display: 'Last 7 days',
|
||||
from: 'now-7d',
|
||||
to: 'now',
|
||||
},
|
||||
],
|
||||
nowDelay: '1m',
|
||||
fiscalYearStartMonth: 1,
|
||||
weekStart: 'monday',
|
||||
@ -730,7 +752,6 @@ describe('ResponseTransformers', () => {
|
||||
expect(dashboard.refresh).toBe(dashboardV2.spec.timeSettings.autoRefresh);
|
||||
expect(dashboard.timepicker?.refresh_intervals).toEqual(dashboardV2.spec.timeSettings.autoRefreshIntervals);
|
||||
expect(dashboard.timepicker?.hidden).toBe(dashboardV2.spec.timeSettings.hideTimepicker);
|
||||
expect(dashboard.timepicker?.time_options).toEqual(dashboardV2.spec.timeSettings.quickRanges);
|
||||
expect(dashboard.timepicker?.nowDelay).toBe(dashboardV2.spec.timeSettings.nowDelay);
|
||||
expect(dashboard.fiscalYearStartMonth).toBe(dashboardV2.spec.timeSettings.fiscalYearStartMonth);
|
||||
expect(dashboard.weekStart).toBe(dashboardV2.spec.timeSettings.weekStart);
|
||||
|
@ -160,7 +160,7 @@ export function ensureV2Response(
|
||||
autoRefreshIntervals: dashboard.timepicker?.refresh_intervals || timeSettingsDefaults.autoRefreshIntervals,
|
||||
fiscalYearStartMonth: dashboard.fiscalYearStartMonth || timeSettingsDefaults.fiscalYearStartMonth,
|
||||
hideTimepicker: dashboard.timepicker?.hidden || timeSettingsDefaults.hideTimepicker,
|
||||
quickRanges: dashboard.timepicker?.time_options || timeSettingsDefaults.quickRanges,
|
||||
quickRanges: dashboard.timepicker?.quick_ranges,
|
||||
// casting WeekStart here to avoid editing old schema
|
||||
weekStart: (dashboard.weekStart as WeekStart) || timeSettingsDefaults.weekStart,
|
||||
nowDelay: dashboard.timepicker?.nowDelay || timeSettingsDefaults.nowDelay,
|
||||
@ -252,7 +252,7 @@ export function ensureV1Response(
|
||||
timepicker: {
|
||||
refresh_intervals: spec.timeSettings.autoRefreshIntervals,
|
||||
hidden: spec.timeSettings.hideTimepicker,
|
||||
time_options: spec.timeSettings.quickRanges,
|
||||
quick_ranges: spec.timeSettings.quickRanges,
|
||||
nowDelay: spec.timeSettings.nowDelay,
|
||||
},
|
||||
fiscalYearStartMonth: spec.timeSettings.fiscalYearStartMonth,
|
||||
|
@ -23,7 +23,6 @@ const setupTestContext = (options: Partial<Props>) => {
|
||||
description: 'test dashboard description',
|
||||
timepicker: {
|
||||
refresh_intervals: ['5s', '10s', '30s', '1m', '5m', '15m', '30m', '1h', '2h', '1d', '2d'],
|
||||
time_options: ['5m', '15m', '1h', '6h', '12h', '24h', '2d', '7d', '30d'],
|
||||
hidden: false,
|
||||
},
|
||||
timezone: 'utc',
|
||||
|
@ -245,7 +245,7 @@ describe('PublicDashboardPage', () => {
|
||||
...dashboardBase,
|
||||
getModel: () =>
|
||||
getTestDashboard({
|
||||
timepicker: { hidden: false, refresh_intervals: [], time_options: [] },
|
||||
timepicker: { hidden: false, refresh_intervals: [] },
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
@ -2428,6 +2428,28 @@ describe('when migrating variable refresh to on dashboard load', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('when migrating time_options in timepicker', () => {
|
||||
let model: DashboardModel;
|
||||
|
||||
it('should remove the property', () => {
|
||||
model = new DashboardModel({
|
||||
timepicker: {
|
||||
//@ts-expect-error
|
||||
time_options: ['5m', '15m', '1h', '6h', '12h', '24h', '2d', '7d', '30d'],
|
||||
},
|
||||
});
|
||||
|
||||
expect(model.timepicker).not.toHaveProperty('time_options');
|
||||
});
|
||||
|
||||
it('should not throw with empty timepicker', () => {
|
||||
//@ts-expect-error
|
||||
model = new DashboardModel({});
|
||||
|
||||
expect(model.timepicker).not.toHaveProperty('time_options');
|
||||
});
|
||||
});
|
||||
|
||||
function createRow(options: any, panelDescriptions: any[]) {
|
||||
const PANEL_HEIGHT_STEP = GRID_CELL_HEIGHT + GRID_CELL_VMARGIN;
|
||||
const { collapse, showTitle, title, repeat, repeatIteration } = options;
|
||||
|
@ -81,7 +81,7 @@ type PanelSchemeUpgradeHandler = (panel: PanelModel) => PanelModel;
|
||||
* kinds/dashboard/dashboard_kind.cue
|
||||
* Example PR: #87712
|
||||
*/
|
||||
export const DASHBOARD_SCHEMA_VERSION = 40;
|
||||
export const DASHBOARD_SCHEMA_VERSION = 41;
|
||||
export class DashboardMigrator {
|
||||
dashboard: DashboardModel;
|
||||
|
||||
@ -905,12 +905,20 @@ export class DashboardMigrator {
|
||||
}
|
||||
|
||||
if (oldVersion < 40) {
|
||||
// In old ashboards refresh property can be a boolean
|
||||
// In old dashboards refresh property can be a boolean
|
||||
if (typeof this.dashboard.refresh !== 'string') {
|
||||
this.dashboard.refresh = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (oldVersion < 41) {
|
||||
// time_options is a legacy property that was not used since grafana version 5
|
||||
// therefore deprecating this property from the schema
|
||||
if ('time_options' in this.dashboard.timepicker) {
|
||||
delete this.dashboard.timepicker.time_options;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* -==- Add migration here -==-
|
||||
* Your migration should go below the previous
|
||||
|
@ -199,8 +199,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Simple Streaming Example",
|
||||
|
@ -154,7 +154,6 @@
|
||||
"now": true,
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"status": "Stable",
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"],
|
||||
"type": "timepicker"
|
||||
},
|
||||
"templating": {
|
||||
|
@ -4771,7 +4771,6 @@
|
||||
"now": true,
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"status": "Stable",
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"],
|
||||
"type": "timepicker"
|
||||
},
|
||||
"timezone": "utc",
|
||||
|
@ -1177,8 +1177,7 @@
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Grafana metrics",
|
||||
|
@ -1393,8 +1393,7 @@
|
||||
},
|
||||
"timepicker": {
|
||||
"now": true,
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Prometheus 2.0 Stats",
|
||||
|
@ -824,8 +824,7 @@
|
||||
},
|
||||
"timepicker": {
|
||||
"now": true,
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Prometheus Stats",
|
||||
|
@ -131,7 +131,6 @@
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"],
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"now": true
|
||||
}
|
||||
|
@ -68,7 +68,6 @@
|
||||
"timepicker": {
|
||||
"hidden": true,
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"],
|
||||
"type": "timepicker"
|
||||
},
|
||||
"timezone": "browser",
|
||||
|
@ -169,7 +169,6 @@
|
||||
"notice": false,
|
||||
"enable": true,
|
||||
"status": "Stable",
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"],
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"now": true
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user