[Canvas] Fix map embeddables not showing up on PDF reports (#61149)

* Allow embeddables to track their own render complete for report generation in canvas

* Updating following consult with reporting team

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Poff Poffenberger 2020-03-25 14:54:32 -05:00 committed by GitHub
parent 4c70ef54a7
commit a16968dd3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -28,6 +28,7 @@ export class ExportApp extends React.PureComponent {
const { workpad, selectedPageId } = this.props;
const { pages, height, width } = workpad;
const activePage = pages.find(page => page.id === selectedPageId);
const pageElementCount = activePage.elements.length;
return (
<div className="canvasExport">
@ -39,7 +40,7 @@ export class ExportApp extends React.PureComponent {
</div>
{Style.it(
workpad.css,
<div className="canvasExport__stageContent">
<div className="canvasExport__stageContent" data-shared-items-count={pageElementCount}>
<WorkpadPage
isSelected
key={activePage.id}

View file

@ -81,11 +81,15 @@ export class ElementShareContainer extends React.PureComponent {
};
render() {
const shouldTrackComplete = this.props.functionName !== 'embeddable';
// NOTE: the data-shared-item and data-render-complete attributes are used for reporting
// Embeddables should be setting data-shared-item and data-render-complete on themselves
// so we should not be tracking them here.
return (
<div
data-shared-item
data-render-complete={this.state.renderComplete}
data-shared-item={shouldTrackComplete ? this.state.renderComplete : undefined}
data-render-complete={shouldTrackComplete ? this.state.renderComplete : undefined}
className={this.props.className}
ref={ref => (this.sharedItemRef = ref)}
>