Skip to content
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

Example: how to support template variabels in panels #160

Open
mckn opened this issue May 11, 2023 · 2 comments
Open

Example: how to support template variabels in panels #160

mckn opened this issue May 11, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@mckn
Copy link
Contributor

mckn commented May 11, 2023

When building a panel you should use the replaceVariables function instead of using the templateSrv directly. The main reason for this is to get proper support for template variabels when repeating the panel based on a template variable.

We should add an example show casing this along side of documentation highlighting what additional scenarios the panel will support by using this function.

For more information see the following PR and issue.

grafana/grafana-iot-twinmaker-app#188

@sympatheticmoose sympatheticmoose added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 1, 2023
@sympatheticmoose
Copy link
Contributor

@mckn iirc 2 of our examples use replaceVariables, 1 uses templateSrv. Is this just to update the one which uses templateSrv or are there other changes we should make.

In terms of documentation, again it would be good to expand upon where you're thinking for this and where a user would have first thought to use templateSrv as that user journey is unclear to me at this point

@sympatheticmoose sympatheticmoose moved this from 📬 Uncategorized to 💡 Ideation in Plugins Platform / Grafana Community Jun 2, 2023
@mckn
Copy link
Contributor Author

mckn commented Jun 5, 2023

@mckn iirc 2 of our examples use replaceVariables, 1 uses templateSrv. Is this just to update the one which uses templateSrv or are there other changes we should make.

In terms of documentation, again it would be good to expand upon where you're thinking for this and where a user would have first thought to use templateSrv as that user journey is unclear to me at this point

Yupp, agree about the docs! The example using templateSrv is a data source and in that context it should be ok to use the templateSrv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
Status: 💡 Ideation
Development

No branches or pull requests

2 participants