Skip to content
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

[Canvas] Adds references extract/inject for Workpads #109874

Merged
merged 8 commits into from
Aug 31, 2021

Conversation

crob611
Copy link
Contributor

@crob611 crob611 commented Aug 24, 2021

Summary

This PR adds inject/extract functionality for references on a Canvas Workpad.

I introduce some workpad CRUD methods onto a request context so that they will be available on all of our routes using the appropriately scoped Saved Objects Client. These methods also implement the reference inject/extract where needed.

Because the inject/extract happens server side, we need to make sure that any function that is going to need extract is available server side as well, so this also required some changes to our embeddable functions to only use code that will run server side (it was previously importing some code from /public dirs and that would crash Kibana start up).

This also touches a few other plugins to move around some of the previously mentioned imports that were in public dirs to make sure they are coming from common, so that they will work both client and server side.

Testing

Here are the important areas to test

  • Saving/Reloading a Workpad with an embeddable (Map, Lens, Visualization)
  • Saved Object Management Export/Import Workpad with embeddables
    • Verify SO Management shows Links to referenced Saved Objects
  • Export Workpad as JSON. Import Workpad through Canvas home screen. Verify that has correct references from SO Managmeent

@crob611 crob611 requested a review from a team August 24, 2021 15:49
@crob611 crob611 requested review from a team as code owners August 24, 2021 15:49
@botelastic botelastic bot added Feature:Embedding Embedding content via iFrame Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) labels Aug 24, 2021
@crob611 crob611 added Feature:Canvas impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:medium Medium Level of Effort Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.16.0 v8.0.0 labels Aug 24, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@crob611
Copy link
Contributor Author

crob611 commented Aug 24, 2021

@elasticmachine merge upstream

@crob611
Copy link
Contributor Author

crob611 commented Aug 25, 2021

@elasticmachine merge upstream

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code LGTM

Copy link
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great-looking PR. I'm going to approve to unblock you and test more this afternoon. If you end up merging, I'll file a bug if I find one. Great work here!

@crob611
Copy link
Contributor Author

crob611 commented Aug 31, 2021

@elasticmachine merge upstream

Copy link
Contributor

@mbondyra mbondyra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kibana-app code lgtm 🆗

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
embeddable 105 106 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
discover 55 56 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
canvas 1.6MB 1.6MB +13.0B
discover 550.7KB 551.7KB +1.0KB
visualizations 101.5KB 101.5KB +2.0B
total +1.0KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
canvas 28.4KB 28.7KB +257.0B
discover 91.8KB 92.5KB +713.0B
embeddable 181.0KB 184.2KB +3.2KB
visualizations 58.5KB 58.7KB +232.0B
total +4.4KB
Unknown metric groups

API count

id before after diff
discover 81 82 +1

References to deprecated APIs

id before after diff
canvas 64 46 -18

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@crob611 crob611 merged commit d377451 into elastic:master Aug 31, 2021
@crob611 crob611 added the auto-backport Deprecated - use backport:version if exact versions are needed label Aug 31, 2021
@kibanamachine
Copy link
Contributor

💔 Backport failed

Status Branch Result
7.x Commit could not be cherrypicked due to conflicts

To backport manually run:
node scripts/backport --pr 109874

crob611 pushed a commit to crob611/kibana that referenced this pull request Aug 31, 2021
* Register embeddable functions server side.  Adds reference extraction/injection to workpads

* Clean up

* Fix Types

* Update API docs

* Remove API doc from expression (bad conflict resolution)

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	src/plugins/embeddable/kibana.json
#	x-pack/plugins/canvas/canvas_plugin_src/functions/external/index.ts
crob611 pushed a commit that referenced this pull request Aug 31, 2021
* Register embeddable functions server side.  Adds reference extraction/injection to workpads

* Clean up

* Fix Types

* Update API docs

* Remove API doc from expression (bad conflict resolution)

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	src/plugins/embeddable/kibana.json
#	x-pack/plugins/canvas/canvas_plugin_src/functions/external/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Canvas Feature:Embedding Embedding content via iFrame Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:medium Medium Level of Effort release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants