Fix: success message and scroll after adding panel from library (#220122)

Initially there was no success message for any type in the library and
there was no scrolling to added panel.

This change sets displaySuccessMessage to true for each plugin
registered in the Add from Library flyout.

It ensures that:
- users see a success toast after adding a panel,
- the newly added panel is automatically scrolled into view.

Closes: #188775

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Ola Pawlus 2025-05-09 19:24:49 +02:00 committed by GitHub
parent e528a30fa8
commit e7e8d2f13b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 71 additions and 44 deletions

View file

@ -16,12 +16,15 @@ const APP_ICON = 'logoKibana';
export const registerMyEmbeddableSavedObject = (embeddableSetup: EmbeddableSetup) =>
embeddableSetup.registerAddFromLibraryType({
onAdd: (container, savedObject) => {
container.addNewPanel({
panelType: MY_EMBEDDABLE_TYPE,
serializedState: {
rawState: savedObject.attributes,
container.addNewPanel(
{
panelType: MY_EMBEDDABLE_TYPE,
serializedState: {
rawState: savedObject.attributes,
},
},
});
true // shows a toast and scrolls to panel
);
},
savedObjectType: MY_SAVED_OBJECT_TYPE,
savedObjectName: 'Some saved object',