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

Correct alias to displayName #21

Merged
merged 2 commits into from
Jun 19, 2020
Merged

Correct alias to displayName #21

merged 2 commits into from
Jun 19, 2020

Conversation

retrodaredevil
Copy link
Contributor

I made a few changes so that running 'yarn dev' now works for me and I've confirmed this works on Grafana 7. Before these changes, running 'yarn dev' failed.

Personally, I couldn't get the current grafana-7.0 branch to work on my Grafana 7.0.3 install, so I made these changes.

Also, is there a reason that all the "devDependencies" in package.json all have "next"? Shouldn't those be replaced with 7.0.3?

Running 'yarn dev' is still how you're supposed to compile this, right?

@@ -73,7 +76,7 @@ export class DataSource extends DataSourceApi<MyQuery, MyDataSourceOptions> {
payload = payload.replace(/\$timeFrom/g, range.from.valueOf().toString());
payload = payload.replace(/\$timeTo/g, range.to.valueOf().toString());
}
payload = getTemplateSrv().replace(payload, scopedVars);
payload = this.templateSrv.replace(payload, scopedVars);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTemplateSrv() is the new, documented way to access the current templateSrv for variable interpolation... https://grafana.com/docs/grafana/latest/developers/plugins/add-support-for-variables/#interpolate-variables-in-data-source-plugins

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so to complete that thought, if you encountered an error trying to import that from @grafana/runtime you probably don't have the latest version installed.

@retzkek
Copy link
Contributor

retzkek commented Jun 9, 2020

My demo site is running Grafana 7.0.3 and the v1.1.1-grafana7 release, which is the last commit on the grafana-7.0 branch.

Also, is there a reason that all the "devDependencies" in package.json all have "next"? Shouldn't those be replaced with 7.0.3?

One could certainly make that argument, but I'm lazy. :)

Running 'yarn dev' is still how you're supposed to compile this, right?

Yes, there's still some issue with release builds, that I haven't had more time to dig into.

@retrodaredevil
Copy link
Contributor Author

Oh, I realized I didn't have the runtime package installed, so a simple yarn install made that work. I updated the versions to use 7.0.3.

So now the main thing that this changes is the title to displayName, which I believe must be changed for this to work correctly on Grafana 7.0.

Also, if you do end up merging this, I recommend a squash merge, since we don't need both these commits in the history.

@michaelneale
Copy link
Contributor

michaelneale commented Jun 19, 2020

nice @retrodaredevil - I was able to use this on 7.0.3 successfully.
@retzkek I was also using the grafana-7 release and the alias on fields doesn't work. The fix in this PR does work.

What I can't quite work out, is that if you run yarn dev then it works just fine (as does running it directly in plugin dir). However, yarn build that minifies the js does not work. I confirmed this is a problem with the current release as well (not just this PR) @retzkek for some reason minified won't work. Something is up with that..

In any case, very cool! title did change to displayname, but the dependency need to be bumped like it is here to show that.

@retzkek
Copy link
Contributor

retzkek commented Jun 19, 2020

I did note that the new API docs list displayName but I didn't find anything detailing how it's used, and haven't had a chance to test. Thanks for the confirmation @michaelneale! I'll go ahead and merge this and cut a new release.

What I can't quite work out, is that if you run yarn dev then it works just fine (as does running it directly in plugin dir). However, yarn build that minifies the js does not work. I confirmed this is a problem with the current release as well (not just this PR) @retzkek for some reason minified won't work. Something is up with that..

Yep I have #17 open for that. Seems nobody else has run into that issue, so it must be something simple. Any help would be appreciated!

@retzkek retzkek changed the title Changes that work on Grafana 7 Correct alias to displayName Jun 19, 2020
@retzkek retzkek merged commit 06cc701 into fifemon:grafana-7.0 Jun 19, 2020
@michaelneale
Copy link
Contributor

thanks @retzkek will take a look at the prod build issue too when I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants