-
Notifications
You must be signed in to change notification settings - Fork 26
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
Docs: Add page about fetching data from frontend code using the data proxy #889
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. |
docusaurus/docs/create-a-plugin/extend-a-plugin/fetch-data-from-frontend.md
Outdated
Show resolved
Hide resolved
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.
Great. Some comments to begin with
|
||
To fetch data from your data source an app plugins you have two options: | ||
|
||
- Use the browser [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) as you would do for any other javascript project |
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.
Wouldn't you still use fetch even if hitting the Grafana API? Did you intend explaining browser connects directly to service vs grafana api?
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.
No. When you use the data proxy you use fetch from getBackendSrv. This fetch is the window,fetch from the browser. Though technically you could also simply use the browser fetch but it is best to use the backendSrcv one
docusaurus/docs/create-a-plugin/extend-a-plugin/fetch-data-from-frontend.md
Outdated
Show resolved
Hide resolved
docusaurus/docs/create-a-plugin/extend-a-plugin/fetch-data-from-frontend.md
Outdated
Show resolved
Hide resolved
docusaurus/docs/create-a-plugin/extend-a-plugin/fetch-data-from-frontend.md
Outdated
Show resolved
Hide resolved
docusaurus/docs/create-a-plugin/extend-a-plugin/fetch-data-from-frontend.md
Outdated
Show resolved
Hide resolved
docusaurus/docs/create-a-plugin/extend-a-plugin/fetch-data-from-frontend.md
Outdated
Show resolved
Hide resolved
I have edited the PR for style, consistency, structure, and clarity. See commit at 48015df. Please take a look and let me know if you have any questions about any of my suggestions. |
Thank you for all the changes and style fixes they look good |
Thanks for working on this @academo - afraid I won't be able to review this week. Happy for it to be merged assuming Joe and Marcus we're ok with the content 👍 |
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.
LGTM.
I might have a few more suggestions :) |
What this PR does / why we need it:
Adds documentation about how to use the data proxy.
This documentation teaches and follow similar concepts to https://grafana.com/developers/plugin-tools/create-a-plugin/extend-a-plugin/add-authentication-for-data-source-plugins#authenticate-using-the-data-source-proxy but it focuses in general usage for data fetching and not only on authentication. The add authentication page is linked in the sections where authentication is mentioned
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: