Skip to content

Commit

Permalink
[Dashboard] Unlink from library / Save to library actions do not work… (
Browse files Browse the repository at this point in the history
#150338)

… for maximized panels #139915

## Summary
As suggested in the issue comments
#139915 (comment),
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
  • Loading branch information
dmprieto authored Feb 7, 2023
1 parent 1d0b90b commit c71725e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c71725e

Please sign in to comment.