Skip to content

Commit

Permalink
[Embeddable rebuild] Fix kibana reporting screenshot issue (elastic#1…
Browse files Browse the repository at this point in the history
…81392)

Fixes elastic#181389

It turns out that a [data-shared-item is
needed](https://github.com/elastic/kibana/pull/169929/files#r1373148068),
otherwise reporting doesn't work properly. This PR is adding the
required `data-shared-item` to the presentation panel component, and
fixes the reporting screenshot issue.

**UPDATE**: Adding `data-shared-item` to the presentation panel caused
some test failures. The approach we followed for now, was to add this
attribute to each migrated embeddable, the `image` and `swim lane`
embeddables. As part of this
elastic#179376, Kibana presentation
team will investigate further the proper use of data-* attributes

<img width="600" alt="Screenshot 2024-04-23 at 10 41 59"
src="https://github.com/elastic/kibana/assets/2852703/cee076a1-b989-4d5f-8462-4021ce9e5e4d">

<img width="600" alt="Screenshot 2024-04-23 at 10 41 27"
src="https://github.com/elastic/kibana/assets/2852703/83677ad1-b1d2-4915-a747-9afe5a1d447a">

- No timeout error should appear in the generated PDF reports

<img width="600" alt="Screenshot 2024-04-23 at 11 02 32"
src="https://github.com/elastic/kibana/assets/2852703/e0452e32-8c1e-4075-b9c9-b1225f9bd852">

<img width="600" alt="Screenshot 2024-04-23 at 11 19 54"
src="https://github.com/elastic/kibana/assets/2852703/08284774-a4ff-47b0-b496-3570416f0e57">

<img width="600" alt="Screenshot 2024-04-23 at 11 07 43"
src="https://github.com/elastic/kibana/assets/2852703/95e9adae-cd07-42fe-9dea-cd22b9711155">

cc @Heenawter
@darnautov Can you check the swim lane embeddable with real data and see
if reporting works properly with the change I added?

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Hannah Mudge <hannah.wright@elastic.co>
(cherry picked from commit f1e02f6)
  • Loading branch information
mgiota committed Apr 26, 2024
1 parent 5cee001 commit bf9a0be
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export const ImageEmbeddable = ({ api, filesClient }: ImageEmbeddableProps) => {
}}
>
<ImageViewer
data-rendering-count={1} // TODO: Remove this as part of https://github.com/elastic/kibana/issues/179376
// TODO: Remove data-shared-item and data-rendering-count as part of https://github.com/elastic/kibana/issues/179376
data-shared-item={''}
data-rendering-count={1}
className="imageEmbeddableImage"
imageConfig={imageConfig}
isScreenshotMode={screenshotModeService?.isScreenshotMode()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function ImageViewer({
className,
containerCSS,
isScreenshotMode,
...rest
}: ImageViewerProps) {
const { getImageDownloadHref, validateUrl } = useImageViewerContext();

Expand All @@ -68,6 +69,7 @@ export function ImageViewer({

return (
<div
{...rest}
css={[
css`
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ export const getAnomalySwimLaneEmbeddableFactory = (
padding: 8px;
`}
data-test-subj="mlAnomalySwimlaneEmbeddableWrapper"
data-shared-item="" // TODO: Remove data-shared-item as part of https://github.com/elastic/kibana/issues/179376
>
<SwimlaneContainer
id={uuid}
Expand Down

0 comments on commit bf9a0be

Please sign in to comment.