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

Fixed all agent tags should be visible when agent list is filtred #170850

Closed

Conversation

AdrianPavlik
Copy link

Summary

Closes #164674

There was an issue where the tags displayed in the 'Create/Add New Tag' popover on the agent interface were being filtered by the same query as the search. I resolved this by introducing a new query and creating a new variable dedicated to storing all the necessary tags. With this change, the tags are no longer filtered by the search query, ensuring that the list includes all existing.

For maintainers

@AdrianPavlik AdrianPavlik requested a review from a team as a code owner November 8, 2023 11:53
@kibanamachine
Copy link
Contributor

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Nov 8, 2023
Copy link

cla-checker-service bot commented Nov 8, 2023

💚 CLA has been signed

@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@AdrianPavlik AdrianPavlik force-pushed the all-tags-should-be-visible-fix branch from b6af933 to de25867 Compare November 8, 2023 13:10
const [agentsOnCurrentPage, setAgentsOnCurrentPage] = useState<Agent[]>([]);
const [agentsStatus, setAgentsStatus] = useState<
{ [key in SimplifiedAgentStatus]: number } | undefined
>();
const [allTags, setAllTags] = useState<string[]>();
const [allAddRemoveTags, setAllAddRemoveTags] = useState<string[]>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming nit: should this be called allTags and the existing allTags renamed to e.g.filteredTags?

@jillguyonnet
Copy link
Contributor

I was looking at the other places where the current allTags (which is filtered) is used and I'm wondering if a similar bug exists with the bulk actions menu.

Here allTags is passed to the search and filter bar, which propagates it to the bulk actions menu. The latter uses it here. If you filter out an agent with a unique tag, select another agent and use the bulk actions menu to add/remove tags, you'll run into the same issue.

@jillguyonnet jillguyonnet added release_note:skip Skip the PR/issue when compiling release notes v8.12.0 labels Nov 10, 2023
@@ -178,11 +178,17 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
});
}, [search, selectedAgentPolicies, selectedStatus, selectedTags]);

// filters kuery for all tags
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this is not for filters :) The variable name is clear, so feel free to even remove the comment.

@@ -269,6 +276,10 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
kuery: kuery && kuery !== '' ? kuery : undefined,
showInactive,
}),
sendGetAgentTags({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering: could it be possible to only fetch the tags once, i.e. all of them and then use filtering to set the filtered tags?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the point where you are aiming, it is possible to some extent. The filtered kuery still has to be created since it is used in the SearchBar, but it does not have to be sent as REST request to get the agent tags response, since we can use all the existing tags. Please review the changes.

@AdrianPavlik
Copy link
Author

I was looking at the other places where the current allTags (which is filtered) is used and I'm wondering if a similar bug exists with the bulk actions menu.

Here allTags is passed to the search and filter bar, which propagates it to the bulk actions menu. The latter uses it here. If you filter out an agent with a unique tag, select another agent and use the bulk actions menu to add/remove tags, you'll run into the same issue.

Fixed this by using allTags.

@jillguyonnet
Copy link
Contributor

@elasticmachine merge upstream

@jillguyonnet
Copy link
Contributor

/ci

@kibana-ci
Copy link
Collaborator

kibana-ci commented Jan 10, 2024

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Fleet Cypress Tests #2 / View agents list Agent status filter should filter on healthy (16 result)
  • [job] [logs] Fleet Cypress Tests #2 / View agents list Agent status filter should filter on healthy (16 result)
  • [job] [logs] Fleet Cypress Tests #2 / View agents list Agent status filter should filter on healthy and unhealthy
  • [job] [logs] Fleet Cypress Tests #2 / View agents list Agent status filter should filter on healthy and unhealthy
  • [job] [logs] Fleet Cypress Tests #2 / View agents list Agent status filter should filter on unhealthy (1 result)
  • [job] [logs] Fleet Cypress Tests #2 / View agents list Agent status filter should filter on unhealthy (1 result)
  • [job] [logs] Fleet Cypress Tests #2 / View agents list Bulk actions should allow to bulk upgrade agents and cancel that upgrade
  • [job] [logs] Fleet Cypress Tests #2 / View agents list Bulk actions should allow to bulk upgrade agents and cancel that upgrade

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 +38.0B

History

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

@kpollich
Copy link
Member

kpollich commented Aug 6, 2024

Since this has gone stale, I'm closing this PR.

@kpollich kpollich closed this Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💝community release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] All agent tags should be visible when agent list is filtered
6 participants