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] Adds new Elastic AI Assistant logo and global hea…
…der menu item (elastic#164763) ## Summary Adds new Elastic AI Assistant logo and global header menu item to all Security Solution pages. Resolves elastic/security-team#7407 New logo within the assistant itself (header and assistant avatar): <p align="center"> <img width="500" src="https://github.com/elastic/kibana/assets/2946766/2a94c2ca-37d6-49f0-af59-2b15fd37d81e" /> </p> New global header menu for both on-prem and serverless security `complete` deployments: <p align="center"> <img width="500" src="https://github.com/elastic/kibana/assets/2946766/67b030fe-fb36-4a68-9331-d636e15a68f4" /> </p> <p align="center"> <img width="500" src="https://github.com/elastic/kibana/assets/2946766/74751e3a-a88a-4b39-bec0-73497dcd98b1" /> </p> Note: If Security Assistant RBAC privileges are `NONE` (which includes serverless deployments that are NOT security `complete`), the global header button will be hidden. We can revisit the upsell messaging opportunity here for serverless deployments. ### Checklist Delete any items that are not applicable to this PR. - [X] 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/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials * @elastic/security-docs, will need to update images and make note of new global header item, will create issue... elastic/security-docs#3804 - [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
- Loading branch information
Showing
12 changed files
with
182 additions
and
42 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
x-pack/packages/kbn-elastic-assistant/impl/assistant/assistant_avatar/assistant_avatar.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,46 @@ | ||
/* | ||
* 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, { ReactNode } from 'react'; | ||
|
||
export interface AssistantAvatarProps { | ||
size?: keyof typeof sizeMap; | ||
// Required for EuiAvatar `iconType` prop | ||
// eslint-disable-next-line react/no-unused-prop-types | ||
children?: ReactNode; | ||
} | ||
|
||
export const sizeMap = { | ||
xl: 64, | ||
l: 48, | ||
m: 32, | ||
s: 24, | ||
xs: 16, | ||
}; | ||
|
||
/** | ||
* Default Elastic AI Assistant logo | ||
* | ||
* TODO: Can be removed once added to EUI | ||
*/ | ||
export const AssistantAvatar = ({ size = 's' }: AssistantAvatarProps) => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width={sizeMap[size]} | ||
height={sizeMap[size]} | ||
viewBox="0 0 64 64" | ||
fill="none" | ||
> | ||
<path fill="#F04E98" d="M36 28h24v36H36V28Z" /> | ||
<path fill="#00BFB3" d="M4 46c0-9.941 8.059-18 18-18h6v36h-6c-9.941 0-18-8.059-18-18Z" /> | ||
<path | ||
fill="#343741" | ||
d="M60 12c0 6.627-5.373 12-12 12s-12-5.373-12-12S41.373 0 48 0s12 5.373 12 12Z" | ||
/> | ||
<path fill="#FA744E" d="M6 23C6 10.85 15.85 1 28 1v22H6Z" /> | ||
</svg> | ||
); |
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
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
56 changes: 56 additions & 0 deletions
56
x-pack/plugins/security_solution/public/app/home/global_header/assistant_header_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,56 @@ | ||
/* | ||
* 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 { EuiFlexGroup, EuiFlexItem, EuiHeaderLink, EuiToolTip } from '@elastic/eui'; | ||
import React, { useCallback } from 'react'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import { useAssistantContext } from '@kbn/elastic-assistant/impl/assistant_context'; | ||
import { AssistantAvatar } from '@kbn/elastic-assistant'; | ||
|
||
const isMac = navigator.platform.toLowerCase().indexOf('mac') >= 0; | ||
|
||
/** | ||
* Elastic AI Assistant header link | ||
*/ | ||
export const AssistantHeaderLink = React.memo(() => { | ||
const { showAssistantOverlay } = useAssistantContext(); | ||
|
||
const keyboardShortcut = isMac ? '⌘ ;' : 'Ctrl ;'; | ||
|
||
const tooltipContent = i18n.translate( | ||
'xpack.securitySolution.globalHeader.assistantHeaderLinkShortcutTooltip', | ||
{ | ||
values: { keyboardShortcut }, | ||
defaultMessage: 'Keyboard shortcut {keyboardShortcut}', | ||
} | ||
); | ||
|
||
const showOverlay = useCallback( | ||
() => showAssistantOverlay({ showOverlay: true }), | ||
[showAssistantOverlay] | ||
); | ||
|
||
return ( | ||
<EuiToolTip content={tooltipContent}> | ||
<EuiHeaderLink data-test-subj="assistantHeaderLink" color="primary" onClick={showOverlay}> | ||
<EuiFlexGroup gutterSize="s" alignItems="center"> | ||
<EuiFlexItem grow={false}> | ||
<AssistantAvatar size="xs" /> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
{i18n.translate('xpack.securitySolution.globalHeader.assistantHeaderLink', { | ||
defaultMessage: 'AI Assistant', | ||
})} | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiHeaderLink> | ||
</EuiToolTip> | ||
); | ||
}); | ||
|
||
AssistantHeaderLink.displayName = 'AssistantHeaderLink'; |
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.