mirror of
https://github.com/valitydev/grafanalib.git
synced 2024-11-06 10:15:24 +00:00
parent
9086f8c943
commit
3e8cb3c843
@ -2,6 +2,17 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
0.5.1 (2018-02-27)
|
||||
==================
|
||||
|
||||
Fixes
|
||||
-----
|
||||
|
||||
* Fix for crasher bug that broke ``SingleStat``, introduced by `#114`_
|
||||
|
||||
.. _`#114`: https://github.com/weaveworks/grafanalib/pull/114
|
||||
|
||||
|
||||
0.5.0 (2018-02-26)
|
||||
==================
|
||||
|
||||
|
@ -962,7 +962,7 @@ class SparkLine(object):
|
||||
)
|
||||
full = attr.ib(default=False, validator=instance_of(bool))
|
||||
lineColor = attr.ib(
|
||||
default=attr.Factory(BLUE_RGB),
|
||||
default=attr.Factory(lambda: BLUE_RGB),
|
||||
validator=instance_of(RGB),
|
||||
)
|
||||
show = attr.ib(default=False, validator=instance_of(bool))
|
||||
@ -1056,12 +1056,12 @@ class Text(object):
|
||||
|
||||
@attr.s
|
||||
class SingleStat(object):
|
||||
"""Generates Signle Stat panel json structure
|
||||
"""Generates Single Stat panel json structure
|
||||
|
||||
Grafana doc on singlestat: http://docs.grafana.org/reference/singlestat/
|
||||
|
||||
:param dataSource: Grafana datasource name
|
||||
:param targets: list of metric requests for chousen datasource
|
||||
:param targets: list of metric requests for chosen datasource
|
||||
:param title: panel title
|
||||
:param cacheTimeout: metric query result cache ttl
|
||||
:param colors: the list of colors that can be used for coloring
|
||||
|
@ -22,3 +22,14 @@ def test_table_styled_columns():
|
||||
assert t.styles == [
|
||||
G.ColumnStyle(pattern='Foo'),
|
||||
]
|
||||
|
||||
|
||||
def test_single_stat():
|
||||
data_source = 'dummy data source'
|
||||
targets = ['dummy_prom_query']
|
||||
title = 'dummy title'
|
||||
single_stat = G.SingleStat(data_source, targets, title)
|
||||
data = single_stat.to_json_data()
|
||||
assert data['targets'] == targets
|
||||
assert data['datasource'] == data_source
|
||||
assert data['title'] == title
|
||||
|
Loading…
Reference in New Issue
Block a user