Facing error - Creation from saved object not supported by type dashboard

Hi,

I am trying to embed an existing dashboard in a custom plugin using its id as savedObjectID. I have referred the example plugin dashboard_embeddable_examples for the same.
But I am facing the error - Creation from saved object not supported by type dashboard.
I do not face this error when I try to embed an existing visualization.
Screenshot from 2022-03-22 14-31-58

Can anyone tell me why is this happening and how can I embed an existing dashboard.

Thanks,
Shreeya

@devon.thomson can we get some help here?

Thanks,
Bhavya

Hey @shreeya, unfortunately the dashboard embeddable doesn't support loading itself from a saved object quite yet! In the current setup, the dashboard application loads the saved object from the id, translates it into DashboardContainerInput then passes that input to the Dashboard Container Embeddable.

If you want to render a dashboard container in the current state, you'll have to recreate those steps. It isn't an easy thing to do, but let me know if that is something you'd like to attempt, and I might be able to help.

Fortunately, the Presentation team is also working on a project called Portable Dashboard Containers which will solve this problem. Once this project is finished, you will be able to pass in a saved object id and have the dashboard embeddable load correctly.

2 Likes

Hi @devon.thomson, thanks for the information. Would like to know how to recreate those steps. As a workaround for now, I have used the DashboardContainerInput. I pass all the visualization ids of the dashboard I want to create, in the panels object of the DashboardContainerInput. When I pass this input to the getDashboardContainerByValueRenderer() it renders the visualization. I also managed to refresh the visualization on filter update using subscriptions.
Would like to know if this is the right way, or is there other procedure for this.

Thanks,
Shreeya

Hey @Shreeya_Rajguru, that is the exact right way to go about this until we change the dashboard embeddable to work with a saved object. Nice work!

Thanks @devon.thomson , will continue with the same then.

I am also planning to add the save functionality for the changes done in the edit mode like drag and resizing the visualizations.
The save function in the core dashboard plugin is not a public export and hence, not able to reuse it. I have found the onDrag and onResize functions that can be added as a key in gridData, but didn't get any example or reference document to understand its implementation. Adding screenshot of the React dev tools, where you can find the keys onDrag, onDragStart, onResize, etc :
image
Can you help me with its implementation?

What would you suggest for save implementation? Any kind of references would be great.

Thanks,
Shreeya

Again, we're in the process of changing this to make it easier to do what you're doing, but in the meantime you can inspect the code in

src/plugins/dashboard/public/application/top_nav/dashboard_top_nav.tsx line 316

to see how the dashboard is saved.

The more functionality you want from the dashboard, the more code from the dashboard application you'll have to mirror, at least until we are finished the Portable Dashboards project.

Okay, sure. Thanks a lot @devon.thomson !!

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