diff --git a/grafana_dashboards/schema/panel/singlestat.py b/grafana_dashboards/schema/panel/singlestat.py index f8b48e4..7c81fb7 100644 --- a/grafana_dashboards/schema/panel/singlestat.py +++ b/grafana_dashboards/schema/panel/singlestat.py @@ -39,6 +39,14 @@ class Singlestat(Base): v.Required('show', default=False): v.All(bool), } + gauge = { + v.Required('maxValue'): v.All(int), + v.Required('minValue'): v.Any(int), + v.Required('show', default=False): v.All(bool), + v.Required('thresholdLabels', default=False): v.All(bool), + v.Required('thresholdMarkers', default=False): v.All(bool), + } + singlestat = { v.Required('colorBackground', default=False): v.All(bool), v.Required('colorValue', default=False): v.All(bool), @@ -64,6 +72,7 @@ class Singlestat(Base): 'avg', 'current', 'max', 'min', 'total'), v.Optional('datasource'): v.All(str), v.Optional('decimals'): v.All(int, v.Range(min=0, max=12)), + v.Optional('gauge'): gauge, v.Optional('hideTimeOverride'): v.All(bool), v.Optional('timeFrom'): v.All(v.Match(r'[1-9]+[0-9]*[smhdw]')), v.Optional('timeShift'): v.All(v.Match(r'[1-9]+[0-9]*[smhdw]')), diff --git a/tests/schema/fixtures/dashboard-0017.json b/tests/schema/fixtures/dashboard-0017.json index 6c3bca2..1bace55 100644 --- a/tests/schema/fixtures/dashboard-0017.json +++ b/tests/schema/fixtures/dashboard-0017.json @@ -12,6 +12,13 @@ "colorValue": false, "editable": true, "error": false, + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": true, + "thresholdLabels": false, + "thresholdMarkers": true + }, "hideTimeOverride": true, "maxDataPoints": 100, "postfix": "", diff --git a/tests/schema/fixtures/dashboard-0017.yaml b/tests/schema/fixtures/dashboard-0017.yaml index 34e18d7..04fb383 100644 --- a/tests/schema/fixtures/dashboard-0017.yaml +++ b/tests/schema/fixtures/dashboard-0017.yaml @@ -9,3 +9,9 @@ dashboard: timeFrom: 10d timeShift: 1h hideTimeOverride: true + gauge: + maxValue: 100 + minValue: 0 + show: true + thresholdLabels: false + thresholdMarkers: true