elastic / kibana

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

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

Open gergoabraham opened 1 year ago

gergoabraham commented 1 year ago

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

elasticmachine commented 1 year ago

Pinging @elastic/fleet (Team:Fleet)

ArchitGajjar commented 10 months ago

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

pra2107tham commented 4 months ago

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

jen-huang commented 4 months ago

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

pra2107tham commented 4 months ago

@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 commented 4 months ago

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:

https://github.com/elastic/kibana/blob/41ee64709f8c7ca1e0bc72ac4b5a74076d68ba26/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/index.tsx#L124-L130

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

pra2107tham commented 4 months ago

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

jen-huang commented 2 months ago

The previous work will be reverted in https://github.com/elastic/kibana/pull/194343 so I'm reopening this. That approach broke pagination in general so this will need to be fixed in a different way.

pra2107tham commented 1 month ago

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