Skip to content

Commit

Permalink
Merge pull request #123 from jakubplichta/improvements
Browse files Browse the repository at this point in the history
Add support for allFormat and allValue in templating
  • Loading branch information
jakubplichta authored Apr 15, 2018
2 parents d23081b + 3bc21cb commit 99c3725
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion grafana_dashboards/components/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def gen_json_from_data(self, data, context):
template_json['options'] = [{'text': option, 'value': option} for option in
(query_config['options'])]

for key in ['regex', 'multi', 'includeAll', 'hide']:
for key in ['regex', 'multi', 'includeAll', 'hide', 'allFormat', 'allValue']:
if key in query_config:
template_json[key] = query_config[key]

Expand Down
4 changes: 4 additions & 0 deletions samples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ elastic-search:
host: https://this-is-my-domain.com
password: my_password
username: my_username
grafana:
host: http://localhost:8380
username: admin
password: admin
file:
output_folder: ./out
context:
Expand Down
21 changes: 21 additions & 0 deletions samples/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- '{component}-connections'
- '{component}-{env}-{nodes}-system-details'
- 'some dashboard'
- docker-statsd

- default-dashboard: &default-dashboard
time_options: [1h, 6h, 12h, 24h, 2d, 7d, 14d, 30d]
Expand Down Expand Up @@ -215,3 +216,23 @@
yaxes:
- yaxis:
format: bytes

- name: docker-statsd
dashboard:
title: Docker statsd
<<: *default-dashboard
templates:
- query:
query: 'stats.statsd.graphiteStats.$metric'
metric:
current: calculationtime
includeAll: true
multi: true
current: All
rows:
- row:
panels:
- graph:
title: dynamic
target: 'stats.statsd.graphiteStats.$metric'
repeat: metric
2 changes: 2 additions & 0 deletions tests/grafana_dashboards/components/query/full.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"type": "query",
"multi": true,
"includeAll": true,
"allFormat": "glob",
"allValue": "test*",
"hide": 2
},
{
Expand Down
2 changes: 2 additions & 0 deletions tests/grafana_dashboards/components/query/full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ query:
regex: '/opt\^(value)\^\w+/'
var2:
includeAll: true
allFormat: glob
allValue: test*
multi: true
hide: 2

0 comments on commit 99c3725

Please sign in to comment.