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 uncorrect override of cspm inputs #208562

Merged
merged 4 commits into from
Jan 29, 2025

Conversation

criamico
Copy link
Contributor

@criamico criamico commented Jan 28, 2025

Summary

Fixes a bug introduced with #206074

When a user selected a single account and switched the deployment method to agentless, it reverted to the organization selection. This PR removes the code that was causing the bug.

Screen.Recording.2025-01-28.at.16.40.46.mov

⚠️ Important ⚠️
One side effect of this change is that when we switch back from agentless to agent-based, the inputs that were previously hidden and disabled are now visible but they are disabled. This is not ideal but offers the user the option to re enable them, but at least doesn't try to forcefully switch them to initial state, that was the cause of the current bug.

Screen.Recording.2025-01-28.at.16.53.17.mov

Checklist

  • Unit or functional tests were updated or added to match the most common scenarios
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

@criamico criamico changed the title Fix cspm inputs [Fleet] Fix uncorrect override of cspm inputs Jan 28, 2025
@criamico criamico self-assigned this Jan 28, 2025
@criamico criamico added the Team:Fleet Team label for Observability Data Collection Fleet team label Jan 28, 2025
@@ -328,9 +315,9 @@ export function useOnSubmit({
if (isAgentlessSelected && AGENTLESS_DISABLED_INPUTS.includes(input.type)) {
return { ...input, enabled: false };
}
return initialPackagePolicy.inputs[i];
return packagePolicy.inputs[i];
Copy link
Contributor

@seanrathier seanrathier Jan 28, 2025

Choose a reason for hiding this comment

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

This change should fix us. Thanks again.

@criamico criamico added v8.18.0 release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) v9.0.0 labels Jan 28, 2025
@criamico criamico marked this pull request as ready for review January 28, 2025 16:10
@criamico criamico requested a review from a team as a code owner January 28, 2025 16:10
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Contributor

@seanrathier seanrathier left a comment

Choose a reason for hiding this comment

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

Thanks again!

@criamico
Copy link
Contributor Author

@elasticmachine merge upstream

@criamico
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

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.7MB 1.7MB -69.0B

History

cc @criamico

@criamico criamico merged commit e758f32 into elastic:main Jan 29, 2025
8 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/13034161380

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 29, 2025
## Summary
Fixes a bug introduced with
elastic#206074

When a user selected a single account and switched the deployment method
to `agentless`, it reverted to the organization selection. This PR
removes[ the
code](https://github.com/elastic/kibana/pull/206074/files#diff-a169e222e1116859e05821170ab592903c2943613dfe0035c32a4b9d42e5634fR330)
that was causing the bug.

https://github.com/user-attachments/assets/9007c35b-8454-4f7f-8811-bd39ba7ac99e

⚠️ **Important** ⚠️
One side effect of this change is that when we switch back from
agentless to agent-based, the inputs that were previously hidden and
disabled are now visible but they are disabled. This is not ideal but
offers the user the option to re enable them, but at least doesn't try
to forcefully switch them to initial state, that was the cause of the
current bug.

https://github.com/user-attachments/assets/520e361b-2789-4081-bb91-c75db88d5431

### 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
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit e758f32)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

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 29, 2025
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Fleet] Fix uncorrect override of cspm inputs
(#208562)](#208562)

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

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

<!--BACKPORT [{"author":{"name":"Cristina
Amico","email":"criamico@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-01-29T15:02:48Z","message":"[Fleet]
Fix uncorrect override of cspm inputs (#208562)\n\n## Summary\r\nFixes a
bug introduced
with\r\nhttps://github.com//pull/206074\r\n\r\nWhen a user
selected a single account and switched the deployment method\r\nto
`agentless`, it reverted to the organization selection. This
PR\r\nremoves[
the\r\ncode](https://github.com/elastic/kibana/pull/206074/files#diff-a169e222e1116859e05821170ab592903c2943613dfe0035c32a4b9d42e5634fR330)\r\nthat
was causing the
bug.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/9007c35b-8454-4f7f-8811-bd39ba7ac99e\r\n\r\n\r\n⚠️
**Important** ⚠️\r\nOne side effect of this change is that when we
switch back from\r\nagentless to agent-based, the inputs that were
previously hidden and\r\ndisabled are now visible but they are disabled.
This is not ideal but\r\noffers the user the option to re enable them,
but at least doesn't try\r\nto forcefully switch them to initial state,
that was the cause of the\r\ncurrent
bug.\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/520e361b-2789-4081-bb91-c75db88d5431\r\n\r\n\r\n###
Checklist\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- [ ] The PR
description includes the appropriate Release Notes section,\r\nand the
correct `release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"e758f32cec09c7e16208d7a89947c9489462e237","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","backport:prev-minor","v8.18.0"],"title":"[Fleet]
Fix uncorrect override of cspm
inputs","number":208562,"url":"https://github.com/elastic/kibana/pull/208562","mergeCommit":{"message":"[Fleet]
Fix uncorrect override of cspm inputs (#208562)\n\n## Summary\r\nFixes a
bug introduced
with\r\nhttps://github.com//pull/206074\r\n\r\nWhen a user
selected a single account and switched the deployment method\r\nto
`agentless`, it reverted to the organization selection. This
PR\r\nremoves[
the\r\ncode](https://github.com/elastic/kibana/pull/206074/files#diff-a169e222e1116859e05821170ab592903c2943613dfe0035c32a4b9d42e5634fR330)\r\nthat
was causing the
bug.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/9007c35b-8454-4f7f-8811-bd39ba7ac99e\r\n\r\n\r\n⚠️
**Important** ⚠️\r\nOne side effect of this change is that when we
switch back from\r\nagentless to agent-based, the inputs that were
previously hidden and\r\ndisabled are now visible but they are disabled.
This is not ideal but\r\noffers the user the option to re enable them,
but at least doesn't try\r\nto forcefully switch them to initial state,
that was the cause of the\r\ncurrent
bug.\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/520e361b-2789-4081-bb91-c75db88d5431\r\n\r\n\r\n###
Checklist\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- [ ] The PR
description includes the appropriate Release Notes section,\r\nand the
correct `release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"e758f32cec09c7e16208d7a89947c9489462e237"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208562","number":208562,"mergeCommit":{"message":"[Fleet]
Fix uncorrect override of cspm inputs (#208562)\n\n## Summary\r\nFixes a
bug introduced
with\r\nhttps://github.com//pull/206074\r\n\r\nWhen a user
selected a single account and switched the deployment method\r\nto
`agentless`, it reverted to the organization selection. This
PR\r\nremoves[
the\r\ncode](https://github.com/elastic/kibana/pull/206074/files#diff-a169e222e1116859e05821170ab592903c2943613dfe0035c32a4b9d42e5634fR330)\r\nthat
was causing the
bug.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/9007c35b-8454-4f7f-8811-bd39ba7ac99e\r\n\r\n\r\n⚠️
**Important** ⚠️\r\nOne side effect of this change is that when we
switch back from\r\nagentless to agent-based, the inputs that were
previously hidden and\r\ndisabled are now visible but they are disabled.
This is not ideal but\r\noffers the user the option to re enable them,
but at least doesn't try\r\nto forcefully switch them to initial state,
that was the cause of the\r\ncurrent
bug.\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/520e361b-2789-4081-bb91-c75db88d5431\r\n\r\n\r\n###
Checklist\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- [ ] The PR
description includes the appropriate Release Notes section,\r\nand the
correct `release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"e758f32cec09c7e16208d7a89947c9489462e237"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Cristina Amico <criamico@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants