[Embeddable Rebuild] Refactor enhanced embeddables#178896
[Embeddable Rebuild] Refactor enhanced embeddables#178896Heenawter merged 16 commits intoelastic:mainfrom
Conversation
6c67ac5 to
fb1ba5e
Compare
|
/ci |
1 similar comment
|
/ci |
6150063 to
0cd10cd
Compare
|
/ci |
1 similar comment
|
/ci |
b7bb7a6 to
22d0fe5
Compare
|
/ci |
1 similar comment
|
/ci |
|
/ci |
| }: { | ||
| context: { embeddable: FlyoutEditDrilldownActionApi }; | ||
| }) => { | ||
| const dynamicActionsState = useStateFromPublishingSubject(embeddable.dynamicActionsState$); |
There was a problem hiding this comment.
Using the state container from DynamicActionManager was falling out of sync, so the badge beside the "edit" menu option would often reflect the wrong number (especially after the dashboard was reset) - switching to the dynamicActionsState$ publishing subject, which should be our source of truth, fixed this.
| if (!isApiCompatible(embeddable)) return; | ||
|
|
||
| return merge( | ||
| getViewModeSubject(embeddable) ?? new BehaviorSubject(ViewMode.VIEW), |
There was a problem hiding this comment.
Not sure how to better handle optional behaviour subjects?
|
/ci |
|
Pinging @elastic/kibana-presentation (Team:Presentation) |
nreese
left a comment
There was a problem hiding this comment.
LGTM with a few nits about typings. This is a heavy lift and your changes are really streamlined and easy to follow. Great job bringing drilldowns across the line for react embeddables.
code review, tested in chrome
...nced/public/services/drilldowns/actions/flyout_edit_drilldown/flyout_edit_drilldown.test.tsx
Outdated
Show resolved
Hide resolved
...shboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/menu_item.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/embeddable_enhanced/public/actions/panel_notifications_action.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/embeddable_enhanced/public/actions/panel_notifications_action.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/embeddable_enhanced/public/actions/panel_notifications_action.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/embeddable_enhanced/public/embeddables/dynamic_action_storage.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/embeddable_enhanced/public/embeddables/dynamic_action_storage.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/embeddable_enhanced/public/embeddables/dynamic_action_storage.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/embeddable_enhanced/public/embeddables/dynamic_action_storage.ts
Outdated
Show resolved
Hide resolved
d7c452a to
c07c945
Compare
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
Unreferenced deprecated APIs
History
To update your PR or re-run it, just comment with: cc @Heenawter |
…11678) ## Summary This PR re-adds drilldown support to the Discover session embeddable after it was accidentally removed during the refactoring in #180536 (related PR where drilldowns / dynamic actions were refactored: #178896). A new functional test has also been added to prevent future regressions. Fixes #211677. ### Checklist - [ ] 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/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
…astic#211678) ## Summary This PR re-adds drilldown support to the Discover session embeddable after it was accidentally removed during the refactoring in elastic#180536 (related PR where drilldowns / dynamic actions were refactored: elastic#178896). A new functional test has also been added to prevent future regressions. Fixes elastic#211677. ### Checklist - [ ] 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/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co> (cherry picked from commit 257971d)
…astic#211678) ## Summary This PR re-adds drilldown support to the Discover session embeddable after it was accidentally removed during the refactoring in elastic#180536 (related PR where drilldowns / dynamic actions were refactored: elastic#178896). A new functional test has also been added to prevent future regressions. Fixes elastic#211677. ### Checklist - [ ] 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/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co> (cherry picked from commit 257971d) # Conflicts: # src/platform/plugins/shared/discover/public/types.ts # src/platform/plugins/shared/discover/tsconfig.json
…astic#211678) ## Summary This PR re-adds drilldown support to the Discover session embeddable after it was accidentally removed during the refactoring in elastic#180536 (related PR where drilldowns / dynamic actions were refactored: elastic#178896). A new functional test has also been added to prevent future regressions. Fixes elastic#211677. ### Checklist - [ ] 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/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co> (cherry picked from commit 257971d) # Conflicts: # src/plugins/discover/public/build_services.ts # src/plugins/discover/public/embeddable/get_search_embeddable_factory.tsx # src/plugins/discover/public/embeddable/types.ts # src/plugins/discover/public/embeddable/utils/serialization_utils.test.ts # src/plugins/discover/public/types.ts # src/plugins/discover/tsconfig.json
…astic#211678) ## Summary This PR re-adds drilldown support to the Discover session embeddable after it was accidentally removed during the refactoring in elastic#180536 (related PR where drilldowns / dynamic actions were refactored: elastic#178896). A new functional test has also been added to prevent future regressions. Fixes elastic#211677. ### Checklist - [ ] 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/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
…astic#211678) ## Summary This PR re-adds drilldown support to the Discover session embeddable after it was accidentally removed during the refactoring in elastic#180536 (related PR where drilldowns / dynamic actions were refactored: elastic#178896). A new functional test has also been added to prevent future regressions. Fixes elastic#211677. ### Checklist - [ ] 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/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
Closes #178742
Summary
In the old embeddable system, when an embeddable is created through its factory, it is "enhanced" via
enhanceEmbeddableWithDynamicActionsinEmbeddableEnhancedPlugin- this enhancement is responsible for adding the pieces necessary (for example, theDynamicActionManager) to the embeddable to manage drilldowns. In the new system, we are no longer using these class-based factories - so there is no longer a way to enhance embeddables on creation. Therefore, this PR does three main things:initializeDynamicActionsto theEnhancedEmbeddablePluginand returns it through its start contract (in order to bypass limitations around importing stuff fromxpack) - this method can be used to enhance all React-based embeddables with the stuff necessary for drilldowns to work. As part of this, I had to add a few extra pieces to theHasDynamicActionsAPI:dynamicActionsState$: This is a publishing subject that will keep track of the events currently attached to the given embeddable (DynamicActionsState)setDynamicActions: A setter for the above publishing subjectPanelNotificationsAction,EmbeddableToDashboardDrilldown,FlyoutEditDrilldownAction, andFlyoutCreateDrilldownAction.enhanceEmbeddableWithDynamicActionsto add the publishing subject + setter from (1) above to all legacy embeddables when they are enhanced - that way, they will still pass theapiHasDynamicActionstype check + all modified actions continue to work for legacy embeddables.How to Test
To test with a React embeddable, you can checkout the draft PR containing the new image embeddable.
Checklist
For maintainers