I’m new to Grafana plugin development (and angular) and I’m having trouble with my app type plugin.
I would want to call a function of my custom data source plugin from my app plugin page (not panel). I’ve found the data source by going through
but that doesn’t return the actual object to call. How can I access the instance of the datasource controller to call the controller function?
Hi, I am totally new to grafana and I am trying the same thing i.e. to connect to my backend api through grafana so that I can display data my data from mysql db into a table format on a page not on a panel. As I am new to grafana, I didn’t understand the code you have posted above. Can you please elaborate on it more. Also I am familiar with recent versions of angular e.g. angular 4 and 5, where it is quite easy to just call backend api using httpmodule. But I cannot see that is the case with grafana. I cannot call backend api directly as I face CORS issue then. In angular 2 or angular 4 I know how to go through the proxy and solve this issue, but is there any similar way for grafana too. I would appreciate your help as I am stuck here for quite a while now. For some more background let me tell you that I am using my own grafana plugin which has couple of pages included in it. Now I want to display a table in one of them, but for that I want to connect to my backend. So how can I do that? How in grafana do we do that? My backend server is running on 8080 port while I am running grafana on 8090. Thanks
To not get cors errors, you should use server mode to go through the Grafana proxy. That is set on the config page for your mysql data source. Then you make calls to it like this (the url variable is taken from the config page - instanceSettings.url):
@daniellee thank you a lot, your example with api/datasources/ helped me to get URL and username. I just wondering if there is a way to get all connection info. I’m developing a panel for ML. So when user creates a ML model panel sends a request to Loud ML server with info about source data to train model on.