Additional fields for singlestat panel

We are adding support for the following fields:

  decimals
  postfix
  postfixFontSize
  prefix
  prefixFontSize
  valueFontSize

Change-Id: I45c8d953ae6847a078a7d2c916d1ddc189bcfb1a
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-11-04 11:28:37 -05:00
parent 4fc2eb8bac
commit df8d304b24
2 changed files with 20 additions and 0 deletions

View File

@ -75,11 +75,26 @@ class Panel(object):
v.Required('colorBackground', default=False): v.All(bool),
v.Required('colorValue', default=False): v.All(bool),
v.Required('maxDataPoints', default=100): v.All(int),
v.Required('postfix', default=''): v.All(str),
# Support 0% to 200% by 10
v.Required(
'postfixFontSize', default='50%'): v.All(
v.Match(r'^[1-9]?[0]{1}%$|^1[0-9]?[0]{1}%$|^200%$')),
v.Required('prefix', default=''): v.All(str),
# Support 0% to 200% by 10
v.Required(
'prefixFontSize', default='50%'): v.All(
v.Match(r'^[1-9]?[0]{1}%$|^1[0-9]?[0]{1}%$|^200%$')),
v.Required('sparkline', default=sparkline_defaults): sparkline,
v.Required('targets', default=[]): v.All(list),
v.Required('thresholds', default=''): v.All(str),
# Support 0% to 200% by 10
v.Required(
'valueFontSize', default='80%'): v.All(
v.Match(r'^[1-9]?[0]{1}%$|^1[0-9]?[0]{1}%$|^200%$')),
v.Required('valueName', default='avg'): v.All(
'avg', 'current', 'max', 'min', 'total'),
v.Optional('decimals'): v.All(int, v.Range(min=0, max=12)),
}
self.singlestat.update(self.base)

View File

@ -13,6 +13,10 @@
"editable": true,
"error": false,
"maxDataPoints": 100,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"span": 12,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
@ -24,6 +28,7 @@
"thresholds": "",
"title": "no title (click here)",
"type": "singlestat",
"valueFontSize": "80%",
"valueName": "avg"
}
],