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

[8.11] [Fleet] Replace dataviews suggestions in KQL searchboxes with internal ones (#172190) #172437

Merged
merged 3 commits into from
Dec 4, 2023

Conversation

criamico
Copy link
Contributor

@criamico criamico commented Dec 4, 2023

Backport

This will backport the following commits from main to 8.11:

Questions ?

Please refer to the Backport tool documentation

…l ones (elastic#172190)

Fixes elastic#169760
Related to elastic#171425

## Summary

[Fleet] Replace dataviews suggestions in KQL searchboxes with internal
ones. Now using Fleet mappings to create the suggestions fields instead
of fetching them through dataView plugin.
This is done for two reasons:

- Solves [permission
problems](elastic#169760) when the user
doesn't have privileges to read Fleet indices
- Allows us to search only those mappings that we want to expose,
instead of all of them

Only weird thing is that the [querystring
component](https://github.com/elastic/kibana/blob/1f8c816901fa286b842ac652b0fce86608d01202/src/plugins/unified_search/public/query_string_input/query_string_input.tsx#L161)
has a cap to show max 50 suggestions. Since for agents suggestions we
are showing some more fields, so the ones starting with `u` are not
visible anymore. I though I had a bug in the way I was creating the
`fieldsMap` but in reality there's no way to show more suggestions than
50 (without touching the original component, which I would gladly
avoid).

### Screenshots
There should be no visible difference with the current suggestions.
<details>
  <summary>Agents</summary>

![Screenshot 2023-12-01 at 10 49
55](https://github.com/elastic/kibana/assets/16084106/af73476c-3de2-40c1-93fc-c6a1c28a8a8a)

![Screenshot 2023-12-01 at 10 49
48](https://github.com/elastic/kibana/assets/16084106/5db8b30f-ff9e-4542-a590-f77285dbeef6)

</details>

<details>
  <summary>Agent policies</summary>

![Screenshot 2023-12-01 at 10 50
09](https://github.com/elastic/kibana/assets/16084106/69756149-6769-48a9-9a34-de482e4e37fc)

</details>

<details>
  <summary>Enrollment keys</summary>

![Screenshot 2023-12-01 at 10 50
18](https://github.com/elastic/kibana/assets/16084106/e542550a-9721-4f5c-a05b-32829dd8fcee)

</details>

### Testing
1. With a normal user, navigate to the "agents", "agent policies" and
"enrollment keys" tabs and click on the searchboxes. The suggestions
should be visible as normal
2. Create a user with role Fleet "all", Integrations "all". Log in and
check the above searchboxes, the suggestions should be visible as
normal. Previously they weren't.

### Checklist
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))

---------

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit ad66313)

# Conflicts:
#	x-pack/plugins/fleet/common/constants/mappings.ts
@criamico criamico enabled auto-merge (squash) December 4, 2023 09:21
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Dec 4, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@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!)

@criamico
Copy link
Contributor Author

criamico commented Dec 4, 2023

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

kibana-ci commented Dec 4, 2023

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #12 / console app misc console behavior keyboard shortcuts should open documentation when Ctrl+/ is pressed

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
fleet 939 940 +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 1.2MB 1.2MB +403.0B

Page load bundle

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

id before after diff
fleet 147.0KB 150.4KB +3.4KB

History

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

@criamico criamico merged commit 1258c38 into elastic:8.11 Dec 4, 2023
20 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants