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] [Controls] Remove non-React controls from controls plugin #192017

Conversation

Heenawter
Copy link
Contributor

@Heenawter Heenawter commented Sep 3, 2024

Part of #192005
Closes #176533

Summary

This PR represents the first major cleanup task for the control group embeddable refactor. The tasks included in this PR can be loosely summarized as follows:

  1. This PR removes the old, non-React version of controls
    • Note that the new controls are still included under the react_controls folder - I will address this in a follow up PR.
  2. This PR removes all types associated with the old embeddable system; i.e. any *input* or *output* types.
    • As part of cleaning up these types, some of the types included in the public/react_controls folder had to be moved to common to make them available to server-side code.
    • This resulted in an... unfortunate number of import changes 🫠 Hence the rather large file change count. I took this opportunity to organize the imports, too - so a significant chunk of these files are simply import changes.
  3. This PR removes the controls Storybook and all related mocks
    • Since the controls storybooks have been broken for awhile, and since we had plans to remove them but never got around to it, I just decided to delete them as part of this PR and close [Controls] Remove storybooks #176533 rather than spending time to fix the types for non-operational stories

Checklist

For maintainers

@Heenawter Heenawter added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:small Small Level of Effort release_note:skip Skip the PR/issue when compiling release notes impact:critical This issue should be addressed immediately due to a critical level of impact on the product. project:embeddableRebuild labels Sep 3, 2024
@Heenawter Heenawter self-assigned this Sep 3, 2024
@Heenawter Heenawter force-pushed the embeddableRebuild_final-controls-cleanup_2024-09-03 branch from cff635b to ed106ab Compare September 10, 2024 16:24
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file was refactored to support the new types and then moved from src/plugins/controls/public/control_group/actions to src/plugins/controls/public/actions - because of this, GitHub is reporting it as an entirely new file 🤷 This is not actually a new test

@@ -7,6 +7,6 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export const ACTION_EDIT_CONTROL = 'editLegacyEmbeddableControl';
export const ACTION_EDIT_CONTROL = 'editDataControl';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

editLegacyEmbeddableControl isn't necessary anymore, as the legacy edit action has been deleted and replaced with the React control edit action

}

