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][Cloud] Enrollment token table may show an empty last page #167663

Open
gergoabraham opened this issue Sep 29, 2023 · 9 comments · Fixed by #188049
Open

[Fleet][Cloud] Enrollment token table may show an empty last page #167663

gergoabraham opened this issue Sep 29, 2023 · 9 comments · Fixed by #188049
Labels
bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@gergoabraham
Copy link
Contributor

Kibana version: v8.11 (main) cloud deployment

Describe the bug: managed policies are hidden from the Enrollment token table, but this filtering is done on frontend side, this makes the received total value invalid. Because of this, if there is pageSize * n number of other enrollment tokens, the total will be pageSize * n + 1 including the Cloud agent policy token, therefore the table will show an additional, empty page.

Steps to reproduce:

  1. Have a cloud deployment
  2. Open Fleet / Enrollment tokens
  3. Change page size to 5
  4. Add enrollment tokens, so there will be 5 tokens

Expected behavior: there is only one page, not two

Screenshots (if relevant):
enrollment

@gergoabraham gergoabraham added bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team labels Sep 29, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@jen-huang jen-huang added the good first issue low hanging fruit label Nov 8, 2023
@ArchitGajjar
Copy link

Hi @jen-huang - can you please assign this to me ? this will be my first contribution into Kibana :)
Thank you!

@pra2107tham
Copy link
Contributor

Hii, I would like to start my open source contribution by solving this issue. Can anyone assign me to it?

@jen-huang jen-huang assigned pra2107tham and unassigned ArchitGajjar Jul 9, 2024
@jen-huang
Copy link
Contributor

@pra2107tham Assigned you. Thanks and let us know if you have any questions.

@pra2107tham
Copy link
Contributor

pra2107tham commented Jul 9, 2024

