[Security Solution] Disable Install All button when installation is in progress#201731
[Security Solution] Disable Install All button when installation is in progress#201731jkelas merged 5 commits intoelastic:mainfrom
Conversation
💚 Build Succeeded
Metrics [docs]Async chunks
|
|
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
|
Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management) |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#7484[✅] [Serverless] Security Solution Rule Management - Prebuilt Rules - Cypress: 200/200 tests passed. |
|
Thanks for the PR, @jkelas! I've tested it locally and can confirm that the button remains disabled when you navigate away and then return to the page. I couldn't find a way to break it. State after clicking on "Install all" button State after returning to the installation page while "Install all" is in progress We can fix these if we move And then also make use of |
nikitaindik
left a comment
There was a problem hiding this comment.
I have taken a look at the updated code and retested the PR. It looks good to me now.
banderror
left a comment
There was a problem hiding this comment.
@jkelas It works like a charm! 🙌
Tested the fix locally and wasn't able to break it - the state is persisted between SPA navigations across all pages in Kibana. Great solution with react-query!
Also reviewed the code changes. Everything LGTM 👍 I left one minor suggestion regarding separating concerns in the FE code.
|
Starting backport for target branches: 8.16, 8.17, 8.x |
…n progress (elastic#201731) **Resolves: elastic#180660** ## Summary In this PR I am fixing a problem of the `Install All` button being re-enabled when entering the page again. I am fixing only the UI problem here, only for the scenario described in the ticket: single user interacting with single instance of Kibana. During investigation I discovered and discussed with the team other scenarios which may lead to race condition when installing rules, but the team agreed to work on them separately. The fix uses `useIsMutating` hook to check that the mutation is pending. Such information is added to the `AddPrebuiltRulesTableContext` and then used to disable the `Install All` button in the component. Recording: https://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [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 - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483 https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484 (cherry picked from commit 9ca719c)
…n progress (elastic#201731) **Resolves: elastic#180660** ## Summary In this PR I am fixing a problem of the `Install All` button being re-enabled when entering the page again. I am fixing only the UI problem here, only for the scenario described in the ticket: single user interacting with single instance of Kibana. During investigation I discovered and discussed with the team other scenarios which may lead to race condition when installing rules, but the team agreed to work on them separately. The fix uses `useIsMutating` hook to check that the mutation is pending. Such information is added to the `AddPrebuiltRulesTableContext` and then used to disable the `Install All` button in the component. Recording: https://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [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 - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483 https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484 (cherry picked from commit 9ca719c)
…n progress (elastic#201731) **Resolves: elastic#180660** ## Summary In this PR I am fixing a problem of the `Install All` button being re-enabled when entering the page again. I am fixing only the UI problem here, only for the scenario described in the ticket: single user interacting with single instance of Kibana. During investigation I discovered and discussed with the team other scenarios which may lead to race condition when installing rules, but the team agreed to work on them separately. The fix uses `useIsMutating` hook to check that the mutation is pending. Such information is added to the `AddPrebuiltRulesTableContext` and then used to disable the `Install All` button in the component. Recording: https://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [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 - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483 https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484 (cherry picked from commit 9ca719c)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…on is in progress (#201731) (#201962) # Backport This will backport the following commits from `main` to `8.17`: - [[Security Solution] Disable Install All button when installation is in progress (#201731)](#201731) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jacek Kolezynski","email":"jacek.kolezynski@elastic.co"},"sourceCommit":{"committedDate":"2024-11-27T12:13:58Z","message":"[Security Solution] Disable Install All button when installation is in progress (#201731)\n\n**Resolves: #180660**\r\n\r\n## Summary\r\n\r\nIn this PR I am fixing a problem of the `Install All` button being\r\nre-enabled when entering the page again.\r\nI am fixing only the UI problem here, only for the scenario described in\r\nthe ticket: single user interacting with single instance of Kibana.\r\nDuring investigation I discovered and discussed with the team other\r\nscenarios which may lead to race condition when installing rules, but\r\nthe team agreed to work on them separately.\r\n\r\nThe fix uses `useIsMutating` hook to check that the mutation is pending.\r\nSuch information is added to the `AddPrebuiltRulesTableContext` and then\r\nused to disable the `Install All` button in the component.\r\n\r\nRecording:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409\r\n\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n\r\n- [X] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484","sha":"9ca719c2926c766a2a8623bab5814996a3e43833","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt Detection Rules","backport:version","v8.17.0","v8.18.0","v8.16.2"],"title":"[Security Solution] Disable Install All button when installation is in progress","number":201731,"url":"https://github.com/elastic/kibana/pull/201731","mergeCommit":{"message":"[Security Solution] Disable Install All button when installation is in progress (#201731)\n\n**Resolves: #180660**\r\n\r\n## Summary\r\n\r\nIn this PR I am fixing a problem of the `Install All` button being\r\nre-enabled when entering the page again.\r\nI am fixing only the UI problem here, only for the scenario described in\r\nthe ticket: single user interacting with single instance of Kibana.\r\nDuring investigation I discovered and discussed with the team other\r\nscenarios which may lead to race condition when installing rules, but\r\nthe team agreed to work on them separately.\r\n\r\nThe fix uses `useIsMutating` hook to check that the mutation is pending.\r\nSuch information is added to the `AddPrebuiltRulesTableContext` and then\r\nused to disable the `Install All` button in the component.\r\n\r\nRecording:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409\r\n\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n\r\n- [X] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484","sha":"9ca719c2926c766a2a8623bab5814996a3e43833"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x","8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201731","number":201731,"mergeCommit":{"message":"[Security Solution] Disable Install All button when installation is in progress (#201731)\n\n**Resolves: #180660**\r\n\r\n## Summary\r\n\r\nIn this PR I am fixing a problem of the `Install All` button being\r\nre-enabled when entering the page again.\r\nI am fixing only the UI problem here, only for the scenario described in\r\nthe ticket: single user interacting with single instance of Kibana.\r\nDuring investigation I discovered and discussed with the team other\r\nscenarios which may lead to race condition when installing rules, but\r\nthe team agreed to work on them separately.\r\n\r\nThe fix uses `useIsMutating` hook to check that the mutation is pending.\r\nSuch information is added to the `AddPrebuiltRulesTableContext` and then\r\nused to disable the `Install All` button in the component.\r\n\r\nRecording:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409\r\n\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n\r\n- [X] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484","sha":"9ca719c2926c766a2a8623bab5814996a3e43833"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jacek Kolezynski <jacek.kolezynski@elastic.co>
…on is in progress (#201731) (#201961) # Backport This will backport the following commits from `main` to `8.16`: - [[Security Solution] Disable Install All button when installation is in progress (#201731)](#201731) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jacek Kolezynski","email":"jacek.kolezynski@elastic.co"},"sourceCommit":{"committedDate":"2024-11-27T12:13:58Z","message":"[Security Solution] Disable Install All button when installation is in progress (#201731)\n\n**Resolves: #180660**\r\n\r\n## Summary\r\n\r\nIn this PR I am fixing a problem of the `Install All` button being\r\nre-enabled when entering the page again.\r\nI am fixing only the UI problem here, only for the scenario described in\r\nthe ticket: single user interacting with single instance of Kibana.\r\nDuring investigation I discovered and discussed with the team other\r\nscenarios which may lead to race condition when installing rules, but\r\nthe team agreed to work on them separately.\r\n\r\nThe fix uses `useIsMutating` hook to check that the mutation is pending.\r\nSuch information is added to the `AddPrebuiltRulesTableContext` and then\r\nused to disable the `Install All` button in the component.\r\n\r\nRecording:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409\r\n\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n\r\n- [X] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484","sha":"9ca719c2926c766a2a8623bab5814996a3e43833","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt Detection Rules","backport:version","v8.17.0","v8.18.0","v8.16.2"],"title":"[Security Solution] Disable Install All button when installation is in progress","number":201731,"url":"https://github.com/elastic/kibana/pull/201731","mergeCommit":{"message":"[Security Solution] Disable Install All button when installation is in progress (#201731)\n\n**Resolves: #180660**\r\n\r\n## Summary\r\n\r\nIn this PR I am fixing a problem of the `Install All` button being\r\nre-enabled when entering the page again.\r\nI am fixing only the UI problem here, only for the scenario described in\r\nthe ticket: single user interacting with single instance of Kibana.\r\nDuring investigation I discovered and discussed with the team other\r\nscenarios which may lead to race condition when installing rules, but\r\nthe team agreed to work on them separately.\r\n\r\nThe fix uses `useIsMutating` hook to check that the mutation is pending.\r\nSuch information is added to the `AddPrebuiltRulesTableContext` and then\r\nused to disable the `Install All` button in the component.\r\n\r\nRecording:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409\r\n\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n\r\n- [X] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484","sha":"9ca719c2926c766a2a8623bab5814996a3e43833"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x","8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201731","number":201731,"mergeCommit":{"message":"[Security Solution] Disable Install All button when installation is in progress (#201731)\n\n**Resolves: #180660**\r\n\r\n## Summary\r\n\r\nIn this PR I am fixing a problem of the `Install All` button being\r\nre-enabled when entering the page again.\r\nI am fixing only the UI problem here, only for the scenario described in\r\nthe ticket: single user interacting with single instance of Kibana.\r\nDuring investigation I discovered and discussed with the team other\r\nscenarios which may lead to race condition when installing rules, but\r\nthe team agreed to work on them separately.\r\n\r\nThe fix uses `useIsMutating` hook to check that the mutation is pending.\r\nSuch information is added to the `AddPrebuiltRulesTableContext` and then\r\nused to disable the `Install All` button in the component.\r\n\r\nRecording:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409\r\n\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n\r\n- [X] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484","sha":"9ca719c2926c766a2a8623bab5814996a3e43833"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jacek Kolezynski <jacek.kolezynski@elastic.co>
…n is in progress (#201731) (#201963) # Backport This will backport the following commits from `main` to `8.x`: - [[Security Solution] Disable Install All button when installation is in progress (#201731)](#201731) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jacek Kolezynski","email":"jacek.kolezynski@elastic.co"},"sourceCommit":{"committedDate":"2024-11-27T12:13:58Z","message":"[Security Solution] Disable Install All button when installation is in progress (#201731)\n\n**Resolves: #180660**\r\n\r\n## Summary\r\n\r\nIn this PR I am fixing a problem of the `Install All` button being\r\nre-enabled when entering the page again.\r\nI am fixing only the UI problem here, only for the scenario described in\r\nthe ticket: single user interacting with single instance of Kibana.\r\nDuring investigation I discovered and discussed with the team other\r\nscenarios which may lead to race condition when installing rules, but\r\nthe team agreed to work on them separately.\r\n\r\nThe fix uses `useIsMutating` hook to check that the mutation is pending.\r\nSuch information is added to the `AddPrebuiltRulesTableContext` and then\r\nused to disable the `Install All` button in the component.\r\n\r\nRecording:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409\r\n\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n\r\n- [X] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484","sha":"9ca719c2926c766a2a8623bab5814996a3e43833","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt Detection Rules","backport:version","v8.17.0","v8.18.0","v8.16.2"],"title":"[Security Solution] Disable Install All button when installation is in progress","number":201731,"url":"https://github.com/elastic/kibana/pull/201731","mergeCommit":{"message":"[Security Solution] Disable Install All button when installation is in progress (#201731)\n\n**Resolves: #180660**\r\n\r\n## Summary\r\n\r\nIn this PR I am fixing a problem of the `Install All` button being\r\nre-enabled when entering the page again.\r\nI am fixing only the UI problem here, only for the scenario described in\r\nthe ticket: single user interacting with single instance of Kibana.\r\nDuring investigation I discovered and discussed with the team other\r\nscenarios which may lead to race condition when installing rules, but\r\nthe team agreed to work on them separately.\r\n\r\nThe fix uses `useIsMutating` hook to check that the mutation is pending.\r\nSuch information is added to the `AddPrebuiltRulesTableContext` and then\r\nused to disable the `Install All` button in the component.\r\n\r\nRecording:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409\r\n\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n\r\n- [X] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484","sha":"9ca719c2926c766a2a8623bab5814996a3e43833"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x","8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201731","number":201731,"mergeCommit":{"message":"[Security Solution] Disable Install All button when installation is in progress (#201731)\n\n**Resolves: #180660**\r\n\r\n## Summary\r\n\r\nIn this PR I am fixing a problem of the `Install All` button being\r\nre-enabled when entering the page again.\r\nI am fixing only the UI problem here, only for the scenario described in\r\nthe ticket: single user interacting with single instance of Kibana.\r\nDuring investigation I discovered and discussed with the team other\r\nscenarios which may lead to race condition when installing rules, but\r\nthe team agreed to work on them separately.\r\n\r\nThe fix uses `useIsMutating` hook to check that the mutation is pending.\r\nSuch information is added to the `AddPrebuiltRulesTableContext` and then\r\nused to disable the `Install All` button in the component.\r\n\r\nRecording:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409\r\n\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n\r\n- [X] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484","sha":"9ca719c2926c766a2a8623bab5814996a3e43833"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jacek Kolezynski <jacek.kolezynski@elastic.co>
…n progress (elastic#201731) **Resolves: elastic#180660** ## Summary In this PR I am fixing a problem of the `Install All` button being re-enabled when entering the page again. I am fixing only the UI problem here, only for the scenario described in the ticket: single user interacting with single instance of Kibana. During investigation I discovered and discussed with the team other scenarios which may lead to race condition when installing rules, but the team agreed to work on them separately. The fix uses `useIsMutating` hook to check that the mutation is pending. Such information is added to the `AddPrebuiltRulesTableContext` and then used to disable the `Install All` button in the component. Recording: https://github.com/user-attachments/assets/777dd6a5-2441-4101-8368-04cdcede1409 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [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 - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483 https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484
…4022) ## Summary In the PR #201731 for ticket #180660 @banderror advised to refactor code in that PR to better separate the concerns (business logic from components). This is the implementation of that review [remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191). Recording: https://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Nikita Indik <nikita.indik@elastic.co>
… (elastic#204022) ## Summary In the PR elastic#201731 for ticket elastic#180660 @banderror advised to refactor code in that PR to better separate the concerns (business logic from components). This is the implementation of that review [remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191). Recording: https://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Nikita Indik <nikita.indik@elastic.co> (cherry picked from commit 20eb87d)
… (elastic#204022) ## Summary In the PR elastic#201731 for ticket elastic#180660 @banderror advised to refactor code in that PR to better separate the concerns (business logic from components). This is the implementation of that review [remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191). Recording: https://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Nikita Indik <nikita.indik@elastic.co> (cherry picked from commit 20eb87d)
… (elastic#204022) ## Summary In the PR elastic#201731 for ticket elastic#180660 @banderror advised to refactor code in that PR to better separate the concerns (business logic from components). This is the implementation of that review [remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191). Recording: https://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Nikita Indik <nikita.indik@elastic.co> (cherry picked from commit 20eb87d)
… (#204022) (#205903) # Backport This will backport the following commits from `main` to `8.16`: - [[Security Solution] Implement refactoring remark from PR #201731 (#204022)](#204022) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jacek Kolezynski","email":"jacek.kolezynski@elastic.co"},"sourceCommit":{"committedDate":"2025-01-08T14:01:47Z","message":"[Security Solution] Implement refactoring remark from PR #201731 (#204022)\n\n## Summary\n\nIn the PR #201731 for ticket #180660 @banderror advised to refactor code\nin that PR to better separate the concerns (business logic from\ncomponents). This is the implementation of that review\n[remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191).\n\nRecording:\n\n\nhttps://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Nikita Indik <nikita.indik@elastic.co>","sha":"20eb87d778a69b6b0d7132732cbea9cce44e895c","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["refactoring","release_note:skip","v9.0.0","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt Detection Rules","ci:cloud-deploy","ci:project-deploy-security","backport:version","v8.18.0","v8.16.3","v8.17.1"],"title":"[Security Solution] Implement refactoring remark from PR #201731","number":204022,"url":"https://github.com/elastic/kibana/pull/204022","mergeCommit":{"message":"[Security Solution] Implement refactoring remark from PR #201731 (#204022)\n\n## Summary\n\nIn the PR #201731 for ticket #180660 @banderror advised to refactor code\nin that PR to better separate the concerns (business logic from\ncomponents). This is the implementation of that review\n[remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191).\n\nRecording:\n\n\nhttps://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Nikita Indik <nikita.indik@elastic.co>","sha":"20eb87d778a69b6b0d7132732cbea9cce44e895c"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.16","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204022","number":204022,"mergeCommit":{"message":"[Security Solution] Implement refactoring remark from PR #201731 (#204022)\n\n## Summary\n\nIn the PR #201731 for ticket #180660 @banderror advised to refactor code\nin that PR to better separate the concerns (business logic from\ncomponents). This is the implementation of that review\n[remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191).\n\nRecording:\n\n\nhttps://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Nikita Indik <nikita.indik@elastic.co>","sha":"20eb87d778a69b6b0d7132732cbea9cce44e895c"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jacek Kolezynski <jacek.kolezynski@elastic.co>
… (#204022) (#205904) # Backport This will backport the following commits from `main` to `8.17`: - [[Security Solution] Implement refactoring remark from PR #201731 (#204022)](#204022) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jacek Kolezynski","email":"jacek.kolezynski@elastic.co"},"sourceCommit":{"committedDate":"2025-01-08T14:01:47Z","message":"[Security Solution] Implement refactoring remark from PR #201731 (#204022)\n\n## Summary\n\nIn the PR #201731 for ticket #180660 @banderror advised to refactor code\nin that PR to better separate the concerns (business logic from\ncomponents). This is the implementation of that review\n[remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191).\n\nRecording:\n\n\nhttps://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Nikita Indik <nikita.indik@elastic.co>","sha":"20eb87d778a69b6b0d7132732cbea9cce44e895c","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["refactoring","release_note:skip","v9.0.0","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt Detection Rules","ci:cloud-deploy","ci:project-deploy-security","backport:version","v8.18.0","v8.16.3","v8.17.1"],"title":"[Security Solution] Implement refactoring remark from PR #201731","number":204022,"url":"https://github.com/elastic/kibana/pull/204022","mergeCommit":{"message":"[Security Solution] Implement refactoring remark from PR #201731 (#204022)\n\n## Summary\n\nIn the PR #201731 for ticket #180660 @banderror advised to refactor code\nin that PR to better separate the concerns (business logic from\ncomponents). This is the implementation of that review\n[remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191).\n\nRecording:\n\n\nhttps://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Nikita Indik <nikita.indik@elastic.co>","sha":"20eb87d778a69b6b0d7132732cbea9cce44e895c"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.16","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204022","number":204022,"mergeCommit":{"message":"[Security Solution] Implement refactoring remark from PR #201731 (#204022)\n\n## Summary\n\nIn the PR #201731 for ticket #180660 @banderror advised to refactor code\nin that PR to better separate the concerns (business logic from\ncomponents). This is the implementation of that review\n[remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191).\n\nRecording:\n\n\nhttps://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Nikita Indik <nikita.indik@elastic.co>","sha":"20eb87d778a69b6b0d7132732cbea9cce44e895c"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jacek Kolezynski <jacek.kolezynski@elastic.co>
#204022) (#205905) # Backport This will backport the following commits from `main` to `8.x`: - [[Security Solution] Implement refactoring remark from PR #201731 (#204022)](#204022) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jacek Kolezynski","email":"jacek.kolezynski@elastic.co"},"sourceCommit":{"committedDate":"2025-01-08T14:01:47Z","message":"[Security Solution] Implement refactoring remark from PR #201731 (#204022)\n\n## Summary\n\nIn the PR #201731 for ticket #180660 @banderror advised to refactor code\nin that PR to better separate the concerns (business logic from\ncomponents). This is the implementation of that review\n[remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191).\n\nRecording:\n\n\nhttps://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Nikita Indik <nikita.indik@elastic.co>","sha":"20eb87d778a69b6b0d7132732cbea9cce44e895c","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["refactoring","release_note:skip","v9.0.0","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt Detection Rules","ci:cloud-deploy","ci:project-deploy-security","backport:version","v8.18.0","v8.16.3","v8.17.1"],"title":"[Security Solution] Implement refactoring remark from PR #201731","number":204022,"url":"https://github.com/elastic/kibana/pull/204022","mergeCommit":{"message":"[Security Solution] Implement refactoring remark from PR #201731 (#204022)\n\n## Summary\n\nIn the PR #201731 for ticket #180660 @banderror advised to refactor code\nin that PR to better separate the concerns (business logic from\ncomponents). This is the implementation of that review\n[remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191).\n\nRecording:\n\n\nhttps://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Nikita Indik <nikita.indik@elastic.co>","sha":"20eb87d778a69b6b0d7132732cbea9cce44e895c"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.16","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204022","number":204022,"mergeCommit":{"message":"[Security Solution] Implement refactoring remark from PR #201731 (#204022)\n\n## Summary\n\nIn the PR #201731 for ticket #180660 @banderror advised to refactor code\nin that PR to better separate the concerns (business logic from\ncomponents). This is the implementation of that review\n[remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191).\n\nRecording:\n\n\nhttps://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Nikita Indik <nikita.indik@elastic.co>","sha":"20eb87d778a69b6b0d7132732cbea9cce44e895c"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jacek Kolezynski <jacek.kolezynski@elastic.co>
… (elastic#204022) ## Summary In the PR elastic#201731 for ticket elastic#180660 @banderror advised to refactor code in that PR to better separate the concerns (business logic from components). This is the implementation of that review [remark](https://github.com/elastic/kibana/pull/201731/files#r1860492191). Recording: https://github.com/user-attachments/assets/471a0986-bcdb-4611-ab1a-bdcbe5151f47 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Nikita Indik <nikita.indik@elastic.co>


Resolves: #180660
Summary
In this PR I am fixing a problem of the
Install Allbutton being re-enabled when entering the page again.I am fixing only the UI problem here, only for the scenario described in the ticket: single user interacting with single instance of Kibana.
During investigation I discovered and discussed with the team other scenarios which may lead to race condition when installing rules, but the team agreed to work on them separately.
The fix uses
useIsMutatinghook to check that the mutation is pending. Such information is added to theAddPrebuiltRulesTableContextand then used to disable theInstall Allbutton in the component.Recording:
Screen.Recording.2024-11-26.at.10.18.36.mov
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7483
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7484