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] Fix incorrect count of agents in bulk actions #175318

Merged
merged 8 commits into from
Jan 25, 2024

Conversation

criamico
Copy link
Contributor

@criamico criamico commented Jan 23, 2024

Fixes #171914

Summary

Fix a small issue occurring when there are inactive agents, both regular and managed.

Another PR with some refactoring for this component will follow.

Repro steps

  • Enroll fleet server on fleet-server-policy - make sure to have two inactive fleet server agents on this policy as well
  • Enroll ~20 agents with horde and make them inactive
  • Make fleet server policy "managed"
  • Select "inactive" in the status filter
  • Click on "Select agents on all pages"
  • The bulk actions shouldn't report negative actions. If the count is 0, the actions will appear disabled

Before

Screenshot 2024-01-22 at 15 59 42

After

Screenshot 2024-01-24 at 15 53 53

Checklist

@criamico criamico self-assigned this Jan 23, 2024
@criamico criamico added the Team:Fleet Team label for Observability Data Collection Fleet team label Jan 23, 2024
@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

/ci

@criamico criamico force-pushed the 171914_fix_inactive_count branch from 616245c to 322e6c3 Compare January 24, 2024 14:02
@criamico
Copy link
Contributor Author

@elasticmachine merge upstream

@criamico criamico added release_note:fix v8.13.0 backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Jan 24, 2024
@criamico criamico marked this pull request as ready for review January 24, 2024 14:55
@criamico criamico requested a review from a team as a code owner January 24, 2024 14:55
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@criamico criamico requested a review from jillguyonnet January 24, 2024 14:56
@juliaElastic
Copy link
Contributor

Looks good, great to see the tests. Added some small suggestions.

@criamico criamico added QA:Needs Validation Issue needs to be validated by QA and removed QA:Needs Validation Issue needs to be validated by QA labels Jan 24, 2024
@criamico
Copy link
Contributor Author

@elasticmachine merge upstream

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.

LGTM

@criamico
Copy link
Contributor Author

@elasticmachine merge upstream

@criamico
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

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
fleet 1.2MB 1.2MB +244.0B

History

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

cc @criamico

@criamico criamico merged commit f2fb3ee into elastic:main Jan 25, 2024
20 checks passed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 25, 2024
Fixes elastic#171914

## Summary
Fix a small issue occurring when there are inactive agents, both regular
and managed.

Another PR with some refactoring for this component will follow.

### Repro steps

- Enroll fleet server on fleet-server-policy - make sure to have two
inactive fleet server agents on this policy as well
- Enroll ~20 agents with horde and make them inactive
- Make fleet server policy "managed"
- Select "inactive" in the status filter
- Click on "Select agents on all pages"
- The bulk actions shouldn't report negative actions. If the count is 0,
the actions will appear disabled

