forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EDR Workflows] Endpoint Insights UI (elastic#202209)
## Description This PR introduces the **Endpoint Insights generation functionality**. It covers the happy path, providing a complete MVP flow of the feature. Please make sure to enable feature flag(`defendInsights`) when testing locally as well as enable defendInsights [here](https://github.com/szwarckonrad/kibana/blob/efc0568e014105637332533e37491f074ec8fe2b/x-pack/packages/kbn-elastic-assistant-common/impl/capabilities/index.ts#L23). ### Flow Overview - **Initial Load**: - Fetches already generated insights and ongoing scans on page load. - If ongoing scans are detected: - Polls periodically until no active scans remain. - Refetches insights to account for those generated during the scans. - Enables the **Scan** button once the above steps complete. - **Scan Trigger**: - On clicking the **Scan** button: - Calls an API to trigger new insight generation. - Repeats the polling and refetching process until no active scans are running. - **Insights Rendering**: - Displays generated insights as panels. - Clicking a panel redirects the user to the **Trusted Apps** page with a prefilled modal. - On successful creation of a trusted app entry: - Redirects the user back to the **Endpoint Details** page. https://github.com/user-attachments/assets/72cb62a0-a66f-4a89-bbef-c41c53cdc3a2 --------- Co-authored-by: Joey F. Poon <joey.poon@elastic.co> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
85a0273
commit d12d079
Showing
24 changed files
with
1,088 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...management/components/artifact_list_page/hooks/use_mark_workflow_insight_as_remediated.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { useMutation } from '@tanstack/react-query'; | ||
import { WORKFLOW_INSIGHTS } from '../../../pages/endpoint_hosts/view/translations'; | ||
import type { SecurityWorkflowInsight } from '../../../../../common/endpoint/types/workflow_insights'; | ||
import { ActionType } from '../../../../../common/endpoint/types/workflow_insights'; | ||
import { resolvePathVariables } from '../../../../common/utils/resolve_path_variables'; | ||
import { WORKFLOW_INSIGHTS_UPDATE_ROUTE } from '../../../../../common/endpoint/constants'; | ||
import { useKibana, useToasts } from '../../../../common/lib/kibana'; | ||
|
||
export const useMarkInsightAsRemediated = (backUrl?: string) => { | ||
const toasts = useToasts(); | ||
const { | ||
application: { navigateToUrl }, | ||
http, | ||
} = useKibana().services; | ||
return useMutation<SecurityWorkflowInsight, Error, { insightId: string }>( | ||
({ insightId }: { insightId: string }) => | ||
http.put<SecurityWorkflowInsight>( | ||
resolvePathVariables(WORKFLOW_INSIGHTS_UPDATE_ROUTE, { insightId }), | ||
{ | ||
version: '1', | ||
body: JSON.stringify({ | ||
action: { | ||
type: ActionType.Remediated, | ||
}, | ||
}), | ||
} | ||
), | ||
{ | ||
onError: (err) => { | ||
toasts.addDanger({ | ||
title: WORKFLOW_INSIGHTS.toasts.updateInsightError, | ||
text: err?.message, | ||
}); | ||
}, | ||
onSuccess: () => { | ||
if (backUrl) return navigateToUrl(backUrl); | ||
}, | ||
} | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.