@jen-huang from what I can understand from this issue, i can think of 2 ways to solve (correct me if I'm wrong) :
The extra cloud policy token which is getting added into the number of tokens if making that new empty page right? I have to just make sure the total number of tokens doesnt include that extra one token?
I dont know what and how to do this. If you can guide me personally it would be great help

@jen-huang
Copy link
Contributor

The extra cloud policy token which is getting added into the number of tokens if making that new empty page right? I have to just make sure the total number of tokens doesnt include that extra one token?

Yes, I think this is accurate. You can see the total calculation and the filtering on agent policies on these lines:

const total = enrollmentAPIKeysRequest?.data?.total ?? 0;
const rowItems =
enrollmentAPIKeysRequest?.data?.items.filter((enrollmentKey) => {
if (!agentPolicies.length || !enrollmentKey.policy_id) return false;
const agentPolicy = agentPoliciesById[enrollmentKey.policy_id];
return !agentPolicy?.is_managed;
}) || [];

Probably total should be replaced to use the length of rowItems.

@pra2107tham
Copy link
Contributor

I accidentally made 6 tokens and they r not going back, i uninstalled them but it still stays in the list? how can i reset the tokens in my local server

juliaElastic pushed a commit that referenced this issue Jul 11, 2024
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Jul 11, 2024
…stic#167663 (elastic#188049)

Fixes elastic#167663

## Summary

Fixes the creation of extra empty page at pagination of 5 rows

### Video

https://github.com/elastic/kibana/assets/140709379/cdac6a22-f239-4b70-b40c-93fc727418a6

Co-authored-by: Julien Lind <[email protected]>
(cherry picked from commit 1f7fdfd)
kibanamachine added a commit that referenced this issue Jul 11, 2024
…age #167663 (#188049) (#188127)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[Fleet][Cloud] Enrollment token table may show an empty last page
#167663 (#188049)](#188049)

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

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

<!--BACKPORT [{"author":{"name":"Pratham
Shirbhate","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-07-11T09:15:54Z","message":"[Fleet][Cloud]
Enrollment token table may show an empty last page #167663
(#188049)\n\nFixes #167663 \r\n\r\n## Summary\r\n\r\nFixes the creation
of extra empty page at pagination of 5 rows\r\n\r\n\r\n### Video
\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/140709379/cdac6a22-f239-4b70-b40c-93fc727418a6\r\n\r\nCo-authored-by:
Julien Lind
<[email protected]>","sha":"1f7fdfdfe428525b08bf14321463d091bdad4c79","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","💝community","Team:Fleet","backport:prev-minor","v8.15.0","v8.16.0"],"title":"[Fleet][Cloud]
Enrollment token table may show an empty last page
#167663","number":188049,"url":"https://github.com/elastic/kibana/pull/188049","mergeCommit":{"message":"[Fleet][Cloud]
Enrollment token table may show an empty last page #167663
(#188049)\n\nFixes #167663 \r\n\r\n## Summary\r\n\r\nFixes the creation
of extra empty page at pagination of 5 rows\r\n\r\n\r\n### Video
\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/140709379/cdac6a22-f239-4b70-b40c-93fc727418a6\r\n\r\nCo-authored-by:
Julien Lind
<[email protected]>","sha":"1f7fdfdfe428525b08bf14321463d091bdad4c79"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/188049","number":188049,"mergeCommit":{"message":"[Fleet][Cloud]
Enrollment token table may show an empty last page #167663
(#188049)\n\nFixes #167663 \r\n\r\n## Summary\r\n\r\nFixes the creation
of extra empty page at pagination of 5 rows\r\n\r\n\r\n### Video
\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/140709379/cdac6a22-f239-4b70-b40c-93fc727418a6\r\n\r\nCo-authored-by:
Julien Lind
<[email protected]>","sha":"1f7fdfdfe428525b08bf14321463d091bdad4c79"}}]}]
BACKPORT-->

Co-authored-by: Pratham Shirbhate <[email protected]>
jen-huang added a commit to jen-huang/kibana that referenced this issue Sep 27, 2024
@jen-huang
Copy link
Contributor

The previous work will be reverted in #194343 so I'm reopening this. That approach broke pagination in general so this will need to be fixed in a different way.

@jen-huang jen-huang reopened this Sep 27, 2024
jen-huang added a commit that referenced this issue Sep 30, 2024
…page #167663 (#188049)" (#194343)

## Summary

Resolves #194339.

This PR reverts #188049 as it inadvertently broke pagination of the
enrollment tokens page. This means that #167663 will need to be
re-opened and fixed in a different way.
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Sep 30, 2024
…page elastic#167663 (elastic#188049)" (elastic#194343)

## Summary

Resolves elastic#194339.

This PR reverts elastic#188049 as it inadvertently broke pagination of the
enrollment tokens page. This means that elastic#167663 will need to be
re-opened and fixed in a different way.

(cherry picked from commit 283f6e6)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Sep 30, 2024
…page elastic#167663 (elastic#188049)" (elastic#194343)

## Summary

Resolves elastic#194339.

This PR reverts elastic#188049 as it inadvertently broke pagination of the
enrollment tokens page. This means that elastic#167663 will need to be
re-opened and fixed in a different way.

(cherry picked from commit 283f6e6)
kibanamachine added a commit that referenced this issue Sep 30, 2024
…empty last page #167663 (#188049)&quot; (#194343) (#194480)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Revert &quot;[Fleet][Cloud] Enrollment token table may show an empty
last page #167663 (#188049)&quot;
(#194343)](#194343)

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

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

<!--BACKPORT [{"author":{"name":"Jen
Huang","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-30T19:35:13Z","message":"Revert
\"[Fleet][Cloud] Enrollment token table may show an empty last page
#167663 (#188049)\" (#194343)\n\n## Summary\r\n\r\nResolves
#194339.\r\n\r\nThis PR reverts #188049 as it inadvertently broke
pagination of the\r\nenrollment tokens page. This means that #167663
will need to be\r\nre-opened and fixed in a different
way.","sha":"283f6e64c9656c97fa37be34f3e6fab2e8ad459f","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","backport:prev-major"],"title":"Revert
\"[Fleet][Cloud] Enrollment token table may show an empty last page
#167663
(#188049)\"","number":194343,"url":"https://github.com/elastic/kibana/pull/194343","mergeCommit":{"message":"Revert
\"[Fleet][Cloud] Enrollment token table may show an empty last page
#167663 (#188049)\" (#194343)\n\n## Summary\r\n\r\nResolves
#194339.\r\n\r\nThis PR reverts #188049 as it inadvertently broke
pagination of the\r\nenrollment tokens page. This means that #167663
will need to be\r\nre-opened and fixed in a different
way.","sha":"283f6e64c9656c97fa37be34f3e6fab2e8ad459f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194343","number":194343,"mergeCommit":{"message":"Revert
\"[Fleet][Cloud] Enrollment token table may show an empty last page
#167663 (#188049)\" (#194343)\n\n## Summary\r\n\r\nResolves
#194339.\r\n\r\nThis PR reverts #188049 as it inadvertently broke
pagination of the\r\nenrollment tokens page. This means that #167663
will need to be\r\nre-opened and fixed in a different
way.","sha":"283f6e64c9656c97fa37be34f3e6fab2e8ad459f"}}]}] BACKPORT-->

Co-authored-by: Jen Huang <[email protected]>
kibanamachine added a commit that referenced this issue Sep 30, 2024
… empty last page #167663 (#188049)&quot; (#194343) (#194479)

# Backport

This will backport the following commits from `main` to `8.15`:
- [Revert &quot;[Fleet][Cloud] Enrollment token table may show an empty
last page #167663 (#188049)&quot;
(#194343)](#194343)

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

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

<!--BACKPORT [{"author":{"name":"Jen
Huang","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-30T19:35:13Z","message":"Revert
\"[Fleet][Cloud] Enrollment token table may show an empty last page
#167663 (#188049)\" (#194343)\n\n## Summary\r\n\r\nResolves
#194339.\r\n\r\nThis PR reverts #188049 as it inadvertently broke
pagination of the\r\nenrollment tokens page. This means that #167663
will need to be\r\nre-opened and fixed in a different
way.","sha":"283f6e64c9656c97fa37be34f3e6fab2e8ad459f","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","backport:prev-major"],"title":"Revert
\"[Fleet][Cloud] Enrollment token table may show an empty last page
#167663
(#188049)\"","number":194343,"url":"https://github.com/elastic/kibana/pull/194343","mergeCommit":{"message":"Revert
\"[Fleet][Cloud] Enrollment token table may show an empty last page
#167663 (#188049)\" (#194343)\n\n## Summary\r\n\r\nResolves
#194339.\r\n\r\nThis PR reverts #188049 as it inadvertently broke
pagination of the\r\nenrollment tokens page. This means that #167663
will need to be\r\nre-opened and fixed in a different
way.","sha":"283f6e64c9656c97fa37be34f3e6fab2e8ad459f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194343","number":194343,"mergeCommit":{"message":"Revert
\"[Fleet][Cloud] Enrollment token table may show an empty last page
#167663 (#188049)\" (#194343)\n\n## Summary\r\n\r\nResolves
#194339.\r\n\r\nThis PR reverts #188049 as it inadvertently broke
pagination of the\r\nenrollment tokens page. This means that #167663
will need to be\r\nre-opened and fixed in a different
way.","sha":"283f6e64c9656c97fa37be34f3e6fab2e8ad459f"}}]}] BACKPORT-->

Co-authored-by: Jen Huang <[email protected]>
@pra2107tham
Copy link
Contributor

Ohh, if it broke pagination? so should I try with new method or it has been closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants