[Dashboard] Unlink from library / Save to library actions do not work… (#150338)

… 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
This commit is contained in:
Diana Marcela Prieto 2023-02-06 23:43:18 -05:00 committed by GitHub
parent 1d0b90bd12
commit c71725ee46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -97,6 +97,9 @@ export class AddToLibraryAction implements Action<AddToLibraryActionContext> {
const title = dashboardAddToLibraryActionStrings.getSuccessMessage(
embeddable.getTitle() ? `'${embeddable.getTitle()}'` : ''
);
if (dashboard.getExpandedPanelId() !== undefined) {
dashboard.setExpandedPanelId(undefined);
}
this.toastsService.addSuccess({
title,
'data-test-subj': 'addPanelToLibrarySuccess',

View file

@ -91,6 +91,9 @@ export class UnlinkFromLibraryAction implements Action<UnlinkFromLibraryActionCo
const title = dashboardUnlinkFromLibraryActionStrings.getSuccessMessage(
embeddable.getTitle() ? `'${embeddable.getTitle()}'` : ''
);
if (dashboard.getExpandedPanelId() !== undefined) {
dashboard.setExpandedPanelId(undefined);
}
this.toastsService.addSuccess({
title,