From c71725ee46587671b51b9c3db384089e06f0b01e Mon Sep 17 00:00:00 2001 From: Diana Marcela Prieto Date: Mon, 6 Feb 2023 23:43:18 -0500 Subject: [PATCH] =?UTF-8?q?[Dashboard]=20Unlink=20from=20library=20/=20Sav?= =?UTF-8?q?e=20to=20library=20actions=20do=20not=20work=E2=80=A6=20(#15033?= =?UTF-8?q?8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … for maximized panels #139915 ## Summary As suggested in the issue comments https://github.com/elastic/kibana/issues/139915#issuecomment-1234408466, in this PR I added some logic after linking/unlinking to the library to set the expanded visualization id to undefined. After testing this changes in a local development environment, the visualization is no longer disappearing from the dashboard after linking/unlinking to the library --- .../public/dashboard_actions/add_to_library_action.tsx | 3 +++ .../public/dashboard_actions/unlink_from_library_action.tsx | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/plugins/dashboard/public/dashboard_actions/add_to_library_action.tsx b/src/plugins/dashboard/public/dashboard_actions/add_to_library_action.tsx index 165f77b2c177e..1431c7fc61ed2 100644 --- a/src/plugins/dashboard/public/dashboard_actions/add_to_library_action.tsx +++ b/src/plugins/dashboard/public/dashboard_actions/add_to_library_action.tsx @@ -97,6 +97,9 @@ export class AddToLibraryAction implements Action { const title = dashboardAddToLibraryActionStrings.getSuccessMessage( embeddable.getTitle() ? `'${embeddable.getTitle()}'` : '' ); + if (dashboard.getExpandedPanelId() !== undefined) { + dashboard.setExpandedPanelId(undefined); + } this.toastsService.addSuccess({ title, 'data-test-subj': 'addPanelToLibrarySuccess', diff --git a/src/plugins/dashboard/public/dashboard_actions/unlink_from_library_action.tsx b/src/plugins/dashboard/public/dashboard_actions/unlink_from_library_action.tsx index 1dafc89972a3c..6be0001c62b59 100644 --- a/src/plugins/dashboard/public/dashboard_actions/unlink_from_library_action.tsx +++ b/src/plugins/dashboard/public/dashboard_actions/unlink_from_library_action.tsx @@ -91,6 +91,9 @@ export class UnlinkFromLibraryAction implements Action