#### Before
![Screenshot 2024-01-22 at 15 59
42](https://github.com/elastic/kibana/assets/16084106/cb8c6c80-b23f-4415-af2a-b4de8ae387f6)

#### After
![Screenshot 2024-01-24 at 15 53
53](https://github.com/elastic/kibana/assets/16084106/6b020016-6171-43d7-bc12-685bf01b7989)

### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit f2fb3ee)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.12

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jan 25, 2024
#175527)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Fleet] Fix incorrect count of agents in bulk actions
(#175318)](#175318)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cristina
Amico","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-01-25T11:29:25Z","message":"[Fleet]
Fix incorrect count of agents in bulk actions (#175318)\n\nFixes
https://github.com/elastic/kibana/issues/171914\r\n\r\n## Summary\r\nFix
a small issue occurring when there are inactive agents, both
regular\r\nand managed.\r\n\r\nAnother PR with some refactoring for this
component will follow.\r\n\r\n### Repro steps\r\n\r\n- Enroll fleet
server on fleet-server-policy - make sure to have two\r\ninactive fleet
server agents on this policy as well\r\n- Enroll ~20 agents with horde
and make them inactive\r\n- Make fleet server policy \"managed\"\r\n-
Select \"inactive\" in the status filter\r\n- Click on \"Select agents
on all pages\"\r\n- The bulk actions shouldn't report negative actions.
If the count is 0,\r\nthe actions will appear disabled\r\n\r\n####
Before\r\n![Screenshot 2024-01-22 at 15
59\r\n42](https://github.com/elastic/kibana/assets/16084106/cb8c6c80-b23f-4415-af2a-b4de8ae387f6)\r\n\r\n####
After\r\n![Screenshot 2024-01-24 at 15
53\r\n53](https://github.com/elastic/kibana/assets/16084106/6b020016-6171-43d7-bc12-685bf01b7989)\r\n\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<[email protected]>","sha":"f2fb3ee768f62aca11a6b3adae0514e1b1f56fcd","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Fleet","backport:prev-minor","v8.13.0"],"title":"[Fleet]
Fix incorrect count of agents in bulk
actions","number":175318,"url":"https://github.com/elastic/kibana/pull/175318","mergeCommit":{"message":"[Fleet]
Fix incorrect count of agents in bulk actions (#175318)\n\nFixes
https://github.com/elastic/kibana/issues/171914\r\n\r\n## Summary\r\nFix
a small issue occurring when there are inactive agents, both
regular\r\nand managed.\r\n\r\nAnother PR with some refactoring for this
component will follow.\r\n\r\n### Repro steps\r\n\r\n- Enroll fleet
server on fleet-server-policy - make sure to have two\r\ninactive fleet
server agents on this policy as well\r\n- Enroll ~20 agents with horde
and make them inactive\r\n- Make fleet server policy \"managed\"\r\n-
Select \"inactive\" in the status filter\r\n- Click on \"Select agents
on all pages\"\r\n- The bulk actions shouldn't report negative actions.
If the count is 0,\r\nthe actions will appear disabled\r\n\r\n####
Before\r\n![Screenshot 2024-01-22 at 15
59\r\n42](https://github.com/elastic/kibana/assets/16084106/cb8c6c80-b23f-4415-af2a-b4de8ae387f6)\r\n\r\n####
After\r\n![Screenshot 2024-01-24 at 15
53\r\n53](https://github.com/elastic/kibana/assets/16084106/6b020016-6171-43d7-bc12-685bf01b7989)\r\n\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<[email protected]>","sha":"f2fb3ee768f62aca11a6b3adae0514e1b1f56fcd"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/175318","number":175318,"mergeCommit":{"message":"[Fleet]
Fix incorrect count of agents in bulk actions (#175318)\n\nFixes
https://github.com/elastic/kibana/issues/171914\r\n\r\n## Summary\r\nFix
a small issue occurring when there are inactive agents, both
regular\r\nand managed.\r\n\r\nAnother PR with some refactoring for this
component will follow.\r\n\r\n### Repro steps\r\n\r\n- Enroll fleet
server on fleet-server-policy - make sure to have two\r\ninactive fleet
server agents on this policy as well\r\n- Enroll ~20 agents with horde
and make them inactive\r\n- Make fleet server policy \"managed\"\r\n-
Select \"inactive\" in the status filter\r\n- Click on \"Select agents
on all pages\"\r\n- The bulk actions shouldn't report negative actions.
If the count is 0,\r\nthe actions will appear disabled\r\n\r\n####
Before\r\n![Screenshot 2024-01-22 at 15
59\r\n42](https://github.com/elastic/kibana/assets/16084106/cb8c6c80-b23f-4415-af2a-b4de8ae387f6)\r\n\r\n####
After\r\n![Screenshot 2024-01-24 at 15
53\r\n53](https://github.com/elastic/kibana/assets/16084106/6b020016-6171-43d7-bc12-685bf01b7989)\r\n\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<[email protected]>","sha":"f2fb3ee768f62aca11a6b3adae0514e1b1f56fcd"}}]}]
BACKPORT-->

Co-authored-by: Cristina Amico <[email protected]>
criamico added a commit that referenced this pull request Jan 29, 2024
Closes #131153
Follow up of #175318

## Summary
Extract the main logic for agentList component in a separate hook.


### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: Kibana Machine <[email protected]>
criamico added a commit that referenced this pull request Feb 8, 2024
Patch for #171914

## Summary
In #175318 I had disabled the bulk
actions when the count was incorrect (negative). This was not a good
idea, since some of those actions could still be applied (like
unenrolling) even if the shown count is not correct. Here I'm removing
that check.



### 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

Co-authored-by: Kibana Machine <[email protected]>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 8, 2024
Patch for elastic#171914

## Summary
In elastic#175318 I had disabled the bulk
actions when the count was incorrect (negative). This was not a good
idea, since some of those actions could still be applied (like
unenrolling) even if the shown count is not correct. Here I'm removing
that check.

### 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

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit b620110)
kibanamachine added a commit that referenced this pull request Feb 8, 2024
…176512)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Fleet] Allow back previously disabled bulk actions
(#176485)](#176485)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cristina
Amico","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-02-08T14:59:23Z","message":"[Fleet]
Allow back previously disabled bulk actions (#176485)\n\nPatch for
https://github.com/elastic/kibana/issues/171914\r\n\r\n## Summary\r\nIn
#175318 I had disabled the
bulk\r\nactions when the count was incorrect (negative). This was not a
good\r\nidea, since some of those actions could still be applied
(like\r\nunenrolling) even if the shown count is not correct. Here I'm
removing\r\nthat check.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"b62011026850bf968a90c403cae11c453c4e9130","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","v8.13.0"],"title":"[Fleet]
Allow back previously disabled bulk
actions","number":176485,"url":"https://github.com/elastic/kibana/pull/176485","mergeCommit":{"message":"[Fleet]
Allow back previously disabled bulk actions (#176485)\n\nPatch for
https://github.com/elastic/kibana/issues/171914\r\n\r\n## Summary\r\nIn
#175318 I had disabled the
bulk\r\nactions when the count was incorrect (negative). This was not a
good\r\nidea, since some of those actions could still be applied
(like\r\nunenrolling) even if the shown count is not correct. Here I'm
removing\r\nthat check.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"b62011026850bf968a90c403cae11c453c4e9130"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/176485","number":176485,"mergeCommit":{"message":"[Fleet]
Allow back previously disabled bulk actions (#176485)\n\nPatch for
https://github.com/elastic/kibana/issues/171914\r\n\r\n## Summary\r\nIn
#175318 I had disabled the
bulk\r\nactions when the count was incorrect (negative). This was not a
good\r\nidea, since some of those actions could still be applied
(like\r\nunenrolling) even if the shown count is not correct. Here I'm
removing\r\nthat check.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"b62011026850bf968a90c403cae11c453c4e9130"}}]}]
BACKPORT-->

Co-authored-by: Cristina Amico <[email protected]>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
Fixes elastic#171914

## Summary
Fix a small issue occurring when there are inactive agents, both regular
and managed.

Another PR with some refactoring for this component will follow.

### Repro steps

- Enroll fleet server on fleet-server-policy - make sure to have two
inactive fleet server agents on this policy as well
- Enroll ~20 agents with horde and make them inactive
- Make fleet server policy "managed"
- Select "inactive" in the status filter
- Click on "Select agents on all pages"
- The bulk actions shouldn't report negative actions. If the count is 0,
the actions will appear disabled

#### Before
![Screenshot 2024-01-22 at 15 59
42](https://github.com/elastic/kibana/assets/16084106/cb8c6c80-b23f-4415-af2a-b4de8ae387f6)

#### After
![Screenshot 2024-01-24 at 15 53
53](https://github.com/elastic/kibana/assets/16084106/6b020016-6171-43d7-bc12-685bf01b7989)


### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: Kibana Machine <[email protected]>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
Closes elastic#131153
Follow up of elastic#175318

## Summary
Extract the main logic for agentList component in a separate hook.


### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: Kibana Machine <[email protected]>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
Patch for elastic#171914

## Summary
In elastic#175318 I had disabled the bulk
actions when the count was incorrect (negative). This was not a good
idea, since some of those actions could still be applied (like
unenrolling) even if the shown count is not correct. Here I'm removing
that check.



### 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

Co-authored-by: Kibana Machine <[email protected]>
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
Closes elastic#131153
Follow up of elastic#175318

## Summary
Extract the main logic for agentList component in a separate hook.


### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: Kibana Machine <[email protected]>
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
Patch for elastic#171914

## Summary
In elastic#175318 I had disabled the bulk
actions when the count was incorrect (negative). This was not a good
idea, since some of those actions could still be applied (like
unenrolling) even if the shown count is not correct. Here I'm removing
that check.



### 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

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) release_note:fix Team:Fleet Team label for Observability Data Collection Fleet team v8.12.1 v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet]: Inactive agents count gets incorrect when everything on all pages is selected.
6 participants