Skip to content

Commit

Permalink
[Security Assistant] Fix Security Assistant settings link behavior an…
Browse files Browse the repository at this point in the history
…d adjust initial settings tab (#197323)
  • Loading branch information
stephmilovic authored Oct 23, 2024
1 parent d153584 commit a6dc47d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interface Props {
dataViews: DataViewsContract;
selectedConversation: Conversation;
onTabChange?: (tabId: string) => void;
currentTab?: SettingsTabs;
currentTab: SettingsTabs;
}

/**
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
EuiContextMenuPanel,
EuiContextMenuItem,
EuiConfirmModal,
EuiIcon,
EuiNotificationBadge,
EuiPopover,
EuiButtonIcon,
Expand Down Expand Up @@ -68,6 +69,7 @@ export const SettingsContextMenu: React.FC<Params> = React.memo(
() =>
navigateToApp('management', {
path: 'kibana/securityAiAssistantManagement',
openInNewTab: true,
}),
[navigateToApp]
);
Expand All @@ -81,6 +83,7 @@ export const SettingsContextMenu: React.FC<Params> = React.memo(
() =>
navigateToApp('management', {
path: `kibana/securityAiAssistantManagement?tab=${KNOWLEDGE_BASE_TAB}`,
openInNewTab: true,
}),
[navigateToApp]
);
Expand All @@ -101,6 +104,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'}
Expand All @@ -109,6 +119,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'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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]
);

Expand Down

0 comments on commit a6dc47d

Please sign in to comment.