Fix scopping error with panel validation
This fixes an issue where we were lumping each panel into all rows, regardless of the yaml syntax provided. Also add unit test for code coverage. Change-Id: Ibc1e086d777692889f9c1dc26741e247bf90a985 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
5be3782e4a
commit
f83e3e45d8
@ -44,9 +44,9 @@ class Panel(object):
|
||||
self.text.update(self.base)
|
||||
|
||||
def _validate(self):
|
||||
res = []
|
||||
|
||||
def f(data):
|
||||
res = []
|
||||
if not isinstance(data, list):
|
||||
raise v.Invalid('Should be a list')
|
||||
|
||||
|
45
tests/schema/fixtures/dashboard-0007.json
Normal file
45
tests/schema/fixtures/dashboard-0007.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"dashboard": {
|
||||
"rows": [
|
||||
{
|
||||
"collapse": false,
|
||||
"editable": true,
|
||||
"height": "250px",
|
||||
"panels": [
|
||||
{
|
||||
"editable": true,
|
||||
"error": false,
|
||||
"limit": 10,
|
||||
"mode": "starred",
|
||||
"query": "",
|
||||
"span": 12,
|
||||
"tag": "",
|
||||
"title": "Starred Dashboards",
|
||||
"type": "dashlist"
|
||||
}
|
||||
],
|
||||
"showTitle": false,
|
||||
"title": "foo"
|
||||
},
|
||||
{
|
||||
"collapse": false,
|
||||
"editable": true,
|
||||
"height": "250px",
|
||||
"panels": [
|
||||
{
|
||||
"content": "Some example text is required.",
|
||||
"editable": true,
|
||||
"error": false,
|
||||
"mode": "markdown",
|
||||
"span": 12,
|
||||
"title": "no title (click here)",
|
||||
"type": "text"
|
||||
}
|
||||
],
|
||||
"showTitle": false,
|
||||
"title": "bar"
|
||||
}
|
||||
],
|
||||
"title": "New dashboard"
|
||||
}
|
||||
}
|
16
tests/schema/fixtures/dashboard-0007.yaml
Normal file
16
tests/schema/fixtures/dashboard-0007.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
dashboard:
|
||||
title: New dashboard
|
||||
rows:
|
||||
- title: foo
|
||||
height: 250px
|
||||
panels:
|
||||
- title: Starred Dashboards
|
||||
type: dashlist
|
||||
mode: starred
|
||||
- title: bar
|
||||
height: 250px
|
||||
panels:
|
||||
- title: no title (click here)
|
||||
type: text
|
||||
mode: markdown
|
||||
content: Some example text is required.
|
Loading…
x
Reference in New Issue
Block a user