-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document the use of Templating #110
Comments
Thanks! This looks like a bug. I hope to try to fix it soon, but am stretched pretty thin. |
@jml do you have any thoughts as to where this bug might be? I looked through the code a bit and it's not really clear why this would work as expected. also as a workaround you can explicitly pass the template object. dashboard = G.Dashboard(
title="Summary",
templating=G.Templating(list=[
G.Template(
default="east-platform",
dataSource="prometheus",
name="data_source",
label="Data source",
query="prometheus"
)
])
) |
I think it's just missing values in one of the objects. Isolating it is made more complicated by the fact that the bug is only revealed when the generated JSON is loaded by Grafana itself. I won't have time to get into this for a little while. |
Bump - may take a look at fixing this myself. |
On the Grafana side, the defaults appear to be here: https://github.com/grafana/grafana/blob/85dad73e9de458ed8610ce7acdb326ff72808970/public/app/features/templating/query_variable.ts#L47-L68
|
I'm still checking this out - but I think I've found the problem, in my experimentation, it looks like 'selected' has to be set to either True or False to get things working chrisfleming@0589cb5 I've a few more checks but should have a pull request next week. |
Thanks Chis, look forward to the PR. |
Could templating still be improved with some better docs? Or do we think this issue can be closed? |
What you expected to happen?
I attempted to use add templating to a dashboard, it is not documented how to use it so I provided these parameters:
https://github.com/aknuds1/grafanalib/blob/master/grafanalib/core.py#L431-L439
What happened?
Js error in grafana when trying to import the resulting json dashboard. After some effort I determined that the js error is caued by the absence of some of these values for each template:
https://github.com/aknuds1/grafanalib/blob/master/grafanalib/core.py#L456-L470
I'm not very familiar with python but that bit of code looks like it should be used as defaults? In any case, when I include those keys/values for each templated variable in my dashboard.py, the resulting json generated does work!
How to reproduce it?
Create any dashboard that uses the templating, i.e.:
Is this a bug with how templating gets rendered? If not, can you add the proper incantation to use templating in the example dashboard.py?
The text was updated successfully, but these errors were encountered: