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

Fix various EuiFormControlLayout usages #192779

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

cee-chen
Copy link
Member

@cee-chen cee-chen commented Sep 12, 2024

Summary

This is a follow up to EUI's Emotion conversion of EuiFormControlLayout/Delimited (see #190752, elastic/eui#7954, and elastic/eui#7957).

Note

Please manually QA your team's affected form control(s) to confirm they still look and behave as expected and are non-broken. The EUI team is not familiar enough with each plugin's setups to pull down and QA this PR ourselves.

While QA testing the upgrade, I noticed a few incorrect usages of EuiFormControlLayout but wanted to wait until after the upgrade to push out fixes (to prevent delaying the PR further). In general, here is EUI's recommended usage of the component:

  • Where possible, simply don't use it. Almost all form controls are already automatically wrapped in any EuiFormControlLayout by default, and should accept a large majority of the props that the layout accepts.
  • If you must use it, set the controlOnly prop on the child input/control to avoid buggy styling (e.g. duplicate borders).
  • If you can't do either of the above for any reason (e.g. missing prop support), reach out to the EUI team to ask for your UX as a feature request!

Checklist

Delete any items that are not applicable to this PR.

…ly` props

- prevents duplicate borders and other buggy effects
- EuiDatePicker supports `prepend` now, so move the prop directly onto the component

- EuiDatePicker also supports being cleared via `onClear`, no need to add a control layout for that button
- the component already comes wrapped with EuiFormControlLayout by default, so we just need to move the props to the component itself
- the component already comes wrapped with EuiFormControlLayout by default, so we just need to move the props to the component itself
…s + fix empty label

- should be using `hasEmptyLabelSpace` prop instead of a space

- form controls already come wrapped with EuiFormControlLayout by default, so we just need to move the props to the component itself
…apper

- field search components already support being cleared by default

- we need to move the onClear logic to the callbacks instead
@cee-chen cee-chen marked this pull request as ready for review September 13, 2024 00:03
@cee-chen cee-chen requested review from a team as code owners September 13, 2024 00:03
@elasticmachine
Copy link
Contributor

Pinging @elastic/eui-team (EUI)

Copy link
Contributor

@yngrdyn yngrdyn left a comment

Choose a reason for hiding this comment

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

LGTM

@botelastic botelastic bot added ci:project-deploy-observability Create an Observability project Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:obs-ux-management Observability Management User Experience Team labels Sep 13, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

Copy link
Contributor

@adcoelho adcoelho left a comment

Choose a reason for hiding this comment

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

Tested the triggers_actions_ui changed and everything still works as expected 👍

Approved for response-ops

@Heenawter Heenawter self-requested a review September 13, 2024 14:01
Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

Book example embeddable + maps custom icon picker changes LGTM. Code review + tested locally to ensure that the HTML looks as expected - verified that the Maps EuiFieldText component is no longer wrapped in a double EuiFormControlLayout

Copy link
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jeramysoucy jeramysoucy Sep 13, 2024

Choose a reason for hiding this comment

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

This does not look like it is working as expected. The copy icon button is no longer rendering and it's missing the drop-down.

This PR:
Screenshot 2024-09-13 at 6 05 36 PM

Main:
Screenshot 2024-09-13 at 6 13 27 PM

Copy link
Member Author

@cee-chen cee-chen Sep 13, 2024

Choose a reason for hiding this comment

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

Let me know if this is working now with the latest commit! Thank you so much for catching this! 🙇

Copy link
Contributor

Choose a reason for hiding this comment

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

The format drop-down and copy button now appear. The copy button is working, but the format selector is a bit strange. When "Encoded" is selected, it is highlighted in the list, but when "Beats" is selected, "Logstash" is highlighted in the list. When "Logstash" is selected, nothing is highlighted in the list. The format of the key for Beats and Logstash are identical, not sure if that is correct.

I have confirmed the exact same behavior in Main, so I will approve. Not sure if this is an issue with our code or the EUI components. I'll open an issue to look more closely.

Copy link
Contributor

Choose a reason for hiding this comment

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

Issue: #193127

Copy link
Member Author

Choose a reason for hiding this comment

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

I poked into this a bit locally and was able to fix the issue! Thankfully just a small oneliner. 661273c

Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

SCSS check

Copy link
Contributor

@dominiqueclarke dominiqueclarke left a comment

Choose a reason for hiding this comment

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

Obs ux management changes LGTM

Copy link
Contributor

@szwarckonrad szwarckonrad left a comment

Choose a reason for hiding this comment

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

DW changes introduce regressions in functionality.

main

Screen.Recording.2024-09-17.at.10.02.37.mov

cee-chen:eui-form-layout-fixes

Screen.Recording.2024-09-17.at.09.53.12.mov

Copy link
Contributor

@jeramysoucy jeramysoucy left a comment

Choose a reason for hiding this comment

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

Kibana security changes LGTM!

Copy link
Contributor

Choose a reason for hiding this comment

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

The format drop-down and copy button now appear. The copy button is working, but the format selector is a bit strange. When "Encoded" is selected, it is highlighted in the list, but when "Beats" is selected, "Logstash" is highlighted in the list. When "Logstash" is selected, nothing is highlighted in the list. The format of the key for Beats and Logstash are identical, not sure if that is correct.

I have confirmed the exact same behavior in Main, so I will approve. Not sure if this is an issue with our code or the EUI components. I'll open an issue to look more closely.

Copy link
Contributor

@rylnd rylnd left a comment

Choose a reason for hiding this comment

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

@cee-chen the Detection Engine changes look to be equivalent to main for ScheduleItem, (which doesn't look correct to me, but I think that's a separate issue:

Screenshot 2024-09-17 at 10 25 54 PM

), I'm seeing the following differences in DurationInput :

  1. Extra border where previously there was none:
    Screenshot 2024-09-17 at 10 30 19 PM
  2. Disabling the input leads to an even more drastic change relative to the container:
    before: Screenshot 2024-09-17 at 10 40 40 PM
    after: Screenshot 2024-09-17 at 10 30 14 PM

I'd be happy to pair if you need help here, please reach out on Slack.

- `searchValue` state is a step behind the search value string passed by EUI, so use that value instead to ensure we're not proceeding with `onSearch` split logic
- a lot of this can be cleaned up

- `!important`s aren't ideal but are the fastest way forward here
@cee-chen
Copy link
Member Author

cee-chen commented Sep 18, 2024

@szwarckonrad @rylnd Thank you both for the thorough QA and help with repro steps! I should have fixed both behaviors, but please let me know if not!

Security defend workflows:

(ignore the lastpass autofill at the end, that's my browser/extension 😅)

Security detection engine:

`* 2` index is unnecessary, EuiContextMenuPanel accounts for non-interactive elements
Copy link
Contributor

@rylnd rylnd left a comment

Choose a reason for hiding this comment

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

@cee-chen thank you so much for fixing those issues. The Detection Engine changes look great!

@kibana-ci
Copy link
Collaborator

kibana-ci commented Sep 18, 2024

💚 Build Succeeded

  • Buildkite Build
  • Commit: 661273c
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-192779-661273c3e548

Metrics [docs]

Async chunks

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

id before after diff
apm 3.5MB 3.5MB +15.0B
enterpriseSearch 2.6MB 2.6MB +15.0B
eventAnnotationListing 227.1KB 226.8KB -317.0B
infra 1.6MB 1.6MB -156.0B
lens 1.5MB 1.5MB -317.0B
maps 3.0MB 3.0MB -118.0B
observability 463.7KB 463.6KB -116.0B
profiling 405.9KB 405.8KB -110.0B
security 589.3KB 589.2KB -105.0B
securitySolution 20.4MB 20.4MB -911.0B
serverlessSearch 326.9KB 326.8KB -105.0B
synthetics 964.1KB 964.1KB +30.0B
triggersActionsUi 1.6MB 1.6MB -74.0B
total -2.2KB

History

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

Copy link
Contributor

@szwarckonrad szwarckonrad left a comment

Choose a reason for hiding this comment

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

No regression spotted with the latest changes. Thank you for addressing these! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:review ci:project-deploy-observability Create an Observability project EUI release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:obs-ux-management Observability Management User Experience Team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.