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

[Fleet] replace EuiFilterSelectItem with EuiSelectable #175101

Merged
merged 11 commits into from
Jan 23, 2024

Conversation

juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented Jan 18, 2024

Summary

Closes #162766

Replace deprecated EUI component.

Agent details: select log level

image

Agent details: select dataset

image

Agent status filter:
image

Agent list view:
Agent policy select:
image

Tags select:
image

Checklist

Delete any items that are not applicable to this PR.

@juliaElastic juliaElastic self-assigned this Jan 18, 2024
@juliaElastic
Copy link
Contributor Author

/ci

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

import { i18n } from '@kbn/i18n';
import type { DataViewField, FieldSpec } from '@kbn/data-views-plugin/public';

import { useStartServices } from '../../../../../hooks';

import { AGENT_LOG_INDEX_PATTERN, DATASET_FIELD, AGENT_DATASET } from './constants';

const StyledEuiSelectable = styled(EuiSelectable)`
width: 220px;
Copy link
Contributor Author

@juliaElastic juliaElastic Jan 18, 2024

Choose a reason for hiding this comment

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

I'm having trouble making the selectable options be as wide as the longest option automatically, added a workaround for a fixed width, I'm not sure if there is a better solution. Tried the different combinations of the truncate options: https://eui.elastic.co/#/forms/selectable#truncation

@breehall Hey, any suggestions? Previously with EuiFilterSelectItem the select expanded automatically, without truncating the options.
The textWrap: wrap option doesn't seem to do anything either.

Before:
image

After (without fixed width):
image

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 found a better approach by providing minWidth in listProps, it is still a hardcoded value, but fixes the styled-components issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@breehall Another UI issue I noticed is when scrolling down the page with a long list of agents with a EuiSelectable component open: the list of options is visible in front of the top banner.

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Using the minWidth prop works - another alternative is if you know for certain that your selectable content is fairly short, you can use custom width: fit-content; CSS instead. Overall, I think minWidth is a safer bet in case your content changes to something super long in the future that should be truncated.

when scrolling down the page with a long list of agents with a EuiSelectable component open: the list of options is visible in front of the top banner

If you know for certain your popover should sit below the sticky header/nav, you can customize this on your end with something like:

const { euiTheme } = useEuiTheme();

<EuiPopover zIndex={euiTheme.levels.header - 1}>

EUI defaults to showing popovers above headers for maximum visibility and because we can't know how the specific intention of end-popover-usages ahead of time. A couple of related issues discussing the difficulty/complexity of this topic: elastic/eui#4756, elastic/eui#4872

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the suggestions! I'll make the changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the change to move the Clear all button outside, it works much better:
image

The z-index change works fine too:
image

I tried the width: fit-content; option, but doesn't seem to make a difference with minWidth. When I remove minWidth, the options are not rendered at all. I think probably because the options are loaded async, and initially not there. I think it's fine to use minWidth only, so the long options get truncated.

@juliaElastic
Copy link
Contributor Author

/ci

@juliaElastic
Copy link
Contributor Author

/ci

@juliaElastic
Copy link
Contributor Author

/ci


const renderTagOption = (option: EuiSelectableOption<string>): ReactNode => {
const tag = option.label;
if (tag === CLEAR_ALL) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the Clear all functionality needs a lot of custom code, and still not perfect (icon disappears when clicking on it)
I'm wondering if we need at all, the list of tags are narrowed by the agents that match the selected tags, so it's not really possible to select that many tags at once
image

Copy link
Contributor

Choose a reason for hiding this comment

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

If a clear all button must be rendered, I would strongly suggest rendering it outside the EuiSelectable and not as an option. e.g. an <EuiButton size="s" /> or similar.

@juliaElastic
Copy link
Contributor Author

/ci

@juliaElastic juliaElastic marked this pull request as ready for review January 22, 2024 15:02
@juliaElastic juliaElastic requested a review from a team as a code owner January 22, 2024 15:02
@juliaElastic juliaElastic added the release_note:skip Skip the PR/issue when compiling release notes label Jan 22, 2024
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Jan 22, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@nchaulet nchaulet requested review from nchaulet and removed request for nchaulet January 22, 2024 19:59
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
fleet 959 961 +2

Async chunks

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

id before after diff
fleet 1.2MB 1.2MB +1.3KB

History

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

cc @juliaElastic

Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

New UI looks great - especially moving the clear button. 🚀

@juliaElastic juliaElastic merged commit f77542c into elastic:main Jan 23, 2024
21 checks passed
@kibanamachine kibanamachine added v8.13.0 backport:skip This commit does not require backporting labels Jan 23, 2024
@cee-chen
Copy link
Contributor

This looks terrific! Thanks for addressing EUI's comments/TODOs in Kibana - y'all are amazing!!! ❤️

CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Summary

Closes elastic#162766

Replace deprecated EUI component.

Agent details: select log level

<img width="1302" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/2ab0cd2c-38f3-4219-9ea2-62dfaa3a8e99">

Agent details: select dataset

<img width="1387" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/4187c274-e035-4831-9d9d-87c87a3ff9c3">

Agent status filter:
<img width="1251" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/15e226a2-cc10-4b43-881f-923fe03364f5">

Agent list view:
Agent policy select:
<img width="461" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/4f0f697c-af33-4934-92ef-e9a8e16bf1ed">

Tags select:
<img width="280" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/0be8719e-cf4b-4a1d-a4c6-c04090f72600">



### Checklist

Delete any items that are not applicable to this PR.

- [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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Replace deprecated EuiFilterSelectItem with EuiSelectable
7 participants