Skip to content

Commit

Permalink
[Security Solution] Fix rule details enable/disable toggle isDisabled…
Browse files Browse the repository at this point in the history
… state (elastic#143252)

**Resolves:** [elastic#137149](elastic#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)
  • Loading branch information
maximpn authored Oct 24, 2022
1 parent 8b0145c commit 931987d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ const RuleDetailsPageComponent: React.FC<DetectionEngineComponentProps> = ({
!isExistingRule ||
!canEditRuleWithActions(rule, hasActionsPrivileges) ||
!hasUserCRUDPermission(canUserCRUD) ||
(!hasMlPermissions && !rule?.enabled)
(isMlRule(rule?.type) && !hasMlPermissions)
}
enabled={isExistingRule && (rule?.enabled ?? false)}
onChange={handleOnChangeEnabledRule}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,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)}
/>
Expand Down

0 comments on commit 931987d

Please sign in to comment.