Skip to content

Commit

Permalink
[8.x] [Lens] Fix missing embeddable panel titles (#203355) (#203621)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Lens] Fix missing embeddable panel titles
(#203355)](#203355)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marco
Vettorello","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-10T15:39:15Z","message":"[Lens]
Fix missing embeddable panel titles (#203355)\n\n## Summary\r\n\r\nWhen
using the new Custom Lens embeddable component, the titles are\r\nhidden
by default due to to a regression introduced
in\r\nhttps://github.com//pull/186642.\r\nThis PR should
fix the correct title handling of the header visibility\r\nby hiding or
showing the wrapping Panel title depending on the\r\n`hidePanelTitles`
props of the `LensRenderer` component\r\n\r\n\r\nfix
https://github.com/elastic/kibana/issues/203354","sha":"6e57a23d18d949e7ac3118c1f27550e2ba9eedf8","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:Visualizations","release_note:skip","Feature:Lens","v9.0.0","backport:prev-minor","Feature:Embeddables"],"title":"[Lens]
Fix missing embeddable panel
titles","number":203355,"url":"https://github.com/elastic/kibana/pull/203355","mergeCommit":{"message":"[Lens]
Fix missing embeddable panel titles (#203355)\n\n## Summary\r\n\r\nWhen
using the new Custom Lens embeddable component, the titles are\r\nhidden
by default due to to a regression introduced
in\r\nhttps://github.com//pull/186642.\r\nThis PR should
fix the correct title handling of the header visibility\r\nby hiding or
showing the wrapping Panel title depending on the\r\n`hidePanelTitles`
props of the `LensRenderer` component\r\n\r\n\r\nfix
https://github.com/elastic/kibana/issues/203354","sha":"6e57a23d18d949e7ac3118c1f27550e2ba9eedf8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203355","number":203355,"mergeCommit":{"message":"[Lens]
Fix missing embeddable panel titles (#203355)\n\n## Summary\r\n\r\nWhen
using the new Custom Lens embeddable component, the titles are\r\nhidden
by default due to to a regression introduced
in\r\nhttps://github.com//pull/186642.\r\nThis PR should
fix the correct title handling of the header visibility\r\nby hiding or
showing the wrapping Panel title depending on the\r\n`hidePanelTitles`
props of the `LensRenderer` component\r\n\r\n\r\nfix
https://github.com/elastic/kibana/issues/203354","sha":"6e57a23d18d949e7ac3118c1f27550e2ba9eedf8"}}]}]
BACKPORT-->

Co-authored-by: Marco Vettorello <[email protected]>
  • Loading branch information
kibanamachine and markov00 authored Dec 10, 2024
1 parent a094e69 commit 85f8a4b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function LensRenderer({
filters,
timeRange,
disabledActions,
hidePanelTitles,
...props
}: LensRendererProps) {
// Use the settings interface to store panel settings
Expand All @@ -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<LensApi | undefined>(undefined);
Expand Down Expand Up @@ -112,7 +114,6 @@ export function LensRenderer({
const panelProps: PanelProps = useMemo(() => {
return {
hideInspector: !showInspector,
hideHeader: showPanelChrome,
showNotifications: false,
showShadow: false,
showBadges: false,
Expand All @@ -124,7 +125,7 @@ export function LensRenderer({
return (extraActions ?? []).concat(actions || []);
},
};
}, [showInspector, showPanelChrome, withDefaultActions, extraActions, lensApi]);
}, [showInspector, withDefaultActions, extraActions, lensApi]);

return (
<ReactEmbeddableRenderer<LensSerializedState, LensRuntimeState, LensApi>
Expand All @@ -147,6 +148,7 @@ export function LensRenderer({
...initialStateRef.current,
attributes: props.attributes,
}),
hidePanelTitle: hidePanelTitles$,
})}
onApiAvailable={setLensApi}
hidePanelChrome={!showPanelChrome}
Expand Down

0 comments on commit 85f8a4b

Please sign in to comment.