Skip to content

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

Merged
olapawlus merged 15 commits intoelastic:mainfrom
olapawlus:after-panel-add-action
May 9, 2025
Merged

Fix: success message and scroll after adding panel from library#220122
olapawlus merged 15 commits intoelastic:mainfrom
olapawlus:after-panel-add-action

Conversation

@olapawlus
Copy link
Member

@olapawlus olapawlus commented May 5, 2025

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

@olapawlus olapawlus self-assigned this May 5, 2025
@olapawlus olapawlus added Feature:Dashboard Dashboard related features Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// loe:medium Medium Level of Effort impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. labels May 5, 2025
Copy link
Contributor

@nickpeihl nickpeihl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a way to make this simpler. The container prop has the type CanAddNewPanel. This type exposes an optional displaySuccessMessage boolean.

Looking at the original issue, I see

If you add a saved object of type Links or maps using Add from Library on dashboards. Kibana doesn't display action successful message. But it does for visualizations, lens and saved searches.

As Ola pointed out to me offline, Lens and visualizations no longer display the message.

I believe this is an issue with how the saved object types for Maps and Links are registered. All plugins such as Lens, Maps, Links that expect to appear in the Add from Library flyout must register an onAdd function with the registerAddFromLibrary function that is exposed to each plugin in their public/plugin.ts module. Those onAdd functions call container.addNewPanel, but I think they are missing the displaySuccessMessage option.

Regarding scrolling to the newly added panel, our dashboardsApi has a scrollToPanel method. But I think we would need to provide a new typeguard in panels_management similar to CanExpandPanels and apiCanExpandPanels. This is a bit more complex. If we want to fix in this PR, maybe we should chat on zoom with you, me, and @ThomThomson?

@ThomThomson
Copy link
Contributor

ThomThomson commented May 5, 2025

Happy to jump on a call to discuss any time! It might be best to do the scroll to panel inside the add from library logic so we can centralize it.

@olapawlus
Copy link
Member Author

@nickpeihl @ThomThomson Thank you for the insights! I'd be happy to join the zoom discussion today.

