Skip to content

Commit 28bb18e

Browse files
authored
move mcp servers and agent runtimes to dedicated ai settings (#3051)
1 parent d880852 commit 28bb18e

23 files changed

Lines changed: 249 additions & 174 deletions

assets/src/components/ai/AI.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,28 @@ import { FeatureFlagContext } from 'components/flows/FeatureFlagContext'
1010
import usePersistedState from 'components/hooks/usePersistedState'
1111
import { StretchedFlex } from 'components/utils/StretchedFlex'
1212
import { SubTabs } from 'components/utils/SubTabs'
13-
import { use, useMemo } from 'react'
13+
import { isNil } from 'lodash'
14+
import { use, useLayoutEffect, useMemo } from 'react'
1415
import { Link, Outlet, useMatch } from 'react-router-dom'
1516
import {
1617
AI_ABS_PATH,
1718
AI_AGENT_RUNS_REL_PATH,
18-
AI_AGENT_RUNTIMES_REL_PATH,
1919
AI_AGENT_SESSIONS_REL_PATH,
2020
AI_INFRA_RESEARCH_REL_PATH,
21-
AI_MCP_SERVERS_REL_PATH,
2221
AI_SENTINELS_REL_PATH,
2322
AI_THREADS_REL_PATH,
2423
} from 'routes/aiRoutesConsts'
25-
import { GLOBAL_SETTINGS_ABS_PATH } from 'routes/settingsRoutesConst'
24+
import {
25+
AI_SETTINGS_ABS_PATH,
26+
AI_SETTINGS_AI_PROVIDER_ABS_PATH,
27+
} from 'routes/settingsRoutesConst'
2628
import styled from 'styled-components'
2729
import {
2830
useAIEnabled,
2931
useLoadingDeploymentSettings,
3032
} from '../contexts/DeploymentSettingsContext'
3133
import LoadingIndicator from '../utils/LoadingIndicator'
32-
import { AI_PROVIDER_ABS_PATH, AIDisabledState } from './AIThreads'
34+
import { AIDisabledState } from './AIThreads'
3335

3436
const DISMISSED_AI_ENABLED_DIALOG_KEY = 'dismissedAIEnabledDialog'
3537

@@ -38,12 +40,8 @@ const getDirectory = (agentEnabled: boolean) => [
3840
{ label: 'Sentinels', path: AI_SENTINELS_REL_PATH },
3941
{ label: 'Chat threads', path: AI_THREADS_REL_PATH },
4042
{ label: 'Infra research', path: AI_INFRA_RESEARCH_REL_PATH },
41-
{ label: 'MCP servers', path: AI_MCP_SERVERS_REL_PATH },
4243
...(agentEnabled
43-
? [
44-
{ label: 'Agent runtimes', path: AI_AGENT_RUNTIMES_REL_PATH },
45-
{ label: 'Agent runs', path: AI_AGENT_RUNS_REL_PATH },
46-
]
44+
? [{ label: 'Agent runs', path: AI_AGENT_RUNS_REL_PATH }]
4745
: []),
4846
]
4947

@@ -57,12 +55,16 @@ export function AI() {
5755
const aiEnabled = useAIEnabled()
5856
const [showEnableAIDialog, setShowEnableAIDialog] = usePersistedState(
5957
DISMISSED_AI_ENABLED_DIALOG_KEY,
60-
!aiEnabled
58+
false
6159
)
6260
const loading = useLoadingDeploymentSettings()
6361
const agentEnabled = !!use(FeatureFlagContext).featureFlags.Agent
6462
useSetBreadcrumbs(useMemo(() => getAIBreadcrumbs(tab), [tab]))
6563

64+
useLayoutEffect(() => {
65+
if (!isNil(aiEnabled)) setShowEnableAIDialog(!aiEnabled)
66+
}, [aiEnabled, setShowEnableAIDialog])
67+
6668
if (loading) return <LoadingIndicator />
6769

6870
return (
@@ -74,7 +76,7 @@ export function AI() {
7476
clickable
7577
icon={<GearTrainIcon />}
7678
as={Link}
77-
to={`${GLOBAL_SETTINGS_ABS_PATH}/ai-provider`}
79+
to={AI_SETTINGS_ABS_PATH}
7880
tooltip="AI Settings"
7981
type="floating"
8082
/>
@@ -95,7 +97,7 @@ export function AI() {
9597
</Button>
9698
<Button
9799
as={Link}
98-
to={AI_PROVIDER_ABS_PATH}
100+
to={AI_SETTINGS_AI_PROVIDER_ABS_PATH}
99101
>
100102
Go to settings
101103
</Button>

assets/src/components/ai/AIThreads.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from 'generated/graphql.ts'
1313
import { ReactNode, useMemo } from 'react'
1414
import { Link } from 'react-router-dom'
15-
import { GLOBAL_SETTINGS_ABS_PATH } from '../../routes/settingsRoutesConst.tsx'
15+
import { AI_SETTINGS_AI_PROVIDER_ABS_PATH } from '../../routes/settingsRoutesConst.tsx'
1616

1717
import { createColumnHelper } from '@tanstack/react-table'
1818
import { GqlError } from 'components/utils/Alert.tsx'
@@ -22,8 +22,6 @@ import { mapExistingNodes } from 'utils/graphql.ts'
2222
import { Body1BoldP } from '../utils/typography/Text.tsx'
2323
import { AITableEntry, sortThreadsOrPins } from './AITableEntry.tsx'
2424

25-
export const AI_PROVIDER_ABS_PATH = `${GLOBAL_SETTINGS_ABS_PATH}/ai-provider`
26-
2725
const columnHelper = createColumnHelper<ChatThreadTinyFragment>()
2826

2927
export function AIThreads() {
@@ -140,7 +138,7 @@ export function AIDisabledState({
140138
<Button
141139
as={Link}
142140
startIcon={<GearTrainIcon />}
143-
to={AI_PROVIDER_ABS_PATH}
141+
to={AI_SETTINGS_AI_PROVIDER_ABS_PATH}
144142
>
145143
Go to settings
146144
</Button>

assets/src/components/ai/agent-runs/AIAgentRuns.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { mapExistingNodes } from 'utils/graphql'
1616
import { isNonNullable } from 'utils/isNonNullable'
1717
import { AIAgentRuntimesSelector } from './AIAgentRuntimesSelector'
1818
import { CreateAgentRunButton } from './CreateAgentRun'
19-
import { AgentRuntimeIconFrame } from '../agent-runtimes/AiAgentRuntimeIcon.tsx'
19+
import { AgentRuntimeIconFrame } from 'components/settings/ai/agent-runtimes/AIAgentRuntimeIcon'
2020

2121
export function AIAgentRuns() {
2222
const navigate = useNavigate()

assets/src/components/flows/flow/ChangeMcpConnectionsModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
ColConfirm,
55
ColInfo,
66
McpTableAction,
7-
} from 'components/ai/mcp/McpServerTableCols'
7+
} from 'components/settings/ai/mcp/McpServerTableCols'
88
import { GqlError, GqlErrorType } from 'components/utils/Alert'
99
import { Body2BoldP } from 'components/utils/typography/Text'
1010
import { McpServerFragment } from 'generated/graphql'

assets/src/components/flows/flow/FlowMcpConnections.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
ColConfirm,
1212
ColInfo,
1313
McpTableAction,
14-
} from 'components/ai/mcp/McpServerTableCols'
14+
} from 'components/settings/ai/mcp/McpServerTableCols'
1515
import { useSetPageHeaderContent } from 'components/cd/ContinuousDeployment'
1616
import { GqlError } from 'components/utils/Alert'
1717
import {

assets/src/components/security/vulnerabilities/VulnDetailExpanded.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function CVSSSection({
128128
{ name: 'Network', value: VulnAttackVector.Network },
129129
]}
130130
colorMap={{
131-
PHYSICAL: 'success',
131+
PHYSICAL: 'neutral',
132132
LOCAL: 'warning',
133133
ADJACENT: 'danger',
134134
NETWORK: 'critical',

assets/src/components/settings/Settings.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { PersonaConfigurationFragment } from 'generated/graphql'
1919
import { ReactNode, useMemo, useState } from 'react'
2020
import { Link, Outlet, useLocation } from 'react-router-dom'
2121
import {
22+
AI_SETTINGS_REL_PATH,
2223
AUDITS_REL_PATH,
2324
GLOBAL_SETTINGS_REL_PATH,
2425
NOTIFICATIONS_REL_PATH,
@@ -33,6 +34,7 @@ const getDirectory = (
3334
): Directory => [
3435
{ path: USER_MANAGEMENT_REL_PATH, label: 'User management' },
3536
{ path: GLOBAL_SETTINGS_REL_PATH, label: 'Global settings' },
37+
{ path: AI_SETTINGS_REL_PATH, label: 'AI settings' },
3638
{ path: PROJECT_SETTINGS_REL_PATH, label: 'Project settings' },
3739
{ path: NOTIFICATIONS_REL_PATH, label: 'Notifications' },
3840
{
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { Outlet, useMatch } from 'react-router-dom'
2+
3+
import { useMemo, useRef } from 'react'
4+
5+
import {
6+
AI_SETTINGS_ABS_PATH,
7+
AI_SETTINGS_AI_PROVIDER_REL_PATH,
8+
} from 'routes/settingsRoutesConst'
9+
10+
import { SubTab, TabList, useSetBreadcrumbs } from '@pluralsh/design-system'
11+
import { useSetPageHeaderContent } from 'components/cd/ContinuousDeployment'
12+
import { LinkTabWrap } from 'components/utils/Tabs'
13+
14+
import { SETTINGS_BREADCRUMBS } from '../Settings'
15+
16+
export const getAISettingsBreadcrumbs = (tab: string) => [
17+
...SETTINGS_BREADCRUMBS,
18+
{ label: 'ai', url: AI_SETTINGS_ABS_PATH },
19+
{ label: tab, url: getAISettingsAbsPath(tab) },
20+
]
21+
22+
const directory = [
23+
{ path: AI_SETTINGS_AI_PROVIDER_REL_PATH, label: 'AI providers' },
24+
{ path: 'agent-runtimes', label: 'Agent runtimes' },
25+
{ path: 'mcp-servers', label: 'MCP servers' },
26+
]
27+
28+
export function AISettings() {
29+
const tabStateRef = useRef<any>(null)
30+
const tab = useMatch(`${AI_SETTINGS_ABS_PATH}/:tab`)?.params.tab ?? ''
31+
32+
useSetBreadcrumbs(useMemo(() => getAISettingsBreadcrumbs(tab ?? ''), [tab]))
33+
useSetPageHeaderContent(
34+
<TabList
35+
scrollable
36+
stateRef={tabStateRef}
37+
stateProps={{ selectedKey: tab }}
38+
>
39+
{directory.map(({ label, path }) => (
40+
<LinkTabWrap
41+
subTab
42+
key={path}
43+
textValue={label}
44+
to={getAISettingsAbsPath(path)}
45+
>
46+
<SubTab
47+
key={path}
48+
textValue={label}
49+
>
50+
{label}
51+
</SubTab>
52+
</LinkTabWrap>
53+
))}
54+
</TabList>
55+
)
56+
57+
return <Outlet />
58+
}
59+
60+
const getAISettingsAbsPath = (tab: string) => `${AI_SETTINGS_ABS_PATH}/${tab}`

assets/src/components/settings/global/GlobalSettingsAiProvider.tsx renamed to assets/src/components/settings/ai/AISettingsProvider.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ import { PartialDeep } from 'type-fest'
3333
import {
3434
AIVerbosityLevel,
3535
useExplainWithAIContext,
36-
} from '../../ai/AIContext.tsx'
37-
import { GqlError } from '../../utils/Alert.tsx'
36+
} from 'components/ai/AIContext.tsx'
37+
import { GqlError } from 'components/utils/Alert.tsx'
3838
import {
39+
initialSettingsAttributes,
40+
OpenAISettings,
3941
AnthropicSettings,
42+
OllamaSettings,
4043
AzureSettings,
4144
BedrockSettings,
42-
initialSettingsAttributes,
43-
OllamaSettings,
44-
OpenAISettings,
45-
validateAttributes,
4645
VertexSettings,
47-
} from './GlobalSettingsAIProviders.tsx'
46+
validateAttributes,
47+
} from './AISettingsProviders.tsx'
4848

4949
const updateSettings = produce(
5050
(
@@ -57,7 +57,7 @@ const updateSettings = produce(
5757
}
5858
)
5959

60-
export function GlobalSettingsAiProvider() {
60+
export function AISettingsProvider() {
6161
const theme = useTheme()
6262
const { ai } = useDeploymentSettings()
6363
const [enabled, setEnabled] = useState<boolean>(ai?.enabled ?? false)

assets/src/components/settings/global/GlobalSettingsAIProviders.tsx renamed to assets/src/components/settings/ai/AISettingsProviders.tsx

File renamed without changes.

0 commit comments

Comments
 (0)