-
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
[Security Solution] Add threshold
, machine_learning_job_id
and anomaly_threshold
editable fields
#200323
base: main
Are you sure you want to change the base?
Conversation
c195e14
to
ff1858e
Compare
ff1858e
to
d13fb76
Compare
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) |
f198cad
to
b6a9d92
Compare
@xcrzx I've addressed the feedback. Feel free to take another look! |
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.
Thanks for the fixes! I did another round of review, and the validation regression spotted earlier has been resolved.
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.
Excellent work here, @nikitaindik !
I first verified that the existing create/update rule flows work as expected, since those were modified here as well. Things look good there, besides a potential bug with threshold fields (showing more fields than we should); I'm going to ping @vitaliidm since he has more familiarity with threshold rules and that area was more significantly modified. ML rules changes look good, though.
There might be some cleanup around the forms here, now; I had one comment about whether empty schema
definitions were required. Have you discussed this style of refactor with @sebelga at all? He may have thoughts on how best to factor/place things as we shift more toward this "field-first" approach to our forms.
I was also able to validate that the missing validations that @xcrzx referenced are now there, at least for the ML fields that I was exercising.
One small UX note: on the upgrade page it's not obvious that clicking the rule's name will bring up the "review" flow; I was expecting there to be a "review" button instead of (or in addition to) the disabled "upgrade rule" button.
All minor things in the broader context, here, so approving in the meantime. Hopefully @vitaliidm can confirm the threshold changes before this is merged.
...ement/components/rule_details/three_way_diff/final_edit/machine_learning_rule_field_edit.tsx
Show resolved
Hide resolved
@container (min-width: ${CONTAINER_BREAKPOINT}px) { | ||
flex: 1; | ||
max-width: calc( | ||
100% - ${OPERATOR_WIDTH}px - ${INPUT_WIDTH}px - ${euiThemeVars.euiSizeL} - |
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.
Curious if
- ${euiThemeVars.euiSizeL} - ${euiThemeVars.euiSizeL}
is preferred over
- (${euiThemeVars.euiSizeL} * 2)
? And if so, why?
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.
euiThemeVars.euiSizeL
is actually a string with px
at the end. 24px
in this case, so I can't multiply it.
import * as i18n from './translations'; | ||
|
||
const buttonClassName = css` | ||
margin-top: 20px; |
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.
Magic number? Should we be referencing a theme variable instead?
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.
...rity_solution/public/detection_engine/rule_creation_ui/components/step_define_rule/index.tsx
Show resolved
Hide resolved
)} | ||
{isThresholdRule && ( | ||
<EuiFormRow data-test-subj="thresholdInput" fullWidth> | ||
<ThresholdEdit esFields={indexPattern.fields as FieldSpec[]} path="threshold" /> |
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.
Using indexPattern.fields
instead of the filtered aggFields
means we're now showing non-aggregatable fields in the threshold field select, right?
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.
That's a great catch, Ryland! I somehow missed it.
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.
Pushed the fix
...ity_solution/public/detection_engine/rule_creation_ui/components/step_define_rule/schema.tsx
Show resolved
Hide resolved
..._solution/public/detection_engine/rule_creation/components/threshold_edit/threshold_edit.tsx
Outdated
Show resolved
Hide resolved
Will add to this to feedback to share this with Kseniia and Alex. |
can you give me more details on this one? Meanwhile I tested PR a bit (did not review code, since Ryland already did this)
old UInew UI
new UIold UI |
Hey, everyone! Thanks for reviewing and testing. There's still a minor issue with form element sizing that need to be addressed, but I urgently need to switch to high-priority Rule Customization tickets. So, I've set this PR to draft. I will reopen it and ping those who haven't approved it yet once I resolve the issues. |
@vitaliidm I was referring to this comment about passing a wider set of fields to the threshold input. @nikitaindik said a fix was incoming but I've not yet seen it on this branch. |
Agree, fields should be filtered, only aggregatable ones should show up in threshold control @nikitaindik , I also noticed, Suppress alerts checkbox label does not show selected field. |
…y" fields are changed
Thanks for catching this! Actually, the width of the number inputs is similar to what’s on
Great observation, thanks for pointing this out! I’ve adjusted the margin to ensure that the >= operator stays properly aligned, even when more fields are added or an error message appears.
Indeed, there was a bug. Thanks! I've pushed a commit with the fix. With all your feedback addressed, the PR is ready for another review. 😊 |
⏳ Build in-progress, with failures
Failed CI Steps
Test Failures
History
cc @nikitaindik |
Partially addresses: #171520
Summary
Changes in this PR:
threshold
andmachine_learning_job_id
,anomaly_threshold
are now editable in the Rule Upgrade flyoutTesting
prebuiltRulesCustomizationEnabled
feature flag is enabled.PATCH api/detection_engine/rules
API.version: 1
in the request body to downgrade it to version 1.