-
Notifications
You must be signed in to change notification settings - Fork 38
Docs: Updates template variable support setup #2334
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
base: main
Are you sure you want to change the base?
Conversation
|
Hello! 👋 This repository uses Auto for releasing packages using PR labels. ✨ This PR can be merged. It will not be considered when calculating future versions of the npm packages and will not appear in the changelogs. |
andresmgot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content looks good to me 👍 (maybe wait for a proper docs review)
| instanceSettings: DataSourceInstanceSettings<MyDataSourceOptions>, | ||
| private readonly templateSrv: TemplateSrv = getTemplateSrv() | ||
| ) { | ||
| super(instanceSettings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this missing the intialization code?
this.templateSrv = templateSrv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also thought the normal way of doing this was calling getTemplateSrv() in place where you need it. does storing it in a class variable make a difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is automatically assigned since it is marked as private readonly and will get the instance when the datasource is constructed.
It is the same, just two different ways of doing the same thing. The reason why I changed it was because our internal datasources uses this pattern so I thought it would be smart to suggest to use the same in the docs. WDYT?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: