[Reporting] Allow POST URL in Canvas to be copied (#117954)

This commit is contained in:
Tim Sullivan 2021-11-09 21:53:43 -07:00 committed by GitHub
parent 92ffb9e09a
commit 24477e9af9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 1 deletions

View file

@ -49,6 +49,7 @@ export const ShareMenu = () => {
getJobParams={() => getPdfJobParams(sharingData, platformService.getKibanaVersion())}
layoutOption="canvas"
onClose={onClose}
objectId={workpad.id}
/>
)
: null;

View file

@ -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">

View file

@ -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.