How to programmatically trigger dashboard refresh from a plugin


I am building a plugin which adds a custom panel action for visualizations.
I want to trigger dashboard refresh from with the code. I have access to data and dashboard plugin inside plugin , but I didn't find any function to trigger refresh manually.

Thank you.

@Sanskar_Panchal Hello!

From the ActionContext in your panel action, you should have access to the embeddable that triggered the action - if that embeddable is contained within a dashboard, its parent will be the Dashboard container! Once you have this, you should be able to call reload in order to refresh the dashboard. Putting this all together, you will get something like:

public async execute({ embeddable }: ActionContext) {
   const parent: DashboardContainer = embeddable.parent;

Hopefully that helps! :slight_smile: If you have any other questions, please don't hesitate to reach out.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.