grafana-client icon indicating copy to clipboard operation
grafana-client copied to clipboard

Need an API to export the dashboard that has enabled `autoMigrateOldPanels`

Open mohan-s-gopal opened this issue 9 months ago • 4 comments
trafficstars

Describe the bug Using Grafana v11.3.0 with feature flags enabled to auto-migrate the old Angular plugin to React autoMigrateOldPanels: true. However, when I try to export the dashboard using the tool, it always exports the old Angular version instead of the migrated React version that is stored in the database.

To Reproduce Steps to reproduce the behavior:

  1. Deploy Grafana v11.3.0 and enable autoMigrateOldPanels: true.
  2. Export the dashboard using the tool.
  3. The export doesn't include the migrated React dashboard but instead provides the old Angular version. However, the JSON model contains the React plugin changes, and the Share option displays the React-based dashboard.

Expected behavior Looking for a way to export the dashboard that was automatically migrated using the API.

Versions

  • Grafana: [ 11.3.0]
  • grafana-client: [ 4.0]
  • Authentication: [Token]

mohan-s-gopal avatar Feb 04 '25 10:02 mohan-s-gopal

Dear Mohan,

thanks a stack for writing in. Your request sounds reasonable. Are you able to provide a patch, or relay relevant pointers to Grafana HTTP API docs where corresponding information can be obtained how to retrieve the React version of dashboards?

In my humble naive world, I would not have expected that the JSON representation of dashboards change due to the migration from Angular to React. In this spirit, I am likewise happy to learn about it, and I am looking forward to provide optimal support through grafana-client.

With kind regards, Andreas.

amotl avatar Feb 08 '25 13:02 amotl

There is some Golang code here, which is about detecting Angular vs. React, but I can't make any sense of it, in terms of figuring out how a dashboard representation differs between both variants, and/or how to retrieve them properly.

https://github.com/grafana/detect-angular-dashboards/blob/main/detector/detector.go https://github.com/grafana/detect-angular-dashboards/blob/main/api/grafana/grafana.go#L120-L134 https://github.com/grafana/detect-angular-dashboards/blob/main/output/output.go

amotl avatar Feb 10 '25 21:02 amotl

Maybe it has been a bug with Grafana ~11.3, and has been fixed already, as Grafana 11.5.1 is available already? May we ask you to verify if the problem still prevails, @mohan-s-gopal?

amotl avatar Feb 10 '25 21:02 amotl

Thanks for the update! I'll check if the issue persists in Grafana 11.5.1 and get back to you.

mohan-s-gopal avatar Feb 18 '25 16:02 mohan-s-gopal

Gentle ping ;].

amotl avatar Mar 04 '25 12:03 amotl

@amotl Thanks, it works!

mohan-s-gopal avatar Jun 24 '25 15:06 mohan-s-gopal

Excellent, thanks for your response. Because we didn't do anything, we figure the problem got fixed with upstream Grafana. Let's close the issue.

amotl avatar Jun 24 '25 17:06 amotl