[8.16] [Security Assistant] Fix Security Assistant settings link behavior and adjust initial settings tab (#197323) (#197748)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[Security Assistant] Fix Security Assistant settings link behavior
and adjust initial settings tab
(#197323)](https://github.com/elastic/kibana/pull/197323)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Steph
Milovic","email":"stephanie.milovic@elastic.co"},"sourceCommit":{"committedDate":"2024-10-23T16:06:47Z","message":"[Security
Assistant] Fix Security Assistant settings link behavior and adjust
initial settings tab
(#197323)","sha":"a6dc47ddeb15d6c7b91e1abaaf83fba3eee2fef2","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:
SecuritySolution","Team:Security Generative
AI","v8.16.0","backport:version","v8.17.0"],"title":"[Security
Assistant] Fix Security Assistant settings link behavior and adjust
initial settings
tab","number":197323,"url":"https://github.com/elastic/kibana/pull/197323","mergeCommit":{"message":"[Security
Assistant] Fix Security Assistant settings link behavior and adjust
initial settings tab
(#197323)","sha":"a6dc47ddeb15d6c7b91e1abaaf83fba3eee2fef2"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197323","number":197323,"mergeCommit":{"message":"[Security
Assistant] Fix Security Assistant settings link behavior and adjust
initial settings tab
(#197323)","sha":"a6dc47ddeb15d6c7b91e1abaaf83fba3eee2fef2"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/197493","number":197493,"state":"MERGED","mergeCommit":{"sha":"942827df09a03a7356f66e98753a3e356e644371","message":"[8.x]
[Security Assistant] Fix Security Assistant settings link behavior and
adjust initial settings tab (#197323) (#197493)\n\n# Backport\n\nThis
will backport the following commits from `main` to `8.x`:\n- [[Security
Assistant] Fix Security Assistant settings link behavior\nand adjust
initial settings
tab\n(#197323)](https://github.com/elastic/kibana/pull/197323)\n\n<!---
Backport version: 9.4.3 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT
[{\"author\":{\"name\":\"Steph\nMilovic\",\"email\":\"stephanie.milovic@elastic.co\"},\"sourceCommit\":{\"committedDate\":\"2024-10-23T16:06:47Z\",\"message\":\"[Security\nAssistant]
Fix Security Assistant settings link behavior and adjust\ninitial
settings
tab\n(#197323)\",\"sha\":\"a6dc47ddeb15d6c7b91e1abaaf83fba3eee2fef2\",\"branchLabelMapping\":{\"^v9.0.0$\":\"main\",\"^v8.17.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"release_note:skip\",\"v9.0.0\",\"Team:\nSecuritySolution\",\"backport:prev-minor\",\"Team:Security
Generative\nAI\"],\"title\":\"[Security Assistant] Fix Security
Assistant settings link\nbehavior and adjust initial
settings\ntab\",\"number\":197323,\"url\":\"https://github.com/elastic/kibana/pull/197323\",\"mergeCommit\":{\"message\":\"[Security\nAssistant]
Fix Security Assistant settings link behavior and adjust\ninitial
settings
tab\n(#197323)\",\"sha\":\"a6dc47ddeb15d6c7b91e1abaaf83fba3eee2fef2\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.0.0\",\"branchLabelMappingKey\":\"^v9.0.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/197323\",\"number\":197323,\"mergeCommit\":{\"message\":\"[Security\nAssistant]
Fix Security Assistant settings link behavior and adjust\ninitial
settings
tab\n(#197323)\",\"sha\":\"a6dc47ddeb15d6c7b91e1abaaf83fba3eee2fef2\"}}]}]\nBACKPORT-->\n\nCo-authored-by:
Steph Milovic <stephanie.milovic@elastic.co>"}}]}] BACKPORT-->

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
This commit is contained in:
Kibana Machine 2024-10-25 12:04:04 +11:00 committed by GitHub
parent 84be2a07b4
commit 9bd2c8accd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 25 additions and 8 deletions

View file

@ -59,7 +59,7 @@ export const SETTINGS_PROMPT_HELP_TEXT_TITLE = i18n.translate(
export const STREAMING_TITLE = i18n.translate(
'xpack.elasticAssistant.assistant.conversations.settings.streamingTitle',
{
defaultMessage: 'STREAMING',
defaultMessage: 'Streaming',
}
);

View file

@ -37,7 +37,7 @@ interface Props {
dataViews: DataViewsContract;
selectedConversation: Conversation;
onTabChange?: (tabId: string) => void;
currentTab?: SettingsTabs;
currentTab: SettingsTabs;
}
/**
@ -65,14 +65,14 @@ export const AssistantSettingsManagement: React.FC<Props> = React.memo(
const tabsConfig = useMemo(
() => [
{
id: CONNECTORS_TAB,
label: i18n.CONNECTORS_MENU_ITEM,
},
{
id: CONVERSATIONS_TAB,
label: i18n.CONVERSATIONS_MENU_ITEM,
},
{
id: CONNECTORS_TAB,
label: i18n.CONNECTORS_MENU_ITEM,
},
{
id: SYSTEM_PROMPTS_TAB,
label: i18n.SYSTEM_PROMPTS_MENU_ITEM,

View file

@ -12,6 +12,7 @@ import {
EuiContextMenuPanel,
EuiContextMenuItem,
EuiConfirmModal,
EuiIcon,
EuiNotificationBadge,
EuiPopover,
EuiButtonIcon,
@ -69,6 +70,7 @@ export const SettingsContextMenu: React.FC<Params> = React.memo(
() =>
navigateToApp('management', {
path: 'kibana/securityAiAssistantManagement',
openInNewTab: true,
}),
[navigateToApp]
);
@ -82,6 +84,7 @@ export const SettingsContextMenu: React.FC<Params> = React.memo(
() =>
navigateToApp('management', {
path: `kibana/securityAiAssistantManagement?tab=${KNOWLEDGE_BASE_TAB}`,
openInNewTab: true,
}),
[navigateToApp]
);
@ -102,6 +105,13 @@ export const SettingsContextMenu: React.FC<Params> = React.memo(
data-test-subj={'ai-assistant-settings'}
>
{i18n.AI_ASSISTANT_SETTINGS}
<EuiIcon
css={css`
margin-left: ${euiThemeVars.euiSizeXS};
`}
size="s"
type="popout"
/>
</EuiContextMenuItem>,
<EuiContextMenuItem
aria-label={'knowledge-base'}
@ -110,6 +120,13 @@ export const SettingsContextMenu: React.FC<Params> = React.memo(
data-test-subj={'knowledge-base'}
>
{i18n.KNOWLEDGE_BASE}
<EuiIcon
css={css`
margin-left: ${euiThemeVars.euiSizeXS};
`}
size="s"
type="popout"
/>
</EuiContextMenuItem>,
<EuiContextMenuItem
aria-label={'anonymization'}

View file

@ -19,7 +19,7 @@ import {
import { useConversation } from '@kbn/elastic-assistant/impl/assistant/use_conversation';
import type { FetchConversationsResponse } from '@kbn/elastic-assistant/impl/assistant/api';
import { SECURITY_AI_SETTINGS } from '@kbn/elastic-assistant/impl/assistant/settings/translations';
import { CONNECTORS_TAB } from '@kbn/elastic-assistant/impl/assistant/settings/const';
import { CONVERSATIONS_TAB } from '@kbn/elastic-assistant/impl/assistant/settings/const';
import type { SettingsTabs } from '@kbn/elastic-assistant/impl/assistant/settings/types';
import { useKibana } from '../../common/lib/kibana';
@ -68,7 +68,7 @@ export const ManagementSettings = React.memo(() => {
const [searchParams] = useSearchParams();
const currentTab = useMemo(
() => (searchParams.get('tab') as SettingsTabs) ?? CONNECTORS_TAB,
() => (searchParams.get('tab') as SettingsTabs) ?? CONVERSATIONS_TAB,
[searchParams]
);