-
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
[ML] Adds editor for configuring detector rules #20989
Conversation
Pinging @elastic/ml-ui |
💔 Build Failed |
import { APPLIES_TO, OPERATOR } from '../../../common/constants/detector_rule'; | ||
import { appliesToText, operatorToText } from './utils'; | ||
|
||
// Rise the popovers above GuidePageSideNav |
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.
nit, possible typo? should this be "raise"?
|
||
} else { | ||
toastNotifications.addDanger( | ||
`Error obtaining details for job ID ${anomaly.jobId}`); |
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.
should the flyout fail to open in this case?
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.
|
||
|
||
/* | ||
* React modal for validating and saving edits to a rule. |
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.
Is this modal complete?
It looks like a WIP?
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.
Well spotted. I'll remove the save_rule_modal.js
file as it isn't needed. The checks it was going to do on save are now done inline, and the Save button is disabled if the edits are not valid e.g. if neither a condition or scope has been added.
import { FILTER_TYPE } from '../../../common/constants/detector_rule'; | ||
import { filterTypeToText } from './utils'; | ||
|
||
// Rise the popovers above GuidePageSideNav |
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.
should be "raise"
}) { | ||
|
||
const detector = job.analysis_config.detectors[detectorIndex]; | ||
const rule = detector.custom_rules[ruleIndex]; |
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.
does custom_rules
always exist?
} | ||
|
||
return ( | ||
<div> |
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.
The PR uses a mix of <div>
and <React.Fragment>
in different places to wrap components. If the <div>
isn't necessary in the DOM it could be replaced with <React.Fragment>
.
} | ||
|
||
return ( | ||
<div> |
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.
The PR uses a mix of <div>
and <React.Fragment>
in different places to wrap components. If the <div>
isn't necessary in the DOM it could be replaced with <React.Fragment>
.
} | ||
|
||
return ( | ||
<div> |
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.
The PR uses a mix of <div>
and <React.Fragment>
in different places to wrap components. If the <div>
isn't necessary in the DOM it could be replaced with <React.Fragment>
.
} | ||
|
||
return ( | ||
<div> |
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.
The PR uses a mix of <div>
and <React.Fragment>
in different places to wrap components. If the <div>
isn't necessary in the DOM it could be replaced with <React.Fragment>
.
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
I feel this could be revisited later for a bit of restructuring.
moving the edit component out of the flyout component makes sense to me. so we'd have an edit rule
component and a list rules
component.
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
💔 Build Failed |
72c5951
to
e2d3467
Compare
💚 Build Succeeded |
* [ML] Adds editor for configuring detector rules * [ML] Edits to Rule Editor flyout following review
The machine learning model detects statistically anomalous results but it has no knowledge of the meaning of the values being modeled. Rules allow users to supply a detector with domain knowledge that can improve the quality of the results.
This PR adds an editor for viewing, editing and deleting detector rules, launched as an EUI Flyout from the anomalies table links menu.
The 'links' menu on the anomalies table has been relabelled to 'actions':
If rules have already been added to a detector, the user is shown a page of options for editing or deleting existing rules:
When editing a rule, the user enters the action (skip result or skip model update), plus numerical conditions and / or the categorical scope:
Editing a numerical condition:
Editing scope, selecting from the configured filter lists (see #20769):
Addresses items in #20339. Note this PR does not include functionality for restricting access based on the user's privileges. That will be covered in a separate PR.