I’m working on a datasource plugin and to get the data I have an external API who returns me JSON. So to display several data, I’m forced to make different requests to my API.
So to do different requests for each panel, I do the request “/api/dashboards/uid/” + My dashboard UID. And this request returns me in order the list of panels and i take them 1 by 1 to display the data. But when I move a panel this request becomes obsolete because the dashboard that I get is not the new dashboard. So the data displayed aren’t good.
So actually I’m trying to remake the save request for the dashboard automatically but this is gonna be long. Do you have a solution for saving the dashboard or maybe another way to display several data or do you know someone who can help me ?
Update : If I can get the JSON Model of a dashboard I can make what I want.
Any news about this subject.
I am not sure what is that you are trying to achieve. perhaps you can explain what kind of datasource you are trying to build rather than the problem you are facing with the way you want to build it.
this request returns me in order the list of panels and i take them 1 by 1 to display the data
This is not the way datasources work.
Your datasource and panel are separate entities and should not know about each other and they both also don’t need to know anything about the dashboard beyond the dashboard variables. The way they correlate to each other is via the props each one get either via props in a react component or data in the query send to the datasource.
Put in simple terms, you should rely only and only in the props and parameters that you get in your datasource and panel and not in reading the state of a dashboard or panel or any other entity via the browser address, the DOM, or any other means.
A datasource should accept a “query” (which simply put are the parameters to get data) which usually also has the time range of the current dashboard.