Add yaxes format for newer versions of Grafana
y_formats has moved to yaxes, but still support y_formats Change-Id: Iabd1302352c77dc82c543412596e21550e4c0579
This commit is contained in:
parent
2cee4f2908
commit
f4b52386cc
@ -81,8 +81,17 @@ class Graph(Base):
|
||||
u'pressurehg',
|
||||
u'pressurepsi',
|
||||
)
|
||||
|
||||
y_formats = [y_format]
|
||||
yaxes_format = [
|
||||
{
|
||||
v.Optional('decimals'): int,
|
||||
v.Optional('format', default='short'): y_format,
|
||||
v.Optional('label', default=''): v.All(str),
|
||||
v.Optional('logBase', default=1): v.All(int, v.Range(min=1)),
|
||||
v.Optional('max'): v.All(int, v.Range(min=1)),
|
||||
v.Optional('min'): v.All(int, v.Range(min=1)),
|
||||
v.Optional('show', default=True): v.All(bool),
|
||||
}
|
||||
]
|
||||
|
||||
legend = {
|
||||
v.Optional('alignAsTable', default=False): v.All(bool),
|
||||
@ -149,7 +158,8 @@ class Graph(Base):
|
||||
v.Optional('tooltip'): v.All(tooltip),
|
||||
v.Required('x-axis', default=True): v.All(bool),
|
||||
v.Required('y-axis', default=True): v.All(bool),
|
||||
v.Optional('y_formats'): v.All(y_formats, v.Length(min=2, max=2)),
|
||||
v.Optional('y_formats'): v.All([y_format], v.Length(min=2, max=2)),
|
||||
v.Optional('yaxes'): v.All(yaxes_format, v.Length(min=2, max=2)),
|
||||
}
|
||||
graph.update(self.base)
|
||||
return v.Schema(graph)
|
||||
|
58
tests/schema/fixtures/dashboard-0025.json
Normal file
58
tests/schema/fixtures/dashboard-0025.json
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"dashboard": {
|
||||
"new-dashboard": {
|
||||
"rows": [
|
||||
{
|
||||
"collapse": false,
|
||||
"editable": true,
|
||||
"height": "250px",
|
||||
"panels": [
|
||||
{
|
||||
"bars": false,
|
||||
"editable": true,
|
||||
"error": false,
|
||||
"fill": 1,
|
||||
"leftYAxisLabel": "left label",
|
||||
"lines": true,
|
||||
"linewidth": 2,
|
||||
"percentage": false,
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"rightYAxisLabel": "right label",
|
||||
"span": 12,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [],
|
||||
"title": "no title (click here)",
|
||||
"type": "graph",
|
||||
"x-axis": true,
|
||||
"y-axis": true,
|
||||
"yaxes": [
|
||||
{
|
||||
"format": "hertz",
|
||||
"label": "",
|
||||
"logBase": 1,
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"format": "\u00b5s",
|
||||
"label": "",
|
||||
"logBase": 1,
|
||||
"show": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"showTitle": false,
|
||||
"title": "New row"
|
||||
}
|
||||
],
|
||||
"templating": {
|
||||
"enabled": false,
|
||||
"list": []
|
||||
},
|
||||
"timezone": "utc",
|
||||
"title": "New dashboard"
|
||||
}
|
||||
}
|
||||
}
|
13
tests/schema/fixtures/dashboard-0025.yaml
Normal file
13
tests/schema/fixtures/dashboard-0025.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
dashboard:
|
||||
title: New dashboard
|
||||
rows:
|
||||
- title: New row
|
||||
height: 250px
|
||||
panels:
|
||||
- title: no title (click here)
|
||||
type: graph
|
||||
leftYAxisLabel: left label
|
||||
rightYAxisLabel: right label
|
||||
yaxes:
|
||||
- format: hertz
|
||||
- format: µs
|
Loading…
x
Reference in New Issue
Block a user