Skip to content

Commit

Permalink
[Dashboard] Fixes Close drilldown flyouts when navigating to dashboar…
Browse files Browse the repository at this point in the history
…d landing page. (#136556)
  • Loading branch information
Kuznietsov authored Jul 20, 2022
1 parent 1055b7e commit 049da5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export class FlyoutCreateDrilldownAction implements Action<EmbeddableContext> {
closed$.next(true);
handle.close();
};
const closeFlyout = () => {
close();
};

const triggers = [
...ensureNestedTriggers(embeddable.supportedTriggers()),
CONTEXT_MENU_TRIGGER,
Expand All @@ -111,11 +115,11 @@ export class FlyoutCreateDrilldownAction implements Action<EmbeddableContext> {
);

// Close flyout on application change.
core.application.currentAppId$.pipe(takeUntil(closed$), skip(1), take(1)).subscribe(() => {
close();
});
core.application.currentAppId$
.pipe(takeUntil(closed$), skip(1), take(1))
.subscribe(closeFlyout);

// Close flyout on dashboard switch to "view" mode.
// Close flyout on dashboard switch to "view" mode or on embeddable destroy.
embeddable
.getInput$()
.pipe(
Expand All @@ -125,8 +129,6 @@ export class FlyoutCreateDrilldownAction implements Action<EmbeddableContext> {
filter((mode) => mode !== ViewMode.EDIT),
take(1)
)
.subscribe(() => {
close();
});
.subscribe({ next: closeFlyout, complete: closeFlyout });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export class FlyoutEditDrilldownAction implements Action<EmbeddableContext> {
closed$.next(true);
handle.close();
};
const closeFlyout = () => {
close();
};

const handle = core.overlays.openFlyout(
toMountPoint(
<plugins.uiActionsEnhanced.DrilldownManager
Expand All @@ -85,11 +89,11 @@ export class FlyoutEditDrilldownAction implements Action<EmbeddableContext> {
);

// Close flyout on application change.
core.application.currentAppId$.pipe(takeUntil(closed$), skip(1), take(1)).subscribe(() => {
close();
});
core.application.currentAppId$
.pipe(takeUntil(closed$), skip(1), take(1))
.subscribe(closeFlyout);

// Close flyout on dashboard switch to "view" mode.
// Close flyout on dashboard switch to "view" mode or on embeddable destroy.
embeddable
.getInput$()
.pipe(
Expand All @@ -99,8 +103,6 @@ export class FlyoutEditDrilldownAction implements Action<EmbeddableContext> {
filter((mode) => mode !== ViewMode.EDIT),
take(1)
)
.subscribe(() => {
close();
});
.subscribe({ next: closeFlyout, complete: closeFlyout });
}
}

0 comments on commit 049da5a

Please sign in to comment.