From 9baed7cd5cd352ed45f753c263a5a43a799b8a72 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Tue, 10 Dec 2024 16:39:15 +0100 Subject: [PATCH] [Lens] Fix missing embeddable panel titles (#203355) ## Summary When using the new Custom Lens embeddable component, the titles are hidden by default due to to a regression introduced in https://github.com/elastic/kibana/pull/186642. This PR should fix the correct title handling of the header visibility by hiding or showing the wrapping Panel title depending on the `hidePanelTitles` props of the `LensRenderer` component fix https://github.com/elastic/kibana/issues/203354 (cherry picked from commit 6e57a23d18d949e7ac3118c1f27550e2ba9eedf8) --- .../renderer/lens_custom_renderer_component.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/lens/public/react_embeddable/renderer/lens_custom_renderer_component.tsx b/x-pack/plugins/lens/public/react_embeddable/renderer/lens_custom_renderer_component.tsx index 5bc55d43c3212..eab54a7fa9f9d 100644 --- a/x-pack/plugins/lens/public/react_embeddable/renderer/lens_custom_renderer_component.tsx +++ b/x-pack/plugins/lens/public/react_embeddable/renderer/lens_custom_renderer_component.tsx @@ -59,6 +59,7 @@ export function LensRenderer({ filters, timeRange, disabledActions, + hidePanelTitles, ...props }: LensRendererProps) { // Use the settings interface to store panel settings @@ -71,6 +72,7 @@ export function LensRenderer({ }, []); const disabledActionIds$ = useObservableVariable(disabledActions); const viewMode$ = useObservableVariable(viewMode); + const hidePanelTitles$ = useObservableVariable(hidePanelTitles); // Lens API will be set once, but when set trigger a reflow to adopt the latest attributes const [lensApi, setLensApi] = useState(undefined); @@ -112,7 +114,6 @@ export function LensRenderer({ const panelProps: PanelProps = useMemo(() => { return { hideInspector: !showInspector, - hideHeader: showPanelChrome, showNotifications: false, showShadow: false, showBadges: false, @@ -124,7 +125,7 @@ export function LensRenderer({ return (extraActions ?? []).concat(actions || []); }, }; - }, [showInspector, showPanelChrome, withDefaultActions, extraActions, lensApi]); + }, [showInspector, withDefaultActions, extraActions, lensApi]); return ( @@ -147,6 +148,7 @@ export function LensRenderer({ ...initialStateRef.current, attributes: props.attributes, }), + hidePanelTitle: hidePanelTitles$, })} onApiAvailable={setLensApi} hidePanelChrome={!showPanelChrome}