[Dashboard] Change Inspector on dashboard to use push flyout (#207750)

## Summary

This PR changes the inspector flyout to be a push flyout and highlights
the panel which is inspected.
![Screenshot 2025-01-22 at 13 19
21](https://github.com/user-attachments/assets/b8668d21-a323-41f0-9128-64c511e26347)
Closes: #148993
This commit is contained in:
Krzysztof Kowalczyk 2025-01-27 21:12:30 +01:00 committed by GitHub
parent d00d867382
commit 3e5505fad7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 1 deletions

View file

@ -15,6 +15,7 @@ import {
getTitle,
PublishesTitle,
HasParentApi,
apiHasUniqueId,
} from '@kbn/presentation-publishing';
import { Action, IncompatibleActionError } from '@kbn/ui-actions-plugin/public';
import { ACTION_INSPECT_PANEL } from './constants';
@ -62,6 +63,7 @@ export class InspectPanelAction implements Action<EmbeddableApiContext> {
});
const session = inspector.open(adapters, {
title: panelTitle,
flyoutType: 'push',
options: {
fileName: panelTitle,
},
@ -71,6 +73,12 @@ export class InspectPanelAction implements Action<EmbeddableApiContext> {
});
// send the overlay ref to the parent API if it is capable of tracking overlays
if (tracksOverlays(embeddable.parentApi)) embeddable.parentApi?.openOverlay(session);
if (tracksOverlays(embeddable.parentApi)) {
const openOverlayOptions = apiHasUniqueId(embeddable)
? { focusedPanelId: embeddable.uuid }
: undefined;
embeddable.parentApi?.openOverlay(session, openOverlayOptions);
}
}
}

View file

@ -115,6 +115,7 @@ export class InspectorPublicPlugin implements Plugin<Setup, Start> {
{
'data-test-subj': 'inspectorPanel',
closeButtonProps: { 'aria-label': closeButtonLabel },
type: options.flyoutType,
}
);
};

View file

@ -8,6 +8,7 @@
*/
import { OverlayRef } from '@kbn/core/public';
import { EuiFlyoutProps } from '@elastic/eui';
import { Adapters } from '../common';
/**
@ -60,6 +61,7 @@ export interface InspectorViewDescription {
export interface InspectorOptions {
title?: string;
options?: unknown;
flyoutType?: EuiFlyoutProps['type'];
}
export type InspectorSession = OverlayRef;