-
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 quick job installation to anomalies table #142861
Conversation
8fc2519
to
42de55d
Compare
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
42de55d
to
7390de0
Compare
...k/plugins/security_solution/public/common/components/ml/anomaly/use_anomalies_search.test.ts
Outdated
Show resolved
Hide resolved
.../plugins/security_solution/public/overview/components/entity_analytics/anomalies/columns.tsx
Outdated
Show resolved
Hide resolved
.../plugins/security_solution/public/common/components/ml_popover/hooks/use_enable_data_feed.ts
Outdated
Show resolved
Hide resolved
@@ -19,3 +20,6 @@ export interface MlStartJobError { | |||
// Otherwise for now, has will work ok even though it casts 'unknown' to 'any' | |||
export const isMlStartJobError = (value: unknown): value is MlStartJobError => | |||
has('error.msg', value) && has('error.response', value) && has('error.statusCode', value); | |||
|
|||
export const isUnknownError = (value: unknown): value is ErrorResponseBase => | |||
has('error.error.reason', value); |
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.
error.error 😬 😅 . I know we cant probably change that object structure but dang :P
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.
Yeah, it is terrible. But that is what the API returns. 😞
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.
desk tested and reviewed
On an empty ES cluster the anomalies search API response doesn't contain the aggregation
5100d96
to
cc5470f
Compare
@jamster10 I tested that bug you found when the cluster is empty and hopefully it doesn't happen on 8.5. |
x-pack/plugins/security_solution/public/common/components/ml_popover/hooks/translations.ts
Outdated
Show resolved
Hide 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.
Checked out and tested the ML job settings
popover on the Rule Management page. Seems to work fine!
I have to admit that I'm not super familiar with the changed code, but I noticed that you've done some refactoring (e.g. useEnableDataFeed
) and clean-up, and added new tests. Thank you for that @machadoum!
Left some suggestions.
.../plugins/security_solution/public/common/components/ml_popover/hooks/use_enable_data_feed.ts
Outdated
Show resolved
Hide resolved
const [jobs, setJobs] = useState<SecurityJob[]>([]); | ||
const [loading, setLoading] = useState(true); | ||
const mlCapabilities = useMlCapabilities(); | ||
const [securitySolutionDefaultIndex] = useUiSetting$<string[]>(DEFAULT_INDEX_KEY); | ||
const http = useHttp(); | ||
const { addError } = useAppToasts(); | ||
|
||
const refetch = useRef<inputsModel.Refetch>(noop); |
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.
For example, refetching is natively supported by React Query and is a matter of simple config for a given hook.
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: cc @machadoum |
figma
issue
Summary
Add the 'Run job' button to the anomalies table. The button runs the job and installs it when the module is uninstalled.
Implementation details:
useInstalledSecurityJobs
byuseSecurityJobs
to also load uninstalled jobs.useSecurityJobs(refetchData: boolean)
refetch param from toggle to a callback function.Checklist