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] Add "Label" column + filter to Agent list table #131070

Merged

Conversation

kpollich
Copy link
Member

@kpollich kpollich commented Apr 27, 2022

Summary

Resolves #130713
Resolves #130717

Finalized implementation blocked by elastic/fleet-server#1350

Adds a baseline implementation for listing tags stored in .fleet-agents documents in the Agent listing UI and filtering based on tags.

Generating Test Data

You'll need to create a user with the system indices superuser role, then you can add some sample tags to your agents via Kibana dev tools, e.g.

# Search for your agents and grab their `_id` values to use below
GET .fleet-agents/_search

POST .fleet-agents/_update/{agent_id}
{
  "doc": {
    # Add whatever tags you want here to test
    "tags": ["fleet-server", "docker", "test"]
  }
}

Screenshots

Example values:

image

Tooltip when hovering truncated list of tags:

image

KQL autocompletion support:

image

Screen recording demonstrating filtering behavior:

Screen.Recording.2022-05-09.at.8.54.44.AM.mov

@kpollich kpollich added release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v8.3.0 labels Apr 27, 2022
@kpollich kpollich self-assigned this Apr 27, 2022
@kpollich
Copy link
Member Author

@elasticmachine merge upstream

@ph
Copy link
Contributor

ph commented Apr 27, 2022

@nimarezainia @narph What is the correct naming to use here, I see label in the UI and tags in the Elastic Agent side?

@kpollich
Copy link
Member Author

What is the correct naming to use here, I see label in the UI and tags in the Elastic Agent side?

Figma designs call for Label, but I agree that there is a need for consistency here. Especially if this data is eventually exposed via Fleet's APIs.

@kpollich
Copy link
Member Author

I did some setup preparing for filtering by tags in c43d60c. This is blocked by the Fleet Server work though, since we can't filter on tags until the field is defined in the .fleet-agents index's mappings.

I've also elected to rename Labels to Tags in the UI for consistency, based on @ph 's comment above.

@kpollich kpollich changed the title [Fleet] Add "Label" column to Agent list table [Fleet] Add "Label" column + filter to Agent list table Apr 28, 2022
@narph
Copy link
Contributor

narph commented Apr 28, 2022

@nimarezainia @narph What is the correct naming to use here, I see label in the UI and tags in the Elastic Agent side?

I think we should keep some consistency on both sides , as decided in elastic/elastic-agent#149 (comment) which is tags.

@kpollich kpollich marked this pull request as ready for review May 9, 2022 12:59
@kpollich kpollich requested a review from a team as a code owner May 9, 2022 12:59
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@juliaElastic
Copy link
Contributor

looks great! some unit tests would be nice.
have you tested that the filtering works well with pagination?

@kpollich
Copy link
Member Author

kpollich commented May 9, 2022

looks great! some unit tests would be nice. have you tested that the filtering works well with pagination?

Adding UI tests for the entire table seems like it might be a difficult undertaking to include along with this PR, but I did add some basic tests for the <Tags /> component to assert on the truncation/tooltip logic.

Here's the filtering working with pagination:

Screen.Recording.2022-05-09.at.10.03.42.AM.mov

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

Tested locally and it looks good to me 🚀

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

🚀

@kpollich kpollich enabled auto-merge (squash) May 9, 2022 14:48
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
fleet 619 620 +1

Async chunks

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

id before after diff
fleet 702.4KB 704.1KB +1.7KB
Unknown metric groups

API count

id before after diff
fleet 1393 1394 +1

History

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

cc @kpollich

@kpollich kpollich merged commit bbe80fe into elastic:main May 9, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 9, 2022
@kpollich kpollich deleted the 130713-add-labels-to-agent-listing-ui branch May 9, 2022 15:27
kertal pushed a commit to kertal/kibana that referenced this pull request May 24, 2022
* Add basic labels implementation for Agent list table

* Lay plumbing for filtering based on tags

Ref elastic#130717

* Finalize wiring up tags to API

* Fix render error when tags empty

* Add test for tags component

Co-authored-by: Kibana Machine <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:skip This commit does not require backporting release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet UI] Allow filtering by labels in the Agent listing UI [Fleet UI] Add labels to Agent listing UI
8 participants