forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Convert isolate host to standalone flyout (elasti…
…c#211853) ## Summary Ref: elastic#207596 This PR fixed a bug where when user has a alert open in preview, then clicks isolate/release host, the panel opens in the background. This is because the isolate host panel was called via `openRightPanel`, which only replaces the panel and not opens a new flyout. To make the isolate host flyout consistent with other actions, this PR converts the panel into a normal EUI flyout. https://github.com/user-attachments/assets/7da4baa0-61ee-4166-9ff1-57c1078a1547 **How to test** - Apply license (platinum+) - To enable the isolate/release host button, you can use this command `yarn test:generate --fleet --withNewUser=test:changeme` ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- Loading branch information
1 parent
6d6db2f
commit 74e1320
Showing
7 changed files
with
220 additions
and
39 deletions.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
...ty/plugins/security_solution/public/flyout/document_details/isolate_host/content.test.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,90 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import type { AppContextTestRender } from '../../../common/mock/endpoint'; | ||
import { createAppRootMockRenderer, endpointAlertDataMock } from '../../../common/mock/endpoint'; | ||
import { FLYOUT_HOST_ISOLATION_PANEL_TEST_ID } from './test_ids'; | ||
import { IsolateHostPanelContent } from './content'; | ||
|
||
describe('<IsolateHostPanelContent />', () => { | ||
let appContextMock: AppContextTestRender; | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
appContextMock = createAppRootMockRenderer(); | ||
|
||
appContextMock.setExperimentalFlag({ | ||
responseActionsSentinelOneV1Enabled: true, | ||
responseActionsCrowdstrikeManualHostIsolationEnabled: true, | ||
}); | ||
}); | ||
|
||
it('should display content with success banner when action is isolateHost', () => { | ||
const { getByTestId } = appContextMock.render( | ||
<IsolateHostPanelContent | ||
isIsolateActionSuccessBannerVisible={true} | ||
hostName="some-host-name" | ||
alertId="some-alert-id" | ||
isolateAction="isolateHost" | ||
dataFormattedForFieldBrowser={endpointAlertDataMock.generateEndpointAlertDetailsItemData()} | ||
showAlertDetails={() => {}} | ||
handleIsolationActionSuccess={() => {}} | ||
/> | ||
); | ||
expect(getByTestId(FLYOUT_HOST_ISOLATION_PANEL_TEST_ID)).toBeInTheDocument(); | ||
expect(getByTestId('hostIsolateSuccessMessage')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should display content without success banner when action is isolateHost and success banner is not visible', () => { | ||
const { getByTestId, queryByTestId } = appContextMock.render( | ||
<IsolateHostPanelContent | ||
isIsolateActionSuccessBannerVisible={false} | ||
hostName="some-host-name" | ||
alertId="some-alert-id" | ||
isolateAction="isolateHost" | ||
dataFormattedForFieldBrowser={endpointAlertDataMock.generateEndpointAlertDetailsItemData()} | ||
showAlertDetails={() => {}} | ||
handleIsolationActionSuccess={() => {}} | ||
/> | ||
); | ||
expect(getByTestId(FLYOUT_HOST_ISOLATION_PANEL_TEST_ID)).toBeInTheDocument(); | ||
expect(queryByTestId('hostIsolateSuccessMessage')).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('should display content with success banner when action is unisolateHost', () => { | ||
const { getByTestId } = appContextMock.render( | ||
<IsolateHostPanelContent | ||
isIsolateActionSuccessBannerVisible={true} | ||
hostName="some-host-name" | ||
alertId="some-alert-id" | ||
isolateAction="unisolateHost" | ||
dataFormattedForFieldBrowser={endpointAlertDataMock.generateEndpointAlertDetailsItemData()} | ||
showAlertDetails={() => {}} | ||
handleIsolationActionSuccess={() => {}} | ||
/> | ||
); | ||
expect(getByTestId(FLYOUT_HOST_ISOLATION_PANEL_TEST_ID)).toBeInTheDocument(); | ||
expect(getByTestId('hostUnisolateSuccessMessage')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should display content without success banner when action is unisolateHost', () => { | ||
const { getByTestId, queryByTestId } = appContextMock.render( | ||
<IsolateHostPanelContent | ||
isIsolateActionSuccessBannerVisible={false} | ||
hostName="some-host-name" | ||
alertId="some-alert-id" | ||
isolateAction="unisolateHost" | ||
dataFormattedForFieldBrowser={endpointAlertDataMock.generateEndpointAlertDetailsItemData()} | ||
showAlertDetails={() => {}} | ||
handleIsolationActionSuccess={() => {}} | ||
/> | ||
); | ||
expect(getByTestId(FLYOUT_HOST_ISOLATION_PANEL_TEST_ID)).toBeInTheDocument(); | ||
expect(queryByTestId('hostUnisolateSuccessMessage')).not.toBeInTheDocument(); | ||
}); | ||
}); |
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
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.