-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Cloud Security] fix fleet form save button bug #211563
Conversation
6c3a9e4
to
9590df3
Compare
...ications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.tsx
Outdated
Show resolved
Hide resolved
Pinging @elastic/fleet (Team:Fleet) |
updatePolicy( | ||
{ | ||
...newPolicy, | ||
name: currentIntegrationName, | ||
}, | ||
Array.isArray(packagePolicyListByIntegration) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe instead of passing this new parameter just for our use case, and we being a single consumer, we can instead set the formState as not valid (this is already being checked to disable the button) as long as !Array.isArray(packagePolicyListByIntegration)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#7896[✅] x-pack/test/fleet_api_integration/config.epm.ts: 25/25 tests passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…e enabling save button
1af91ab
to
a8eeeb2
Compare
added unit test for CspPolicyTemplateForm component
a8eeeb2
to
fda66d9
Compare
Used additional property 'isFetchedPackagePolicies' to handle enable/disable of save and continue button since formState = 'VALID' before the name input gets the most updated value from our fleet extensions template form. |
Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security) |
...newPolicy, | ||
name: currentIntegrationName, | ||
}, | ||
Array.isArray(packagePolicyListByIntegration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i suggest to put this value into a named constant so it will be easier to understand why this check is being done. in this use case maybe something like hasPackagePoliciesLoaded
also, note that an empty array is will still return true for Array.isArray
, is this case something we care about? if so, probably good to additionally check for length.
edit: in an offline conversation we figured that an empty array is actually a valid value for us, lets add a comment above this check so its clear to anyone reading it
updatePackagePolicy(updatedPolicy); | ||
setIsFetchedPackagePolicies(isLoadedPackagePolicies); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do other extensions also have this problem? maybe we can pass something more generic like extensionIsLoading
, that why every extension can pass what ever fits their case.
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#7917[✅] x-pack/test/fleet_functional/config.ts: 25/25 tests passed. |
💔 Build Failed
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Async chunks
History |
Starting backport for target branches: 9.0 |
## Summary This PR tries to fix the following [https://github.com/elastic/security-team/issues/11881](url) the bug causes a lot of flakiness in our test cases. ### Checklist - [x] [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 - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed ### Closes this PR closes the above mentioned issues in relation for this ticket - elastic/security-team#11881 ### Video recording https://github.com/user-attachments/assets/b6389216-8078-4f06-9a39-41b9559f8f1b (cherry picked from commit a37b3cf)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
) # Backport This will backport the following commits from `main` to `9.0`: - [[Cloud Security] fix fleet form save button bug (#211563)](#211563) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Alex Prozorov","email":"alex.prozorov@elastic.co"},"sourceCommit":{"committedDate":"2025-02-22T08:42:52Z","message":"[Cloud Security] fix fleet form save button bug (#211563)\n\n## Summary\n\nThis PR tries to fix the following\n[https://github.com/elastic/security-team/issues/11881](url)\nthe bug causes a lot of flakiness in our test cases.\n\n### Checklist\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n\n### Closes\nthis PR closes the above mentioned issues in relation for this ticket -\nhttps://github.com/elastic/security-team/issues/11881\n\n### Video recording\n\nhttps://github.com/user-attachments/assets/b6389216-8078-4f06-9a39-41b9559f8f1b","sha":"a37b3cfba24ff07b29c58efc56644b7b32326897","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Fleet","Team:Cloud Security","backport:prev-minor","v9.1.0"],"title":"[Cloud Security] fix fleet form save button bug","number":211563,"url":"https://github.com/elastic/kibana/pull/211563","mergeCommit":{"message":"[Cloud Security] fix fleet form save button bug (#211563)\n\n## Summary\n\nThis PR tries to fix the following\n[https://github.com/elastic/security-team/issues/11881](url)\nthe bug causes a lot of flakiness in our test cases.\n\n### Checklist\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n\n### Closes\nthis PR closes the above mentioned issues in relation for this ticket -\nhttps://github.com/elastic/security-team/issues/11881\n\n### Video recording\n\nhttps://github.com/user-attachments/assets/b6389216-8078-4f06-9a39-41b9559f8f1b","sha":"a37b3cfba24ff07b29c58efc56644b7b32326897"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211563","number":211563,"mergeCommit":{"message":"[Cloud Security] fix fleet form save button bug (#211563)\n\n## Summary\n\nThis PR tries to fix the following\n[https://github.com/elastic/security-team/issues/11881](url)\nthe bug causes a lot of flakiness in our test cases.\n\n### Checklist\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n\n### Closes\nthis PR closes the above mentioned issues in relation for this ticket -\nhttps://github.com/elastic/security-team/issues/11881\n\n### Video recording\n\nhttps://github.com/user-attachments/assets/b6389216-8078-4f06-9a39-41b9559f8f1b","sha":"a37b3cfba24ff07b29c58efc56644b7b32326897"}}]}] BACKPORT--> Co-authored-by: Alex Prozorov <alex.prozorov@elastic.co>
Summary
This PR tries to fix the following https://github.com/elastic/security-team/issues/11881
the bug causes a lot of flakiness in our test cases.
Checklist
Closes
this PR closes the above mentioned issues in relation for this ticket - https://github.com/elastic/security-team/issues/11881
Video recording
Screen.Recording.2025-02-17.at.12.53.56.mov