-
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
[Embeddables Rebuild] Clone panels with runtime state #186052
[Embeddables Rebuild] Clone panels with runtime state #186052
Conversation
/ci |
/ci |
/ci |
/ci |
Pinging @elastic/kibana-presentation (Team:Presentation) |
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.
Code review + tested this with my saved search embeddable. Everything seems to work as expected! Tested cloning to ensure it is cloned by value + tested backup storage to ensure that references are passed properly.
@@ -69,6 +74,7 @@ export const apiHasInPlaceLibraryTransforms = ( | |||
}; | |||
|
|||
/** | |||
* @deprecated use HasInPlaceLibraryTransforms instead |
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.
🎉 🎉 🎉
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: cc @ThomThomson |
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.
Shared UX changes in kibana utils LGTM thanks!
Makes the clone operation use runtime state rather than serialized state.
…o new embeddable framework (#180536) Closes #174959 ## Summary This PR converts the Saved Search embeddable to the new React embeddable framework. There should not be **any** changes in user-facing behaviour (except for the intentional change described [here](#180536 (comment))) - therefore, testing of this PR should be focused on ensuring that no behaviour is changed and/or broken with this refactor. > [!WARNING] > The saved search embeddable takes **many forms** and so, while I tried my best to test everything thoroughly, it is very, very likely that I missed some test cases due to not being the expert in this area. It is important that @elastic/kibana-data-discovery in particular approaches this PR review with a fine-tooth comb 🙇 Thanks so much. ### Notes about the embeddable state: As part of this refactor, I made three significant changes to how the state is managed: 1. Once the embeddable is being built in `buildEmbeddable`, the **only difference** between the runtime state of a by reference and a by value panel is that the by reference one will have three saved object-specific keys: `savedObjectId`, `savedObjectDescription`, and `savedObjectTitle`. 2. Number 1 made it possible for me to "flatten out" the runtime state of the embeddable by removing the `attributes` key, which makes it easier to access the pieces of state that you need. 3. Previously, the `savedSearch` element of the Saved Search embeddable object was never modified; instead, changes made to the columns, sort, sample size, etc. from the dashboard were stored in `explicitInput`. This essentially created two sources of truth. With the new embeddable system, we only ever want **one** source of truth - so, the saved search is now modified **directly** when making changes from the dashboard. However, in order to keep behaviour consistent with the old embeddable, changes made from the dashboard to a by reference saved search **should not** modify the underlying saved object (this behaviour will have to change if we ever want inline editing for saved searches, but that is another discussion) - therefore, when **serializing** the runtime state (which happens when the dashboard is saved), we [only serialize state that has **changed** from the initial state](https://github.com/elastic/kibana/pull/180536/files#diff-7346937694685b85c017fb608c6582afb3aded0912bfb42fffa4b32a6d27fdbbR93-R117); then, on deserialization, we take this "changed" state and [**overwrite** the state of the saved search with it](https://github.com/elastic/kibana/pull/180536/files#diff-7346937694685b85c017fb608c6582afb3aded0912bfb42fffa4b32a6d27fdbbR44-R54). Note that this **only** applies to by reference saved searches - with by value saved searches, we don't have to worry about this and can freely modify the state. I also had to make changes to how the **search source** is stored in runtime state. Previously, when initializing the embeddable, fetching the saved search saved object also created and returned an **unserializable** search source object. However, in the new system, runtime state **most always be serializable** (see #186052) - therefore, I've had to instead use the **serialized** search source in my runtime state saved search - therefore, I've had to make changes to `toSavedSearch` method to [allow for a **serializable** saved search to be returned](https://github.com/elastic/kibana/pull/180536/files#diff-3baaeaeef5893a5a4db6379a1ed888406a8584cb9d0c7440f273040e4aa28166R160-R169). | | Runtime state (`input`) before | Runtime state after | |--------|--------|--------| | **By value** | ![image](https://github.com/elastic/kibana/assets/8698078/d019f904-aac3-4bf2-8f9f-a98787d3b78a) | ![image](https://github.com/elastic/kibana/assets/8698078/dd820202-f1ef-4404-9450-610989204015) | | **By reference** | ![image](https://github.com/elastic/kibana/assets/8698078/ebb0d4a9-b918-48a4-8690-0434a2a17561) | ![image](https://github.com/elastic/kibana/assets/8698078/16fa1e4d-064d-457b-98af-4697f52de4dd) | ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
Fixes #186036 by making the clone operation use runtime state rather than serialized state.