Skip to content

Commit

Permalink
[Reporting] Allow POST URL in Canvas to be copied (#117954) (#118133)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan authored Nov 10, 2021
1 parent ab44f7b commit 672a9c2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const ShareMenu = () => {
getJobParams={() => getPdfJobParams(sharingData, platformService.getKibanaVersion())}
layoutOption="canvas"
onClose={onClose}
objectId={workpad.id}
/>
)
: null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<IntlProvider locale="en">
<ScreenCapturePanelContent
layoutOption="canvas"
reportType="Analytical App"
requiresSavedState={false}
apiClient={apiClient}
uiSettings={uiSettings}
toasts={coreSetup.notifications.toasts}
getJobParams={getJobParamsDefault}
objectId={'1234-5'}
/>
</IntlProvider>
);
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(
<IntlProvider locale="en">
<ScreenCapturePanelContent
layoutOption="canvas"
reportType="Analytical App"
requiresSavedState={false}
apiClient={apiClient}
uiSettings={uiSettings}
toasts={coreSetup.notifications.toasts}
getJobParams={getJobParamsDefault}
/>
</IntlProvider>
);
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(
<IntlProvider locale="en">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ interface IncludeOnCloseFn {
onClose: () => void;
}

type Props = Pick<PanelPropsScreenCapture, 'getJobParams' | 'layoutOption'> & IncludeOnCloseFn;
type Props = Pick<PanelPropsScreenCapture, 'getJobParams' | 'layoutOption' | 'objectId'> &
IncludeOnCloseFn;

/*
* As of 7.14, the only shared component is a PDF report that is suited for Canvas integration.
Expand Down

0 comments on commit 672a9c2

Please sign in to comment.