Initial support for graph panel

Change-Id: I16b9affd4402fe5d1637238a2e27f22fdd3986ff
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-09-17 12:19:23 -04:00
parent a04ac20eaa
commit 9068020fb2
3 changed files with 62 additions and 1 deletions

View File

@ -23,7 +23,7 @@ class Panel(object):
v.Required('error', default=False): v.All(bool),
v.Required('span', default=12): v.All(int, v.Range(min=0, max=12)),
v.Required('title'): v.All(str, v.Length(min=1)),
v.Required('type'): v.Any('dashlist', 'text'),
v.Required('type'): v.Any('dashlist', 'graph', 'text'),
v.Optional('id'): int,
}
@ -35,6 +35,22 @@ class Panel(object):
}
self.dashlist.update(self.base)
self.graph = {
v.Required('bars', default=False): v.All(bool),
v.Required('fill', default=1): v.All(int),
v.Required('lines', default=True): v.All(bool),
v.Required('linewidth', default=2): v.All(int),
v.Required('percentage', default=False): v.All(bool),
v.Required('pointradius', default=5): v.All(int),
v.Required('points', default=False): v.All(bool),
v.Required('stack', default=False): v.All(bool),
v.Required('steppedLine', default=False): v.All(bool),
v.Required('targets', default=[]): v.All(list),
v.Required('x-axis', default=True): v.All(bool),
v.Required('y-axis', default=True): v.All(bool),
}
self.graph.update(self.base)
self.text = {
v.Required('content'): v.All(str),
v.Required('mode', default='markdown'): v.Any(
@ -57,6 +73,8 @@ class Panel(object):
panel = v.Schema(self.text)
elif x['type'] == 'dashlist':
panel = v.Schema(self.dashlist)
elif x['type'] == 'graph':
panel = v.Schema(self.graph)
res.append(panel(x))

View File

@ -0,0 +1,35 @@
{
"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,
"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"
}
],
"title": "New dashboard"
}
}

View File

@ -0,0 +1,8 @@
dashboard:
title: New dashboard
rows:
- title: New row
height: 250px
panels:
- title: no title (click here)
type: graph