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

[Embeddable rebuild] Move saved object reference extract / inject #176618

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ThomThomson
Copy link
Contributor

Overview

The Dashboard used to be in charge of extracting and injecting references for any panel which could be by reference. It did this by creating a reference for each panel which had a savedObjectId as part of its embeddable config. Because the Dashboard took care of this reference, the individual embeddable types never managed this reference for themselves, which was a piece of tech debt that limited how an Embeddable could be by reference.

After #176455, React Embeddables (the new Embeddable framework) will be able to extract and inject their own references. If one had a savedObjectId as part of their state, the Dashboard would attempt to create a saved object reference from it, even if the React Embeddable had already created and returned one. This could result in duplication and undefined behaviour. To prevent this, this PR moves the saved object reference injection and extraction into the inject and extract methods of each individual Embeddable type that can be by reference.

@ThomThomson
Copy link
Contributor Author

/ci

@ThomThomson
Copy link
Contributor Author

/ci

@ThomThomson
Copy link
Contributor Author

/ci

@kibana-ci
Copy link
Collaborator

kibana-ci commented Apr 3, 2024

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #79 / Agent policies fleet_agent_policies POST /api/fleet/agent_policies/{agentPolicyId}/copy should work with package policy with space in name
  • [job] [logs] FTR Configs #79 / Agent policies fleet_agent_policies POST /api/fleet/agent_policies/{agentPolicyId}/copy should work with package policy with space in name
  • [job] [logs] FTR Configs #96 / apis saved_objects import with basic data existing should return 200 when conflicts exist but overwrite is passed in
  • [job] [logs] FTR Configs #96 / apis saved_objects import with basic data existing should return 200 when conflicts exist but overwrite is passed in
  • [job] [logs] x-pack/test/cloud_security_posture_functional/config.ts / Cloud Security Posture Cloud Posture Rules Page "before each" hook for "Shows posture score when there are findings"
  • [job] [logs] Jest Tests #3 / dashboard 7.11.0 - embeddable persistable state extraction should migrate 7.3.0 doc and extract embeddable state
  • [job] [logs] Jest Tests #3 / dashboard 7.11.0 - embeddable persistable state extraction should migrate 7.3.0 doc and extract embeddable state
  • [job] [logs] Jest Tests #3 / dashboard 7.11.0 - embeddable persistable state extraction should migrate 7.3.0 doc without embeddable state to extract
  • [job] [logs] Jest Tests #3 / dashboard 7.11.0 - embeddable persistable state extraction should migrate 7.3.0 doc without embeddable state to extract
  • [job] [logs] FTR Configs #23 / dashboard Export import saved objects between versions should render all panels on the dashboard
  • [job] [logs] FTR Configs #23 / dashboard Export import saved objects between versions should render all panels on the dashboard
  • [job] [logs] FTR Configs #5 / dashboard Reporting Dashboard Reporting Screenshots Print Layout downloads a PDF file
  • [job] [logs] FTR Configs #5 / dashboard Reporting Dashboard Reporting Screenshots Print Layout downloads a PDF file
  • [job] [logs] FTR Configs #60 / EPM Endpoints EPM - get returns correct package info if it was installed by upload
  • [job] [logs] FTR Configs #60 / EPM Endpoints EPM - get returns correct package info if it was installed by upload
  • [job] [logs] Jest Tests #3 / extractReferences extracts references from panelsJSON
  • [job] [logs] Jest Tests #3 / extractReferences extracts references from panelsJSON
  • [job] [logs] Jest Tests #3 / inject/extract by reference panel should extract the saved object panel
  • [job] [logs] Jest Tests #3 / inject/extract by reference panel should extract the saved object panel
  • [job] [logs] Jest Tests #3 / inject/extract by reference panel should inject the extracted saved object panel
  • [job] [logs] Jest Tests #3 / inject/extract by reference panel should inject the extracted saved object panel
  • [job] [logs] Jest Tests #3 / injectReferences fails when it can't find the reference in the array
  • [job] [logs] Jest Tests #3 / injectReferences fails when it can't find the reference in the array
  • [job] [logs] Jest Tests #3 / injectReferences returns injected attributes
  • [job] [logs] Jest Tests #3 / injectReferences returns injected attributes
  • [job] [logs] Jest Tests #3 / injectReferences skips a panel when panelRefName is missing
  • [job] [logs] Jest Tests #3 / injectReferences skips a panel when panelRefName is missing
  • [job] [logs] FTR Configs #78 / Machine Learning modules module setup sets up module data for apache_ecs with prefix, startDatafeed true and estimateModelMemory true
  • [job] [logs] FTR Configs #78 / Machine Learning modules module setup sets up module data for apache_ecs with prefix, startDatafeed true and estimateModelMemory true
  • [job] [logs] FTR Configs #12 / maps app embeddable tooltip filter actions apply filter to current view "before all" hook for "should display create filter button when tooltip is locked"
  • [job] [logs] FTR Configs #12 / maps app embeddable tooltip filter actions apply filter to current view "before all" hook for "should display create filter button when tooltip is locked"
  • [job] [logs] Jest Integration Tests #2 / migrating from 7.3.0-xpack which used v1 migrations copies all the document of the previous index to the new one
  • [job] [logs] Jest Integration Tests #2 / migrating from 7.3.0-xpack which used v1 migrations copies all the document of the previous index to the new one
  • [job] [logs] Jest Integration Tests #2 / migrating from 7.3.0-xpack which used v1 migrations creates the new index and the correct aliases
  • [job] [logs] Jest Integration Tests #2 / migrating from 7.3.0-xpack which used v1 migrations creates the new index and the correct aliases
  • [job] [logs] Jest Integration Tests #2 / migrating from 7.3.0-xpack which used v1 migrations migrates the documents to the highest version
  • [job] [logs] Jest Integration Tests #2 / migrating from 7.3.0-xpack which used v1 migrations migrates the documents to the highest version
  • [job] [logs] FTR Configs #69 / Package policies Package Policy - create can only add to hosted agent policies using the force parameter
  • [job] [logs] FTR Configs #69 / Package policies Package Policy - create can only add to hosted agent policies using the force parameter
  • [job] [logs] FTR Configs #52 / Reporting APIs Job parameter validation printablePdfV2 allows width and height to have decimal
  • [job] [logs] FTR Configs #52 / Reporting APIs Job parameter validation printablePdfV2 allows width and height to have decimal
  • [job] [logs] FTR Configs #76 / Reporting Functional Tests with Deprecated Security configuration enabled Security with reporting_user built-in role Dashboard: Download CSV file does not allow user that does not have reporting_user role
  • [job] [logs] FTR Configs #76 / Reporting Functional Tests with Deprecated Security configuration enabled Security with reporting_user built-in role Dashboard: Download CSV file does not allow user that does not have reporting_user role
  • [job] [logs] FTR Configs #87 / Reporting Functional Tests with Security enabled Security with reporting_user built-in role Dashboard: Generate CSV report does not allow user that does not have reporting privileges
  • [job] [logs] FTR Configs #87 / Reporting Functional Tests with Security enabled Security with reporting_user built-in role Dashboard: Generate CSV report does not allow user that does not have reporting privileges
  • [job] [logs] FTR Configs #83 / saved objects tagging - functional tests dashboard integration "before all" hook in "dashboard integration"
  • [job] [logs] FTR Configs #83 / saved objects tagging - functional tests dashboard integration "before all" hook in "dashboard integration"
  • [job] [logs] Jest Tests #1 / Should return original state with by-reference embeddable state
  • [job] [logs] Jest Tests #2 / Should return original state with by-reference embeddable state
  • [job] [logs] Jest Tests #1 / Should return original state with by-reference embeddable state
  • [job] [logs] Jest Tests #2 / Should return original state with by-reference embeddable state
  • [job] [logs] Jest Integration Tests #8 / split .kibana index into multiple system indices when migrating from a legacy version performs v1 migration and then relocates saved objects into different indices, depending on their types
  • [job] [logs] Jest Integration Tests #8 / split .kibana index into multiple system indices when migrating from a legacy version performs v1 migration and then relocates saved objects into different indices, depending on their types
  • [job] [logs] Jest Integration Tests #8 / split .kibana index into multiple system indices when multiple Kibana migrators run in parallel correctly migrates 7.7.2_xpack_100k_obj.zip archive
  • [job] [logs] Jest Integration Tests #8 / split .kibana index into multiple system indices when multiple Kibana migrators run in parallel correctly migrates 7.7.2_xpack_100k_obj.zip archive
  • [job] [logs] FTR Configs #31 / Visualize Visualize Reporting Screenshots PNG reports: sample data created in 7.6 "before all" hook for "TSVB Gauge: PNG file matches the baseline image"
  • [job] [logs] FTR Configs #31 / Visualize Visualize Reporting Screenshots PNG reports: sample data created in 7.6 "before all" hook for "TSVB Gauge: PNG file matches the baseline image"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
embeddable 111 112 +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
embeddable 452 458 +6

Async chunks

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

id before after diff
discover 590.4KB 590.4KB +8.0B
lens 1.4MB 1.4MB +2.0B
maps 2.9MB 2.9MB +12.0B
visualizations 274.3KB 274.3KB +2.0B
total +24.0B

Page load bundle

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

id before after diff
dashboard 37.0KB 36.5KB -484.0B
discover 34.9KB 35.1KB +258.0B
embeddable 65.6KB 66.0KB +493.0B
lens 46.3KB 46.6KB +257.0B
links 33.7KB 33.9KB +252.0B
maps 50.4KB 50.7KB +254.0B
visualizations 58.9KB 59.1KB +243.0B
total +1.2KB
Unknown metric groups

API count

id before after diff
embeddable 557 563 +6

History

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants