From a38798a292210c27423f86503322bb734aef3a92 Mon Sep 17 00:00:00 2001 From: Ye Na Rhee Date: Sun, 17 Apr 2016 22:04:45 +0200 Subject: [PATCH] Enable no fill in seriesOverrides This allows fill to take the minimum value of 0. Change-Id: I4c3a37fcfd6de24332ee05ca0d897e6d4973c525 --- grafana_dashboards/schema/panel/graph.py | 2 +- tests/schema/fixtures/dashboard-0016.json | 49 +++++++++++++++++++++++ tests/schema/fixtures/dashboard-0016.yaml | 12 ++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 tests/schema/fixtures/dashboard-0016.json create mode 100644 tests/schema/fixtures/dashboard-0016.yaml diff --git a/grafana_dashboards/schema/panel/graph.py b/grafana_dashboards/schema/panel/graph.py index 361b7f2..0b0cc00 100644 --- a/grafana_dashboards/schema/panel/graph.py +++ b/grafana_dashboards/schema/panel/graph.py @@ -97,7 +97,7 @@ class Graph(Base): v.Required('alias'): v.All(str, v.Length(min=1)), v.Optional('bars'): v.All(bool), v.Optional('lines'): v.All(bool), - v.Optional('fill'): v.All(int, v.Range(min=1, max=10)), + v.Optional('fill'): v.All(int, v.Range(min=0, max=10)), v.Optional('width'): v.All(int, v.Range(min=1, max=10)), v.Optional('nullPointMode'): v.All(null_point_modes), v.Optional('fillBelowTo'): v.All(str), diff --git a/tests/schema/fixtures/dashboard-0016.json b/tests/schema/fixtures/dashboard-0016.json new file mode 100644 index 0000000..3aae74e --- /dev/null +++ b/tests/schema/fixtures/dashboard-0016.json @@ -0,0 +1,49 @@ +{ + "dashboard": { + "new-dashboard": { + "rows": [ + { + "collapse": false, + "editable": true, + "height": "250px", + "panels": [ + { + "bars": false, + "editable": true, + "error": false, + "fill": 1, + "lines": true, + "linewidth": 2, + "percentage": false, + "pointradius": 5, + "points": false, + "seriesOverrides": [ + { + "alias": "foo", + "fill": 0, + "lines": true + } + ], + "span": 12, + "stack": false, + "steppedLine": false, + "targets": [], + "title": "no title (click here)", + "type": "graph", + "x-axis": true, + "y-axis": true + } + ], + "showTitle": false, + "title": "New row" + } + ], + "templating": { + "enabled": false, + "list": [] + }, + "timezone": "utc", + "title": "New dashboard" + } + } +} diff --git a/tests/schema/fixtures/dashboard-0016.yaml b/tests/schema/fixtures/dashboard-0016.yaml new file mode 100644 index 0000000..d8098d4 --- /dev/null +++ b/tests/schema/fixtures/dashboard-0016.yaml @@ -0,0 +1,12 @@ +dashboard: + title: New dashboard + rows: + - title: New row + height: 250px + panels: + - title: no title (click here) + type: graph + seriesOverrides: + - alias: foo + fill: 0 + lines: True