From 474d958118fed310cce4086761ebd942ad27abe2 Mon Sep 17 00:00:00 2001 From: Maxim Palenov Date: Mon, 24 Oct 2022 17:17:01 +0300 Subject: [PATCH] [Security Solution] Fix rule details enable/disable toggle isDisabled state (#143252) **Resolves:** [#137149](https://github.com/elastic/kibana/issues/137149) ## Summary Disables rule details enable/disable toggle for ML rules only under basic license. Before: https://user-images.githubusercontent.com/3775283/195514871-f0ccb25e-177d-4b4e-83bc-9c26da1718f0.mov After: https://user-images.githubusercontent.com/3775283/195513340-95944c6d-da6d-4ab3-9917-4e03f5791d3a.mov ### Checklist - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) (cherry picked from commit 931987de6b3b8e51d6032d5c52b4b89ed6c5edd9) --- .../detections/pages/detection_engine/rules/all/use_columns.tsx | 2 +- .../detections/pages/detection_engine/rules/details/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/use_columns.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/use_columns.tsx index 2fa479d01b5d2..52371046b9aa1 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/use_columns.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/use_columns.tsx @@ -84,7 +84,7 @@ const useEnabledColumn = ({ hasCRUDPermissions }: ColumnsProps): TableColumn => isDisabled={ !canEditRuleWithActions(rule, hasActionsPrivileges) || !hasCRUDPermissions || - (isMlRule(rule.type) && !hasMlPermissions && !rule.enabled) + (isMlRule(rule.type) && !hasMlPermissions) } isLoading={loadingIds.includes(rule.id)} /> diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx index 99f8d0554a983..0bdbc385df7fc 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx @@ -694,7 +694,7 @@ const RuleDetailsPageComponent: React.FC = ({ !isExistingRule || !canEditRuleWithActions(rule, hasActionsPrivileges) || !hasUserCRUDPermission(canUserCRUD) || - (!hasMlPermissions && !rule?.enabled) + (isMlRule(rule?.type) && !hasMlPermissions) } enabled={isExistingRule && (rule?.enabled ?? false)} onChange={handleOnChangeEnabledRule}