-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Reporting] Make "ScreenCapturePanel" shareable for Canvas #100623
[Reporting] Make "ScreenCapturePanel" shareable for Canvas #100623
Conversation
4028fbb
to
4f70988
Compare
6f5cfa0
to
424b165
Compare
} | ||
|
||
export class ScreenCapturePanelContent extends Component<Props, State> { | ||
constructor(props: Props) { | ||
super(props); | ||
|
||
const { objectType } = props.getJobParams(); | ||
const isPreserveLayoutSupported = props.reportType !== 'png' && objectType !== 'visualization'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this since elsewhere in the code it's fine/expected for PNG layout to provide "preserve" layout as the option. Therefore, preserve layout is always supported.
188a0b8
to
0887c3b
Compare
Pinging @elastic/kibana-app-services (Team:AppServices) |
Pinging @elastic/kibana-reporting-services (Team:Reporting Services) |
0887c3b
to
234c5f5
Compare
234c5f5
to
112fb42
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still need to finish testing locally, left a couple questions!
return ( | ||
<ScreenCapturePanelContent | ||
layoutOption={props.layoutOption} | ||
requiresSavedState={false} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the intention is to make this available to Canvas, but I wonder whether still should not treat this as through it could be placed anywhere (like in Dashboard?). If it is the case that we want to treat it as though it can be used anywhere then I think we should not hardcode this value but rather have the consumer pass it through to us since PDFs, in certain context, do still require saved state. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you it's cleaner to treat this as if it could be used in Dashboard. I don't want to get too deep yet in perfecting the integration touchpoints for the reporting panel. There will be future tech debt / refactoring work to move the export implementation logic out of Reporting, and have new plugins that provide export implementation. That will affect the integration touchpoints, because apps would go from importing this panel component from Reporting, to importing it from a new plugin that controls the implementation detail of the export.
- current:
<services.reporting.components.ReportingPanelPDF />
- future:
<services.exportPDF.components.ReportingPanelPDF />
That is why this PR does not change the Reporting plugin contract further, for example it doesn't add CSV or PNG export panel to the contract.
This is a good note for any reviewer - I'll update the description to talk about this.
cc @ppisljar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will be future tech debt / refactoring work to move the export implementation logic out of Reporting, and have new plugins that provide export implementation
Related Discuss issue: #101422
}; | ||
|
||
private getLayout = () => { | ||
private handleCanvasLayoutChange = (evt: EuiSwitchEvent) => { | ||
this.setState({ useCanvasLayout: evt.target.checked, usePrintLayout: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UX here looks like if the user presses the canvas switch (say it is in the "off" position) it will set usePrintLayout
to false
. Pressing it again will leave usePrintLayout
in false
. I guess this leaves in in the "default" layout which would be "X"?
I'm wondering, if these controls are related in this way (cannot choose one while we've chosen the other) whether a button group component or similar might not be more appropriate i.t.o. UX. Open to other thoughts here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see I was mistaken on this one. Looking at the private renderOptions
function I thought that we would render two toggles in some instances but then I saw the isPrintLayoutSupported
and isCanvasLayoutSupported
are mutually exclusive values that are determined at component mount.
IMO it would be clearer for readers if we read:
if (this.state.isPrintLayoutSupported)
as if (this.props.layoutOption === 'print')
and chained the if as else if ...
for the subsequent canvas layout check to communicate their mutual exclusivity. This is a nit, won't block on this!
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested both Canvas and the example reporting plugins locally and both worked as intended. Great work @tsullivan !
I did not in the example plugin the canvas layout option and the pdf layout option linked to an empty panel which made the example a bit incomplete.
Won't block you on this though, but it might be worth updating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me over. One thing that I noticed: if you have reporting enabled but don't have the correct license type and you attempt to generate a PDF, you get a toast notification that just says "Forbidden" where I think previously you'd get a mention about needing to update your license.
@elasticmachine merge upstream |
That seems like a regression bug: the feature controls that guard Reporting should be aware of the license as well as the application privileges from the user role. I'll look into it. |
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
History
To update your PR or re-run it, just comment with: |
…00623) * use ScreenCapturePanel component in Canvas * use smaller state object * add comment about canvas-specific shared component * fix example * fix toast error * fix i18n * fix data-test-subj Co-authored-by: Kibana Machine <[email protected]>
…0623) (#101852) * [Reporting] Make "ScreenCapturePanel" shareable for Canvas (#100623) * use ScreenCapturePanel component in Canvas * use smaller state object * add comment about canvas-specific shared component * fix example * fix toast error * fix i18n * fix data-test-subj Co-authored-by: Kibana Machine <[email protected]> * fix compatibility type ts Co-authored-by: Kibana Machine <[email protected]>
…add-agent-flyout * 'master' of github.com:elastic/kibana: (35 commits) [Cases] Improve connectors mapping (elastic#101145) [ML] Fixes display of job group badges in recognizer wizard (elastic#101775) Fix es_archives path (elastic#101737) [kbnArchiver] convert archive names to root-relative paths (elastic#101839) [Reporting] Make "ScreenCapturePanel" shareable for Canvas (elastic#100623) [Alerting UI] Converted Rules and Connectors management pages to new layout. (elastic#101697) [Fleet] Support granular integrations in policy editor (elastic#101531) [Security Solution][Detections] Update detection alert mappings to ECS v1.10.0 (elastic#101680) [Fleet] Integrations UI: Adjust policies list UI (elastic#101600) chore(NA): moving @kbn/server-route-repository into bazel (elastic#101484) Support owner and description attributes inside the Manifest file, use in API docs (elastic#101786) [Security Solution] fix security empty overview links (elastic#101536) Unskips migration tests now that elastic search is fixed (elastic#101682) Fix endpoint -> integrations onboarding link (elastic#101804) [Alerting] Log warning when rules are not rescheduled due to Saved Object not found error (elastic#101591) Update datafeed_high_count_network_denies.json (elastic#101681) [Index patterns] Field editor example app (elastic#100524) [DOCS] Adding file upload to add data page (elastic#101674) [Security Solution][Endpoint] Adds Endpoint Host Isolation Status common component (elastic#101782) Upgrade ws v7.3.1->v7.4.2 and v6.2.1->v6.2.2 (elastic#101402) ... # Conflicts: # x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_policy_selection.tsx # x-pack/plugins/fleet/public/components/agent_enrollment_flyout/index.tsx # x-pack/plugins/fleet/public/components/agent_enrollment_flyout/managed_instructions.tsx # x-pack/plugins/fleet/public/components/agent_enrollment_flyout/standalone_instructions.tsx
…add-integrations-redirect * 'master' of github.com:elastic/kibana: (44 commits) Allow navigating discover flyout via arrow keys (elastic#101772) [Cases] Improve connectors mapping (elastic#101145) [ML] Fixes display of job group badges in recognizer wizard (elastic#101775) Fix es_archives path (elastic#101737) [kbnArchiver] convert archive names to root-relative paths (elastic#101839) [Reporting] Make "ScreenCapturePanel" shareable for Canvas (elastic#100623) [Alerting UI] Converted Rules and Connectors management pages to new layout. (elastic#101697) [Fleet] Support granular integrations in policy editor (elastic#101531) [Security Solution][Detections] Update detection alert mappings to ECS v1.10.0 (elastic#101680) [Fleet] Integrations UI: Adjust policies list UI (elastic#101600) chore(NA): moving @kbn/server-route-repository into bazel (elastic#101484) Support owner and description attributes inside the Manifest file, use in API docs (elastic#101786) [Security Solution] fix security empty overview links (elastic#101536) Unskips migration tests now that elastic search is fixed (elastic#101682) Fix endpoint -> integrations onboarding link (elastic#101804) [Alerting] Log warning when rules are not rescheduled due to Saved Object not found error (elastic#101591) Update datafeed_high_count_network_denies.json (elastic#101681) [Index patterns] Field editor example app (elastic#100524) [DOCS] Adding file upload to add data page (elastic#101674) [Security Solution][Endpoint] Adds Endpoint Host Isolation Status common component (elastic#101782) ... # Conflicts: # x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx # x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/package_policies_table.tsx
* use ScreenCapturePanel component in Canvas * use smaller state object * add comment about canvas-specific shared component * fix example * fix toast error * fix i18n * fix data-test-subj Co-authored-by: Kibana Machine <[email protected]>
Summary
This PR adds code in the Reporting public plugin that is exposed on the plugin contract, for the purpose of sharing with Canvas app and removing redundant UI code from Canvas. The effect of doing this refactoring is fixing UI inconsistencies between Canvas app and Dashboard app.
Closes:
Checklist
Delete any items that are not applicable to this PR.