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][Bidirectional Integrations Banner][Crowdstrike][S…
…entinelOne] Banner for bidirectional integrations (elastic#200625) ## Summary - [x] Callouts for bidirectional integrations capabilities on Sentinel One and Crowdstrike integrations. - [x] Unit tests # Screenshots <img width="1685" alt="image" src="https://github.com/user-attachments/assets/f360c391-6046-49a8-b9d4-56a598dc2b99"> <img width="1132" alt="image" src="https://github.com/user-attachments/assets/9a15dc52-172a-4ee9-8e39-831a524e5d0b"> DARK MODE <img width="1127" alt="image" src="https://github.com/user-attachments/assets/9ab39df4-960b-4a56-b9bf-8c2077304039"> ![bid](https://github.com/user-attachments/assets/7f3730f8-7eed-4ca0-a67d-7658fe98d308)
- Loading branch information
Showing
6 changed files
with
156 additions
and
3 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
50 changes: 50 additions & 0 deletions
50
...ations/sections/epm/screens/detail/components/bidirectional_integrations_callout.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,50 @@ | ||
/* | ||
* 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 RenderResult } from '@testing-library/react'; | ||
|
||
import { createFleetTestRendererMock } from '../../../../../../../mock'; | ||
|
||
import { | ||
BidirectionalIntegrationsBanner, | ||
type BidirectionalIntegrationsBannerProps, | ||
} from './bidirectional_integrations_callout'; | ||
|
||
jest.mock('react-use/lib/useLocalStorage'); | ||
|
||
describe('BidirectionalIntegrationsBanner', () => { | ||
let formProps: BidirectionalIntegrationsBannerProps; | ||
let renderResult: RenderResult; | ||
|
||
beforeEach(() => { | ||
formProps = { | ||
onDismiss: jest.fn(), | ||
}; | ||
|
||
const renderer = createFleetTestRendererMock(); | ||
|
||
renderResult = renderer.render(<BidirectionalIntegrationsBanner {...formProps} />); | ||
}); | ||
|
||
it('should render bidirectional integrations banner', () => { | ||
expect(renderResult.getByTestId('bidirectionalIntegrationsCallout')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should contain a link to documentation', () => { | ||
const docLink = renderResult.getByTestId('bidirectionalIntegrationDocLink'); | ||
|
||
expect(docLink).toBeInTheDocument(); | ||
expect(docLink.getAttribute('href')).toContain('third-party-actions.html'); | ||
}); | ||
|
||
it('should call `onDismiss` callback when user clicks dismiss', () => { | ||
renderResult.getByTestId('euiDismissCalloutButton').click(); | ||
|
||
expect(formProps.onDismiss).toBeCalled(); | ||
}); | ||
}); |
66 changes: 66 additions & 0 deletions
66
...ntegrations/sections/epm/screens/detail/components/bidirectional_integrations_callout.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,66 @@ | ||
/* | ||
* 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, { memo } from 'react'; | ||
import styled from 'styled-components'; | ||
import { EuiCallOut, EuiLink, EuiTextColor } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { useKibana } from '@kbn/kibana-react-plugin/public'; | ||
|
||
const AccentCallout = styled(EuiCallOut)` | ||
.euiCallOutHeader__title { | ||
color: ${(props) => props.theme.eui.euiColorAccent}; | ||
} | ||
background-color: ${(props) => props.theme.eui.euiPanelBackgroundColorModifiers.accent}; | ||
`; | ||
|
||
export interface BidirectionalIntegrationsBannerProps { | ||
onDismiss: () => void; | ||
} | ||
export const BidirectionalIntegrationsBanner = memo<BidirectionalIntegrationsBannerProps>( | ||
({ onDismiss }) => { | ||
const { docLinks } = useKibana().services; | ||
|
||
const bannerTitle = ( | ||
<EuiTextColor color="accent"> | ||
<FormattedMessage | ||
id="xpack.fleet.bidirectionalIntegrationsBanner.title" | ||
defaultMessage={'NEW: Response enabled integration'} | ||
/> | ||
</EuiTextColor> | ||
); | ||
|
||
return ( | ||
<AccentCallout | ||
title={bannerTitle} | ||
iconType="cheer" | ||
onDismiss={onDismiss} | ||
data-test-subj={'bidirectionalIntegrationsCallout'} | ||
> | ||
<FormattedMessage | ||
id="xpack.fleet.bidirectionalIntegrationsBanner.body" | ||
defaultMessage="Orchestrate response actions across endpoint vendors with bidirectional integrations. {learnmore}." | ||
values={{ | ||
learnmore: ( | ||
<EuiLink | ||
href={docLinks?.links.securitySolution.bidirectionalIntegrations} | ||
target="_blank" | ||
data-test-subj="bidirectionalIntegrationDocLink" | ||
> | ||
<FormattedMessage | ||
id="xpack.fleet.bidirectionalIntegrations.doc.link" | ||
defaultMessage="Learn more" | ||
/> | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
</AccentCallout> | ||
); | ||
} | ||
); | ||
BidirectionalIntegrationsBanner.displayName = 'BidirectionalIntegrationsBanner'; |
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