export interface ControlsPluginStart {
getControlFactory: ControlsServiceType['getControlFactory'];
getControlTypes: ControlsServiceType['getControlTypes'];
getAllControlTypes: ControlsServiceType['getAllControlTypes'];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to keep the setup and start contracts more-or-less the same, despite the fact that no one is using them - if we want to remove the ability for outside plugins to register controls, we can delete this in a follow up PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file was moved from common to server, but some of the code was also changed to make the types happy - it is worth taking a closer look at this file 🙇

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file was moved from common to server, but some of the code was also changed to make the types happy - it is worth taking a closer look at this file 🙇

Comment on lines +40 to +47
export type {
ControlGroupRuntimeState,
ControlGroupSerializedState,
ControlPanelState,
ControlPanelsState,
DefaultDataControlState,
} from '../common';
export type { OptionsListControlState } from '../common/options_list';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've had to export some stuff from common to keep the imports consistent for external uses - I kept these minimal though (i.e. only included the types that are used externally), since any internal controls code should just import from common when necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file used to contain a bunch of other styles specific to control panels - that logic was moved to control_panel.scss as part of the initial refactor, so this file now contains the bare minimum control group styling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to move a bunch of styles from the old control_group.scss to this file - that is why you are seeing a bunch of changes 🙇 I added some comments to try to clarify which styles are doing what, since this SASS file is a bit... unruly.

@@ -50,7 +52,7 @@ describe('render', () => {
await waitFor(() => {
const controlFrame = controlPanel.getByTestId('control-frame');
expect(controlFrame.getAttribute('class')).toContain('controlFrameWrapper--medium');
expect(controlFrame.getAttribute('class')).toContain('controlFrameWrapper--grow');
expect(controlFrame.getAttribute('class')).toContain('euiFlexItem-grow');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were never actually using the controlFrameWrapper--grow class so I removed it - a euiFlexItem-grow class check accomplishes the same thing, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This service had a bunch of stuff for the old timeslider control + the range slider control that are no longer being used 🤷 So I removed it all. I plan on doing a full audit of the services as part of #192005 to ensure everything is being used, but it was easier to remove this now because it was tied to old ControlInput types.

@Heenawter Heenawter marked this pull request as ready for review September 12, 2024 16:30
@Heenawter Heenawter requested review from a team as code owners September 12, 2024 16:30
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

kibana-presentation changes LGTM
code review only

Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

Style changes LGTM. Very nice *.scss clean up @Heenawter !

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

Code-only review, Data Discovery change LGTM 👍

@Heenawter Heenawter added the backport:prev-minor Backport to the previous minor version (i.e. one version back from main) label Sep 13, 2024
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #14 / Timeline rendering should trim kqlQueryExpression

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
controls 445 362 -83

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
controls 254 134 -120

Async chunks

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

id before after diff
controls 597.0KB 459.4KB -137.6KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
controls 30 14 -16

Page load bundle

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

id before after diff
controls 46.1KB 12.9KB -33.2KB
Unknown metric groups

API count

id before after diff
controls 259 138 -121

async chunk count

id before after diff
controls 19 11 -8

ESLint disabled line counts

id before after diff
controls 7 5 -2

References to deprecated APIs

id before after diff
controls 23 17 -6

Total ESLint disabled count

id before after diff
controls 7 5 -2

History

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

cc @Heenawter

Copy link
Contributor

@michaelolo24 michaelolo24 left a comment

Choose a reason for hiding this comment

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

Investigations changes, LGTM, sorry for the delay!

@Heenawter Heenawter merged commit 5082eef into elastic:main Sep 17, 2024
42 checks passed
@Heenawter Heenawter deleted the embeddableRebuild_final-controls-cleanup_2024-09-03 branch September 17, 2024 14:13
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 17, 2024
…ols` plugin (elastic#192017)

Part of elastic#192005
Closes elastic#176533

## Summary

This PR represents the first major cleanup task for the control group
embeddable refactor. The tasks included in this PR can be loosely
summarized as follows:
1. This PR removes the old, non-React version of controls
- Note that the new controls are still included under the
`react_controls` folder - I will address this in a follow up PR.
2. This PR removes **all** types associated with the old embeddable
system; i.e. any `*input*` or `*output*` types.
- As part of cleaning up these types, some of the types included in the
`public/react_controls` folder had to be moved to `common` to make them
available to server-side code.
- This resulted in an... unfortunate number of import changes 🫠 Hence
the rather large file change count. I took this opportunity to organize
the imports, too - so a significant chunk of these files are simply
import changes.
3. This PR removes the controls Storybook and all related mocks
- Since the controls storybooks have been broken for awhile, and since
we had plans to remove them but never got around to it, I just decided
to delete them as part of this PR and close
elastic#176533 rather than spending
time to fix the types for non-operational stories

### 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

### 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>
(cherry picked from commit 5082eef)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Sep 17, 2024
…&#x60;controls&#x60; plugin (#192017) (#193174)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Embeddable Rebuild] [Controls] Remove non-React controls from
&#x60;controls&#x60; plugin
(#192017)](#192017)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Hannah
Mudge","email":"Heenawter@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-09-17T14:12:54Z","message":"[Embeddable
Rebuild] [Controls] Remove non-React controls from `controls` plugin
(#192017)\n\nPart of
#192005
#176533
Summary\r\n\r\nThis PR represents the first major cleanup task for the
control group\r\nembeddable refactor. The tasks included in this PR can
be loosely\r\nsummarized as follows:\r\n1. This PR removes the old,
non-React version of controls \r\n- Note that the new controls are still
included under the\r\n`react_controls` folder - I will address this in a
follow up PR.\r\n2. This PR removes **all** types associated with the
old embeddable\r\nsystem; i.e. any `*input*` or `*output*` types.\r\n-
As part of cleaning up these types, some of the types included in
the\r\n`public/react_controls` folder had to be moved to `common` to
make them\r\navailable to server-side code.\r\n- This resulted in an...
unfortunate number of import changes 🫠 Hence\r\nthe rather large file
change count. I took this opportunity to organize\r\nthe imports, too -
so a significant chunk of these files are simply\r\nimport
changes.\r\n3. This PR removes the controls Storybook and all related
mocks\r\n- Since the controls storybooks have been broken for awhile,
and since\r\nwe had plans to remove them but never got around to it, I
just decided\r\nto delete them as part of this PR and
close\r\nhttps://github.com//issues/176533 rather than
spending\r\ntime to fix the types for non-operational stories\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"5082eef2f1df8b6d7e9bb15d2221b9f4c67b00bf","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","release_note:skip","impact:critical","v9.0.0","backport:prev-minor","project:embeddableRebuild"],"title":"[Embeddable
Rebuild] [Controls] Remove non-React controls from `controls`
plugin","number":192017,"url":"#192017
Rebuild] [Controls] Remove non-React controls from `controls` plugin
(#192017)\n\nPart of
#192005
#176533
Summary\r\n\r\nThis PR represents the first major cleanup task for the
control group\r\nembeddable refactor. The tasks included in this PR can
be loosely\r\nsummarized as follows:\r\n1. This PR removes the old,
non-React version of controls \r\n- Note that the new controls are still
included under the\r\n`react_controls` folder - I will address this in a
follow up PR.\r\n2. This PR removes **all** types associated with the
old embeddable\r\nsystem; i.e. any `*input*` or `*output*` types.\r\n-
As part of cleaning up these types, some of the types included in
the\r\n`public/react_controls` folder had to be moved to `common` to
make them\r\navailable to server-side code.\r\n- This resulted in an...
unfortunate number of import changes 🫠 Hence\r\nthe rather large file
change count. I took this opportunity to organize\r\nthe imports, too -
so a significant chunk of these files are simply\r\nimport
changes.\r\n3. This PR removes the controls Storybook and all related
mocks\r\n- Since the controls storybooks have been broken for awhile,
and since\r\nwe had plans to remove them but never got around to it, I
just decided\r\nto delete them as part of this PR and
close\r\nhttps://github.com//issues/176533 rather than
spending\r\ntime to fix the types for non-operational stories\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"5082eef2f1df8b6d7e9bb15d2221b9f4c67b00bf"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"#192017
Rebuild] [Controls] Remove non-React controls from `controls` plugin
(#192017)\n\nPart of
#192005
#176533
Summary\r\n\r\nThis PR represents the first major cleanup task for the
control group\r\nembeddable refactor. The tasks included in this PR can
be loosely\r\nsummarized as follows:\r\n1. This PR removes the old,
non-React version of controls \r\n- Note that the new controls are still
included under the\r\n`react_controls` folder - I will address this in a
follow up PR.\r\n2. This PR removes **all** types associated with the
old embeddable\r\nsystem; i.e. any `*input*` or `*output*` types.\r\n-
As part of cleaning up these types, some of the types included in
the\r\n`public/react_controls` folder had to be moved to `common` to
make them\r\navailable to server-side code.\r\n- This resulted in an...
unfortunate number of import changes 🫠 Hence\r\nthe rather large file
change count. I took this opportunity to organize\r\nthe imports, too -
so a significant chunk of these files are simply\r\nimport
changes.\r\n3. This PR removes the controls Storybook and all related
mocks\r\n- Since the controls storybooks have been broken for awhile,
and since\r\nwe had plans to remove them but never got around to it, I
just decided\r\nto delete them as part of this PR and
close\r\nhttps://github.com//issues/176533 rather than
spending\r\ntime to fix the types for non-operational stories\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"5082eef2f1df8b6d7e9bb15d2221b9f4c67b00bf"}}]}]
BACKPORT-->

Co-authored-by: Hannah Mudge <Heenawter@users.noreply.github.com>
markov00 pushed a commit to markov00/kibana that referenced this pull request Sep 18, 2024
…ols` plugin (elastic#192017)

Part of elastic#192005
Closes elastic#176533

## Summary

This PR represents the first major cleanup task for the control group
embeddable refactor. The tasks included in this PR can be loosely
summarized as follows:
1. This PR removes the old, non-React version of controls 
- Note that the new controls are still included under the
`react_controls` folder - I will address this in a follow up PR.
2. This PR removes **all** types associated with the old embeddable
system; i.e. any `*input*` or `*output*` types.
- As part of cleaning up these types, some of the types included in the
`public/react_controls` folder had to be moved to `common` to make them
available to server-side code.
- This resulted in an... unfortunate number of import changes 🫠 Hence
the rather large file change count. I took this opportunity to organize
the imports, too - so a significant chunk of these files are simply
import changes.
3. This PR removes the controls Storybook and all related mocks
- Since the controls storybooks have been broken for awhile, and since
we had plans to remove them but never got around to it, I just decided
to delete them as part of this PR and close
elastic#176533 rather than spending
time to fix the types for non-operational stories

### 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


### 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to the previous minor version (i.e. one version back from main) impact:critical This issue should be addressed immediately due to a critical level of impact on the product. project:embeddableRebuild release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Controls] Remove storybooks
9 participants