Skip to content

Commit 8587289

Browse files
committed
Hide side-nav during report generation (#234675)
Fixes: #227187 When we request a report we send the target element's width and use it to create a browser window. Therefore the element's width becomes the window width. When the side-nav is visible on the page, it pushes the dashboard to the right and makes it smaller. As we take only the target element's screenshot and use the width we passed as param as image width in the pdf, it becomes skewed. This PR removes the side-nav from the page during the report generation. So the dashboard uses the full window width which is the original number we passed initially. ## To verify: Add `Sample web logs` data. Change the solution view in the Space to something other than Classic. Go to `Dashboards > Sample Logs Data` and generate a PDF report. The screenshot should not be skewed. Add the below config to your kibana.yml ``` feature_flags.overrides: core.chrome.projectSideNav: 'v2' ``` Go to `Dashboards > Sample Logs Data` and generate a PDF report. The fix should be working with the new side-nav as well. (cherry picked from commit fa3bcdf) # Conflicts: # src/core/packages/chrome/browser-internal/src/ui/project/navigation.tsx # src/core/packages/chrome/browser-internal/src/ui/project/sidenav_v2/fixed_layout_sidenav.tsx
1 parent f5645ee commit 8587289

File tree

1 file changed

+12
-5
lines changed
  • src/core/packages/chrome/browser-internal/src/ui/project

1 file changed

+12
-5
lines changed

src/core/packages/chrome/browser-internal/src/ui/project/navigation.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import { EuiCollapsibleNavBeta } from '@elastic/eui';
1212
import useObservable from 'react-use/lib/useObservable';
1313
import type { Observable } from 'rxjs';
1414
import { css } from '@emotion/css';
15+
import classnames from 'classnames';
16+
import type { NavigationProps } from './navigation';
17+
import { Navigation } from './navigation';
1518

1619
interface Props {
1720
toggleSideNav: (isVisible: boolean) => void;
@@ -26,6 +29,14 @@ export const ProjectNavigation: FC<PropsWithChildren<Props>> = ({
2629
toggleSideNav,
2730
}) => {
2831
const isCollapsed = useObservable(isSideNavCollapsed$, false);
32+
const className = classnames(
33+
'hide-for-sharing',
34+
css`
35+
.euiFlyoutBody__overflowContent {
36+
height: 100%;
37+
}
38+
`
39+
);
2940

3041
return (
3142
<EuiCollapsibleNavBeta
@@ -36,11 +47,7 @@ export const ProjectNavigation: FC<PropsWithChildren<Props>> = ({
3647
overflow: 'visible',
3748
clipPath: `polygon(0 0, calc(var(--euiCollapsibleNavOffset) + ${PANEL_WIDTH}px) 0, calc(var(--euiCollapsibleNavOffset) + ${PANEL_WIDTH}px) 100%, 0 100%)`,
3849
}}
39-
className={css`
40-
.euiFlyoutBody__overflowContent {
41-
height: 100%;
42-
}
43-
`}
50+
className={className}
4451
>
4552
{children}
4653
</EuiCollapsibleNavBeta>

0 commit comments

Comments
 (0)