@olapawlus olapawlus marked this pull request as ready for review May 6, 2025 15:39
@olapawlus olapawlus requested review from a team as code owners May 6, 2025 15:39
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@botelastic botelastic bot added the Feature:Embedding Embedding content via iFrame label May 6, 2025
@olapawlus olapawlus enabled auto-merge (squash) May 6, 2025 15:39
@olapawlus olapawlus added bug Fixes for quality problems that affect the customer experience release_note:fix backport:version Backport to applied version labels regression loe:small Small Level of Effort v9.1.0 v8.19.0 v8.18.1 v9.0.1 and removed loe:medium Medium Level of Effort labels May 6, 2025
@@ -0,0 +1,8 @@
/*
Copy link
Member Author

@olapawlus olapawlus May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file valid? I just pulled it from the remote branch before pushing my latest changes, but I see that this file has been deleted in the serialized state PR @nickpeihl @nreese https://github.com/elastic/kibana/pull/215947/files#diff-12a0c8cb522398dd4d5ef0d1f87638d069f51ac76a7c971e714ae0f4ad9fb487

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_on_add_search_embeddable.ts no longe exist on main.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup we can go ahead and delete it from this branch too.

Copy link
Contributor

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vis code changes LGTM

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-only review, Data Discover change LGTM 👍 Let's just make sure to delete get_on_add_search_embeddable.ts before merging.

@@ -0,0 +1,8 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup we can go ahead and delete it from this branch too.

@olapawlus olapawlus merged commit e7e8d2f into elastic:main May 9, 2025
10 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.18, 8.19, 9.0

https://github.com/elastic/kibana/actions/runs/14934312527

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
discover 21.4KB 21.4KB +3.0B
lens 58.9KB 58.9KB +3.0B
links 8.0KB 8.0KB +3.0B
maps 40.7KB 40.7KB +3.0B
visualizations 35.3KB 35.3KB +3.0B
total +15.0B

History

cc @olapawlus

kibanamachine added a commit to kibanamachine/kibana that referenced this pull request May 9, 2025
…tic#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: elastic#188775

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit e7e8d2f)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.18 Backport failed because of merge conflicts
8.19
9.0 Backport failed because of merge conflicts

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 220122

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 9, 2025
#220122) (#220703)

# Backport

This will backport the following commits from `main` to `8.19`:
- [Fix: success message and scroll after adding panel from library
(#220122)](#220122)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Ola
Pawlus","email":"98127445+olapawlus@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-05-09T17:24:49Z","message":"Fix:
success message and scroll after adding panel from library
(#220122)\n\nInitially there was no success message for any type in the
library and\nthere was no scrolling to added panel.\n\nThis change sets
displaySuccessMessage to true for each plugin\nregistered in the Add
from Library flyout.\n\nIt ensures that:\n- users see a success toast
after adding a panel,\n- the newly added panel is automatically scrolled
into view.\n\nCloses: #188775\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e7e8d2f13b44ae78b33ada4a3904b17066c6fd37","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Feature:Dashboard","Feature:Embedding","regression","release_note:fix","Team:Presentation","loe:small","impact:high","backport:version","v9.1.0","v8.19.0","v8.18.2","v9.0.2"],"title":"Fix:
success message and scroll after adding panel from
library","number":220122,"url":"https://github.com/elastic/kibana/pull/220122","mergeCommit":{"message":"Fix:
success message and scroll after adding panel from library
(#220122)\n\nInitially there was no success message for any type in the
library and\nthere was no scrolling to added panel.\n\nThis change sets
displaySuccessMessage to true for each plugin\nregistered in the Add
from Library flyout.\n\nIt ensures that:\n- users see a success toast
after adding a panel,\n- the newly added panel is automatically scrolled
into view.\n\nCloses: #188775\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e7e8d2f13b44ae78b33ada4a3904b17066c6fd37"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/220122","number":220122,"mergeCommit":{"message":"Fix:
success message and scroll after adding panel from library
(#220122)\n\nInitially there was no success message for any type in the
library and\nthere was no scrolling to added panel.\n\nThis change sets
displaySuccessMessage to true for each plugin\nregistered in the Add
from Library flyout.\n\nIt ensures that:\n- users see a success toast
after adding a panel,\n- the newly added panel is automatically scrolled
into view.\n\nCloses: #188775\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e7e8d2f13b44ae78b33ada4a3904b17066c6fd37"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Ola Pawlus <98127445+olapawlus@users.noreply.github.com>
@olapawlus
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
9.0
8.18

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

olapawlus added a commit that referenced this pull request May 14, 2025
…#220122) (#220776)

# Backport

This will backport the following commits from `main` to `9.0`:
- [Fix: success message and scroll after adding panel from library
(#220122)](#220122)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Ola
Pawlus","email":"98127445+olapawlus@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-05-09T17:24:49Z","message":"Fix:
success message and scroll after adding panel from library
(#220122)\n\nInitially there was no success message for any type in the
library and\nthere was no scrolling to added panel.\n\nThis change sets
displaySuccessMessage to true for each plugin\nregistered in the Add
from Library flyout.\n\nIt ensures that:\n- users see a success toast
after adding a panel,\n- the newly added panel is automatically scrolled
into view.\n\nCloses: #188775\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e7e8d2f13b44ae78b33ada4a3904b17066c6fd37","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Feature:Dashboard","Feature:Embedding","regression","release_note:fix","Team:Presentation","loe:small","impact:high","backport:version","v9.1.0","v8.19.0","v8.18.2","v9.0.2"],"title":"Fix:
success message and scroll after adding panel from
library","number":220122,"url":"https://github.com/elastic/kibana/pull/220122","mergeCommit":{"message":"Fix:
success message and scroll after adding panel from library
(#220122)\n\nInitially there was no success message for any type in the
library and\nthere was no scrolling to added panel.\n\nThis change sets
displaySuccessMessage to true for each plugin\nregistered in the Add
from Library flyout.\n\nIt ensures that:\n- users see a success toast
after adding a panel,\n- the newly added panel is automatically scrolled
into view.\n\nCloses: #188775\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e7e8d2f13b44ae78b33ada4a3904b17066c6fd37"}},"sourceBranch":"main","suggestedTargetBranches":["8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/220122","number":220122,"mergeCommit":{"message":"Fix:
success message and scroll after adding panel from library
(#220122)\n\nInitially there was no success message for any type in the
library and\nthere was no scrolling to added panel.\n\nThis change sets
displaySuccessMessage to true for each plugin\nregistered in the Add
from Library flyout.\n\nIt ensures that:\n- users see a success toast
after adding a panel,\n- the newly added panel is automatically scrolled
into view.\n\nCloses: #188775\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e7e8d2f13b44ae78b33ada4a3904b17066c6fd37"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/220703","number":220703,"state":"MERGED","mergeCommit":{"sha":"7501611e3277d378ea00e1731b39be0ebeb7769b","message":"[8.19]
Fix: success message and scroll after adding panel from library
(#220122) (#220703)\n\n# Backport\n\nThis will backport the following
commits from `main` to `8.19`:\n- [Fix: success message and scroll after
adding panel from
library\n(#220122)](https://github.com/elastic/kibana/pull/220122)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Ola Pawlus
<98127445+olapawlus@users.noreply.github.com>"}},{"branch":"8.18","label":"v8.18.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
olapawlus added a commit that referenced this pull request May 14, 2025
#220122) (#220777)

# Backport

This will backport the following commits from `main` to `8.18`:
- [Fix: success message and scroll after adding panel from library
(#220122)](#220122)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Ola
Pawlus","email":"98127445+olapawlus@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-05-09T17:24:49Z","message":"Fix:
success message and scroll after adding panel from library
(#220122)\n\nInitially there was no success message for any type in the
library and\nthere was no scrolling to added panel.\n\nThis change sets
displaySuccessMessage to true for each plugin\nregistered in the Add
from Library flyout.\n\nIt ensures that:\n- users see a success toast
after adding a panel,\n- the newly added panel is automatically scrolled
into view.\n\nCloses: #188775\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e7e8d2f13b44ae78b33ada4a3904b17066c6fd37","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Feature:Dashboard","Feature:Embedding","regression","release_note:fix","Team:Presentation","loe:small","impact:high","backport:version","v9.1.0","v8.19.0","v8.18.2","v9.0.2"],"title":"Fix:
success message and scroll after adding panel from
library","number":220122,"url":"https://github.com/elastic/kibana/pull/220122","mergeCommit":{"message":"Fix:
success message and scroll after adding panel from library
(#220122)\n\nInitially there was no success message for any type in the
library and\nthere was no scrolling to added panel.\n\nThis change sets
displaySuccessMessage to true for each plugin\nregistered in the Add
from Library flyout.\n\nIt ensures that:\n- users see a success toast
after adding a panel,\n- the newly added panel is automatically scrolled
into view.\n\nCloses: #188775\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e7e8d2f13b44ae78b33ada4a3904b17066c6fd37"}},"sourceBranch":"main","suggestedTargetBranches":["8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/220122","number":220122,"mergeCommit":{"message":"Fix:
success message and scroll after adding panel from library
(#220122)\n\nInitially there was no success message for any type in the
library and\nthere was no scrolling to added panel.\n\nThis change sets
displaySuccessMessage to true for each plugin\nregistered in the Add
from Library flyout.\n\nIt ensures that:\n- users see a success toast
after adding a panel,\n- the newly added panel is automatically scrolled
into view.\n\nCloses: #188775\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e7e8d2f13b44ae78b33ada4a3904b17066c6fd37"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/220703","number":220703,"state":"MERGED","mergeCommit":{"sha":"7501611e3277d378ea00e1731b39be0ebeb7769b","message":"[8.19]
Fix: success message and scroll after adding panel from library
(#220122) (#220703)\n\n# Backport\n\nThis will backport the following
commits from `main` to `8.19`:\n- [Fix: success message and scroll after
adding panel from
library\n(#220122)](https://github.com/elastic/kibana/pull/220122)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Ola Pawlus
<98127445+olapawlus@users.noreply.github.com>"}},{"branch":"8.18","label":"v8.18.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
…tic#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: elastic#188775

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
qn895 pushed a commit to qn895/kibana that referenced this pull request Jun 3, 2025
…tic#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: elastic#188775

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels bug Fixes for quality problems that affect the customer experience Feature:Dashboard Dashboard related features Feature:Embedding Embedding content via iFrame impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:small Small Level of Effort regression release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// v8.18.2 v8.19.0 v9.0.2 v9.1.0

8 participants