mirror of
https://github.com/valitydev/grafanalib.git
synced 2024-11-06 10:15:24 +00:00
Merge pull request #166 from kevingessner/template-sort
support templating variable sort options
This commit is contained in:
commit
c9c033df3d
@ -184,6 +184,13 @@ REFRESH_ON_TIME_RANGE_CHANGE = 2
|
|||||||
SHOW = 0
|
SHOW = 0
|
||||||
HIDE_LABEL = 1
|
HIDE_LABEL = 1
|
||||||
HIDE_VARIABLE = 2
|
HIDE_VARIABLE = 2
|
||||||
|
SORT_DISABLED = 0
|
||||||
|
SORT_ALPHA_ASC = 1
|
||||||
|
SORT_ALPHA_DESC = 2
|
||||||
|
SORT_NUMERIC_ASC = 3
|
||||||
|
SORT_NUMERIC_DESC = 4
|
||||||
|
SORT_ALPHA_IGNORE_CASE_ASC = 5
|
||||||
|
SORT_ALPHA_IGNORE_CASE_DESC = 6
|
||||||
|
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
@ -636,6 +643,7 @@ class Template(object):
|
|||||||
validator=instance_of(int))
|
validator=instance_of(int))
|
||||||
type = attr.ib(default='query')
|
type = attr.ib(default='query')
|
||||||
hide = attr.ib(default=SHOW)
|
hide = attr.ib(default=SHOW)
|
||||||
|
sort = attr.ib(default=SORT_ALPHA_ASC)
|
||||||
|
|
||||||
def to_json_data(self):
|
def to_json_data(self):
|
||||||
return {
|
return {
|
||||||
@ -655,7 +663,7 @@ class Template(object):
|
|||||||
'query': self.query,
|
'query': self.query,
|
||||||
'refresh': self.refresh,
|
'refresh': self.refresh,
|
||||||
'regex': self.regex,
|
'regex': self.regex,
|
||||||
'sort': 1,
|
'sort': self.sort,
|
||||||
'type': self.type,
|
'type': self.type,
|
||||||
'useTags': self.useTags,
|
'useTags': self.useTags,
|
||||||
'tagsQuery': self.tagsQuery,
|
'tagsQuery': self.tagsQuery,
|
||||||
|
Loading…
Reference in New Issue
Block a user