From e32739e63c52afe0a026afd9c1b42b876172af24 Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Tue, 9 Nov 2021 21:53:43 -0700 Subject: [PATCH] [Reporting] Allow POST URL in Canvas to be copied (#117954) --- .../workpad_header/share_menu/share_menu.tsx | 1 + .../screen_capture_panel_content.test.tsx | 37 +++++++++++++++++++ .../public/shared/get_shared_components.tsx | 3 +- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.tsx b/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.tsx index 50a3890673ffa..c66336a9153c0 100644 --- a/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.tsx +++ b/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.tsx @@ -49,6 +49,7 @@ export const ShareMenu = () => { getJobParams={() => getPdfJobParams(sharingData, platformService.getKibanaVersion())} layoutOption="canvas" onClose={onClose} + objectId={workpad.id} /> ) : null; diff --git a/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.test.tsx b/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.test.tsx index f37aaea114cfa..0366c1c6d052c 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.test.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.test.tsx @@ -63,6 +63,43 @@ test('ScreenCapturePanelContent properly renders a view with "canvas" layout opt expect(component.text()).toMatch('Full page layout'); }); +test('ScreenCapturePanelContent allows POST URL to be copied when objectId is provided', () => { + const component = mount( + + + + ); + expect(component.text()).toMatch('Copy POST URL'); + expect(component.text()).not.toMatch('Unsaved work'); +}); + +test('ScreenCapturePanelContent does not allow POST URL to be copied when objectId is not provided', () => { + const component = mount( + + + + ); + expect(component.text()).not.toMatch('Copy POST URL'); + expect(component.text()).toMatch('Unsaved work'); +}); + test('ScreenCapturePanelContent properly renders a view with "print" layout option', () => { const component = mount( diff --git a/x-pack/plugins/reporting/public/shared/get_shared_components.tsx b/x-pack/plugins/reporting/public/shared/get_shared_components.tsx index 623e06dd74462..b08036e8b1c80 100644 --- a/x-pack/plugins/reporting/public/shared/get_shared_components.tsx +++ b/x-pack/plugins/reporting/public/shared/get_shared_components.tsx @@ -16,7 +16,8 @@ interface IncludeOnCloseFn { onClose: () => void; } -type Props = Pick & IncludeOnCloseFn; +type Props = Pick & + IncludeOnCloseFn; /* * As of 7.14, the only shared component is a PDF report that is suited for Canvas integration.