elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.73k stars 8.14k forks source link

[Fleet]: 1 count less is visible under Bulk actions when `Upgrade available` and `Select everything on all pages` filters are selected. #159976

Open amolnater-qasource opened 1 year ago

amolnater-qasource commented 1 year ago

Kibana Build details:

VERSION: 8.9.0 Snapshot
BUILD: 64199
COMMIT: c131f41fd4180429bfee6a9ce857dd8e3f093d94

Host OS and Browser version: All, All

Preconditions:

  1. 8.9.0 SNAPSHOT Kibana cloud environment should be available.
  2. 100-105 horde agents should be installed.

Steps to reproduce:

  1. Navigate to Fleet>Agents tab.
  2. Select Upgrade available and Select everything on all pages filters.
  3. Click bulk actions, observe 1 count less than actual count is visible.
  4. Trigger upgrade to any version and observe all the agents including hosted fleet server count is visible under Agent activity.

Expected: Accurate count should be visible under Bulk actions when Select everything on all pages and Upgrade available filter is selected.

Note:

Screen Recording:

https://github.com/elastic/kibana/assets/77374876/cc99785a-faf3-4735-9c4e-057c0cdf9ea7

elasticmachine commented 1 year ago

Pinging @elastic/fleet (Team:Fleet)

amolnater-qasource commented 1 year ago

@manishgupta-qasource Please review.

manishgupta-qasource commented 1 year ago

Secondary review for this ticket is Done

juliaElastic commented 1 year ago

I think this is the same issue as https://github.com/elastic/kibana/issues/145094, related to "Upgrade available" feature.

juliaElastic commented 1 year ago

Closing a duplicate of https://github.com/elastic/kibana/issues/145094

jillguyonnet commented 6 months ago

Reopening this as this is bug has persisted after https://github.com/elastic/kibana/pull/177035 was merged and backported.

This should be a quick fix: the agent count used in the Actions menu is calculated as: https://github.com/elastic/kibana/blob/b0348b0f50238801f90347cbdb9bb136081dc7e2/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx#L93-L96

The issue arises in bulk selection mode when managed agents are filtered out.

Steps to reproduce:

  1. Have a mix of healthy and inactive agents (at least 6 inactive agents) + one healthy fleet server (managed unselectable agent).
  2. Change status filter to only include inactive agents.
  3. Change pagination to 5 rows per page: you should have at least 2 pages.
  4. Select everything on all pages: the agent count in the Actions menu will be 1 less than it should be. It should, however, correctly apply actions to all agents.

Suggested fix: totalManagedAgentIds should respect filtering: https://github.com/elastic/kibana/blob/b0348b0f50238801f90347cbdb9bb136081dc7e2/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_fetch_agents_data.tsx#L226-L228