Add support for seriesOverrides
Reference: https://github.com/grafana/grafana/blob/master/public/app/plugins/panels/graph/seriesOverridesCtrl.js#L94 Change-Id: I22743f566b32aaa5527237dd023551a8f3a3dbc4
This commit is contained in:
parent
cdc1df0e27
commit
187caf92d7
@ -93,6 +93,26 @@ class Graph(Base):
|
||||
v.Required('value_type', default='cumulative'): v.All(value_types),
|
||||
}
|
||||
|
||||
series_override = {
|
||||
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('width'): v.All(int, v.Range(min=1, max=10)),
|
||||
v.Optional('nullPointMode'): v.All(null_point_modes),
|
||||
v.Optional('fillBelowTo'): v.All(str),
|
||||
v.Optional('steppedLine'): v.All(bool),
|
||||
v.Optional('points'): v.All(bool),
|
||||
v.Optional('pointsradius'): v.All(int, v.Range(min=1, max=5)),
|
||||
v.Optional('stack'): v.All(v.Any(bool, 'A', 'B', 'C', 'D')),
|
||||
v.Optional('color'): v.All(str),
|
||||
v.Optional('yaxis'): v.All(int, v.Range(min=1, max=2)),
|
||||
v.Optional('zindex'): v.All(int, v.Range(min=-3, max=3)),
|
||||
v.Optional('transform'): v.All(v.Any('negative-Y')),
|
||||
v.Optional('legend'): v.All(bool),
|
||||
}
|
||||
series_overrides = [series_override]
|
||||
|
||||
graph = {
|
||||
v.Required('bars', default=False): v.All(bool),
|
||||
v.Required('fill', default=1): v.All(int),
|
||||
@ -104,6 +124,8 @@ class Graph(Base):
|
||||
v.Required('pointradius', default=5): v.All(int),
|
||||
v.Required('points', default=False): v.All(bool),
|
||||
v.Optional('rightYAxisLabel'): v.All(str, v.Length(min=1)),
|
||||
v.Optional('seriesOverrides'): v.All(series_overrides,
|
||||
v.Length(min=1)),
|
||||
v.Required('stack', default=False): v.All(bool),
|
||||
v.Required('steppedLine', default=False): v.All(bool),
|
||||
v.Required('targets', default=[]): v.All(list),
|
||||
|
62
tests/schema/fixtures/dashboard-0013.json
Normal file
62
tests/schema/fixtures/dashboard-0013.json
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"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",
|
||||
"bars": true,
|
||||
"color": "#ff00ff",
|
||||
"fill": 5,
|
||||
"fillBelowTo": "something",
|
||||
"legend": true,
|
||||
"lines": true,
|
||||
"nullPointMode": "null as zero",
|
||||
"points": true,
|
||||
"pointsradius": 3,
|
||||
"stack": true,
|
||||
"steppedLine": true,
|
||||
"transform": "negative-Y",
|
||||
"width": 5,
|
||||
"yaxis": 2,
|
||||
"zindex": 1
|
||||
},
|
||||
{
|
||||
"alias": "bar",
|
||||
"stack": "A"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"timezone": "utc",
|
||||
"title": "New dashboard"
|
||||
}
|
||||
}
|
||||
}
|
27
tests/schema/fixtures/dashboard-0013.yaml
Normal file
27
tests/schema/fixtures/dashboard-0013.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
dashboard:
|
||||
title: New dashboard
|
||||
rows:
|
||||
- title: New row
|
||||
height: 250px
|
||||
panels:
|
||||
- title: no title (click here)
|
||||
type: graph
|
||||
seriesOverrides:
|
||||
- alias: foo
|
||||
bars: True
|
||||
lines: True
|
||||
fill: 5
|
||||
width: 5
|
||||
nullPointMode: null as zero
|
||||
fillBelowTo: something
|
||||
steppedLine: True
|
||||
points: True
|
||||
pointsradius: 3
|
||||
stack: True
|
||||
color: '#ff00ff'
|
||||
yaxis: 2
|
||||
zindex: 1
|
||||
transform: negative-Y
|
||||
legend: True
|
||||
- alias: bar
|
||||
stack: A
|
Loading…
x
Reference in New Issue
Block a user