-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RAM] add Alert fly-out from security solution (#133691)
* add security solution flyout * fix types * performance on browserfield * cleanup * miss to rmv something * fix types + unit test * fix tets * review Jiawei * review II + cast a type * eui review * formatting Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
fa4d102
commit 3cd5257
Showing
22 changed files
with
936 additions
and
276 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
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
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
39 changes: 39 additions & 0 deletions
39
...ublic/timelines/components/side_panel/event_details/flyout/back_to_alert_details_link.tsx
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,39 @@ | ||
/* | ||
* 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 { EuiButtonEmpty, EuiText, EuiTitle } from '@elastic/eui'; | ||
import React from 'react'; | ||
import { | ||
ISOLATE_HOST, | ||
UNISOLATE_HOST, | ||
} from '../../../../../detections/components/host_isolation/translations'; | ||
import { ALERT_DETAILS } from '../translations'; | ||
|
||
const BackToAlertDetailsLinkComponent = ({ | ||
showAlertDetails, | ||
isolateAction, | ||
}: { | ||
showAlertDetails: () => void; | ||
isolateAction: 'isolateHost' | 'unisolateHost'; | ||
}) => { | ||
return ( | ||
<> | ||
<EuiButtonEmpty iconType="arrowLeft" iconSide="left" flush="left" onClick={showAlertDetails}> | ||
<EuiText size="xs"> | ||
<p>{ALERT_DETAILS}</p> | ||
</EuiText> | ||
</EuiButtonEmpty> | ||
<EuiTitle> | ||
<h2>{isolateAction === 'isolateHost' ? ISOLATE_HOST : UNISOLATE_HOST}</h2> | ||
</EuiTitle> | ||
</> | ||
); | ||
}; | ||
|
||
const BackToAlertDetailsLink = React.memo(BackToAlertDetailsLinkComponent); | ||
|
||
export { BackToAlertDetailsLink }; |
110 changes: 110 additions & 0 deletions
110
...ns/security_solution/public/timelines/components/side_panel/event_details/flyout/body.tsx
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,110 @@ | ||
/* | ||
* 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 { EuiFlyoutBody } from '@elastic/eui'; | ||
import styled from 'styled-components'; | ||
import React from 'react'; | ||
import { EndpointIsolateSuccess } from '../../../../../common/components/endpoint/host_isolation'; | ||
import { HostIsolationPanel } from '../../../../../detections/components/host_isolation'; | ||
import { BrowserFields, TimelineEventsDetailsItem } from '../../../../../../common/search_strategy'; | ||
import { ExpandableEvent, HandleOnEventClosed } from '../expandable_event'; | ||
import { HostRisk } from '../../../../../risk_score/containers'; | ||
|
||
const StyledEuiFlyoutBody = styled(EuiFlyoutBody)` | ||
.euiFlyoutBody__overflow { | ||
display: flex; | ||
flex: 1; | ||
overflow: hidden; | ||
.euiFlyoutBody__overflowContent { | ||
flex: 1; | ||
overflow: hidden; | ||
padding: ${({ theme }) => `0 ${theme.eui.paddingSizes.m} ${theme.eui.paddingSizes.m}`}; | ||
} | ||
} | ||
`; | ||
|
||
interface FlyoutBodyComponentProps { | ||
alertId: string; | ||
browserFields: BrowserFields; | ||
detailsData: TimelineEventsDetailsItem[] | null; | ||
event: { eventId: string; indexName: string }; | ||
handleIsolationActionSuccess: () => void; | ||
handleOnEventClosed: HandleOnEventClosed; | ||
hostName: string; | ||
hostRisk: HostRisk | null; | ||
isAlert: boolean; | ||
isDraggable?: boolean; | ||
isReadOnly?: boolean; | ||
isolateAction: 'isolateHost' | 'unisolateHost'; | ||
isIsolateActionSuccessBannerVisible: boolean; | ||
isHostIsolationPanelOpen: boolean; | ||
loading: boolean; | ||
rawEventData: object | undefined; | ||
showAlertDetails: () => void; | ||
timelineId: string; | ||
} | ||
|
||
const FlyoutBodyComponent = ({ | ||
alertId, | ||
browserFields, | ||
detailsData, | ||
event, | ||
handleIsolationActionSuccess, | ||
handleOnEventClosed, | ||
hostName, | ||
hostRisk, | ||
isAlert, | ||
isDraggable, | ||
isReadOnly, | ||
isolateAction, | ||
isHostIsolationPanelOpen, | ||
isIsolateActionSuccessBannerVisible, | ||
loading, | ||
rawEventData, | ||
showAlertDetails, | ||
timelineId, | ||
}: FlyoutBodyComponentProps) => { | ||
return ( | ||
<StyledEuiFlyoutBody> | ||
{isIsolateActionSuccessBannerVisible && ( | ||
<EndpointIsolateSuccess | ||
hostName={hostName} | ||
alertId={alertId} | ||
isolateAction={isolateAction} | ||
/> | ||
)} | ||
{isHostIsolationPanelOpen ? ( | ||
<HostIsolationPanel | ||
details={detailsData} | ||
cancelCallback={showAlertDetails} | ||
successCallback={handleIsolationActionSuccess} | ||
isolateAction={isolateAction} | ||
/> | ||
) : ( | ||
<ExpandableEvent | ||
browserFields={browserFields} | ||
detailsData={detailsData} | ||
event={event} | ||
isAlert={isAlert} | ||
isDraggable={isDraggable} | ||
loading={loading} | ||
rawEventData={rawEventData} | ||
timelineId={timelineId} | ||
timelineTabType="flyout" | ||
hostRisk={hostRisk} | ||
handleOnEventClosed={handleOnEventClosed} | ||
isReadOnly={isReadOnly} | ||
/> | ||
)} | ||
</StyledEuiFlyoutBody> | ||
); | ||
}; | ||
|
||
const FlyoutBody = React.memo(FlyoutBodyComponent); | ||
|
||
export { FlyoutBody }; |
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.