Skip to content

Commit

Permalink
add unit to tables and hide flag to es targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Gil Popilski committed Jun 17, 2023
1 parent 38cc336 commit ae64dc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions grafanalib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3156,6 +3156,7 @@ class Table(Panel):
:param mappings: To assign colors to boolean or string values, use Value mappings
:param overrides: To override the base characteristics of certain data
:param showHeader: Show the table header
:param unit: units
"""

align = attr.ib(default='auto', validator=instance_of(str))
Expand All @@ -3167,7 +3168,8 @@ class Table(Panel):
mappings = attr.ib(default=attr.Factory(list))
overrides = attr.ib(default=attr.Factory(list))
showHeader = attr.ib(default=True, validator=instance_of(bool))
span = attr.ib(default=6)
span = attr.ib(default=6),
unit = attr.ib(default='', validator=instance_of(str))

@classmethod
def with_styled_columns(cls, columns, styles=None, **kwargs):
Expand All @@ -3189,8 +3191,9 @@ def to_json_data(self):
'custom': {
'align': self.align,
'displayMode': self.displayMode,
'filterable': self.filterable
'filterable': self.filterable,
},
'unit': self.unit
},
'overrides': self.overrides
},
Expand Down
3 changes: 3 additions & 0 deletions grafanalib/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ class ElasticsearchTarget(object):
:param query: query
:param refId: target reference id
:param timeField: name of the elasticsearch time field
:param hide: show/hide the target result in the final panel display
"""

alias = attr.ib(default=None)
Expand All @@ -373,6 +374,7 @@ class ElasticsearchTarget(object):
query = attr.ib(default="", validator=instance_of(str))
refId = attr.ib(default="", validator=instance_of(str))
timeField = attr.ib(default="@timestamp", validator=instance_of(str))
hide = attr.ib(default=False, validator=instance_of(bool))

def _map_bucket_aggs(self, f):
return attr.evolve(self, bucketAggs=list(map(f, self.bucketAggs)))
Expand Down Expand Up @@ -407,6 +409,7 @@ def to_json_data(self):
'query': self.query,
'refId': self.refId,
'timeField': self.timeField,
'hide': self.hide,
}


Expand Down

0 comments on commit ae64dc6

Please sign in to comment.