Skip to content

Commit 6427394

Browse files
committed
Revert "feat: add disabled state for the mcp servers page (#894)"
This reverts commit ab213ea.
1 parent b255dfc commit 6427394

File tree

11 files changed

+329
-569
lines changed

11 files changed

+329
-569
lines changed

renderer/src/common/components/ui/button.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ const buttonVariants = cva(
1313
'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
1414
destructive:
1515
'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
16-
enable:
17-
'bg-green-600 text-white shadow-xs hover:bg-green-700 focus-visible:ring-green-500/20 dark:bg-green-600/80',
1816
outline:
1917
'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
2018
secondary:

renderer/src/features/clients/components/__tests__/enable-group-button.test.tsx

Lines changed: 0 additions & 91 deletions
This file was deleted.

renderer/src/features/clients/components/__tests__/manage-clients-button.test.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { http, HttpResponse } from 'msw'
99
import { PromptProvider } from '@/common/contexts/prompt/provider'
1010
import { mswEndpoint } from '@/common/mocks/customHandlers'
1111

12+
// Use the shared request recorder from mocks/node.ts for consistency
13+
1214
describe('ManageClientsButton – BDD flows', () => {
1315
let queryClient: QueryClient
1416

@@ -86,22 +88,26 @@ describe('ManageClientsButton – BDD flows', () => {
8688
body: { name: 'cursor', groups: ['default'] },
8789
},
8890
])
91+
// no-op: global recorder persists; we reset via recordRequests() per test
8992
})
9093

9194
it('enables a single client when none are enabled (clients API returns null)', async () => {
95+
// Given: no clients are registered in the group
9296
server.use(
9397
http.get(mswEndpoint('/api/v1beta/groups'), () =>
9498
HttpResponse.json({
9599
groups: [{ name: 'default', registered_clients: [] }],
96100
})
97101
),
102+
// Simulate backend returning null for current clients list
98103
http.get(mswEndpoint('/api/v1beta/clients'), () =>
99104
HttpResponse.json(null)
100105
)
101106
)
102107

103108
const rec = recordRequests()
104109

110+
// When: the user enables only VS Code and saves
105111
const user = userEvent.setup()
106112
renderWithProviders({ groupName: 'default' })
107113
await user.click(
@@ -110,6 +116,7 @@ describe('ManageClientsButton – BDD flows', () => {
110116
await user.click(await screen.findByRole('switch', { name: 'vscode' }))
111117
await user.click(await screen.findByRole('button', { name: /save/i }))
112118

119+
// Then: exactly one POST registration should be sent
113120
await waitFor(() =>
114121
expect(
115122
rec.recordedRequests.filter(

renderer/src/features/clients/components/enable-group-button.tsx

Lines changed: 0 additions & 43 deletions
This file was deleted.

renderer/src/features/clients/components/manage-clients-button.tsx

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
import { usePrompt } from '@/common/hooks/use-prompt'
2+
import type { UseFormReturn } from 'react-hook-form'
3+
import { Label } from '@/common/components/ui/label'
14
import { Button } from '@/common/components/ui/button'
5+
import { Switch } from '@/common/components/ui/switch'
26
import { Code } from 'lucide-react'
3-
import { useManageClientsDialog } from '../hooks/use-manage-clients-dialog'
7+
import { z } from 'zod/v4'
8+
import { zodV4Resolver } from '@/common/lib/zod-v4-resolver'
9+
import { useManageClients } from '../hooks/use-manage-clients'
10+
import { useToastMutation } from '@/common/hooks/use-toast-mutation'
411

512
interface ManageClientsButtonProps {
613
groupName: string
@@ -19,12 +26,81 @@ export function ManageClientsButton({
1926
variant = 'outline',
2027
className,
2128
}: ManageClientsButtonProps) {
22-
const { openDialog } = useManageClientsDialog(groupName)
29+
const promptForm = usePrompt()
30+
31+
const {
32+
installedClients,
33+
defaultValues,
34+
reconcileGroupClients,
35+
getClientFieldName,
36+
} = useManageClients(groupName)
37+
38+
const { mutateAsync: saveClients } = useToastMutation({
39+
mutationFn: reconcileGroupClients,
40+
loadingMsg: 'Saving client settings...',
41+
successMsg: 'Client settings saved',
42+
errorMsg: 'Failed to save client settings',
43+
})
44+
45+
const handleManageClients = async () => {
46+
const formSchema = z.object(
47+
installedClients.reduce(
48+
(acc, client) => {
49+
const fieldName = getClientFieldName(client.client_type!)
50+
acc[fieldName] = z.boolean()
51+
return acc
52+
},
53+
{} as Record<string, z.ZodBoolean>
54+
)
55+
)
56+
57+
const result = await promptForm({
58+
title: 'Manage Clients',
59+
defaultValues,
60+
resolver: zodV4Resolver(formSchema),
61+
fields: (form: UseFormReturn<Record<string, boolean>>) => (
62+
<div className="rounded-xl border">
63+
{installedClients.map((client) => {
64+
const fieldName = getClientFieldName(client.client_type!)
65+
const displayName = client.client_type!
66+
67+
return (
68+
<div
69+
key={client.client_type}
70+
className="flex items-start gap-2 border-b p-4 align-middle last:border-b-0"
71+
>
72+
<Switch
73+
id={fieldName}
74+
checked={form.watch(fieldName) as boolean}
75+
onCheckedChange={(checked) => {
76+
form.setValue(fieldName, checked)
77+
form.trigger(fieldName)
78+
}}
79+
/>
80+
81+
<Label htmlFor={fieldName} className="text-sm font-medium">
82+
{displayName}
83+
</Label>
84+
</div>
85+
)
86+
})}
87+
</div>
88+
),
89+
buttons: {
90+
confirm: 'Save',
91+
cancel: 'Cancel',
92+
},
93+
})
94+
95+
if (result) {
96+
await saveClients(result)
97+
}
98+
}
2399

24100
return (
25101
<Button
26102
variant={variant}
27-
onClick={() => openDialog()}
103+
onClick={handleManageClients}
28104
className={className}
29105
>
30106
<Code className="mr-2 h-4 w-4" />

renderer/src/features/clients/hooks/use-manage-clients-dialog.tsx

Lines changed: 0 additions & 85 deletions
This file was deleted.

renderer/src/features/mcp-servers/components/card-mcp-server/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,13 @@ export function CardMcpServer({
9494
url,
9595
remote,
9696
transport,
97-
isInDisabledGroup,
9897
}: {
9998
name: string
10099
status: CoreWorkload['status']
101100
statusContext: CoreWorkload['status_context']
102101
remote?: CoreWorkload['remote']
103102
url: string
104103
transport: CoreWorkload['transport_type']
105-
isInDisabledGroup?: boolean
106104
}) {
107105
const isRemoteMcpEnabled = useFeatureFlag(featureFlagKeys.REMOTE_MCP)
108106
const nameRef = useRef<HTMLElement | null>(null)
@@ -154,7 +152,6 @@ export function CardMcpServer({
154152
'transition-all duration-300 ease-in-out',
155153
isNewServer ? 'ring-2' : undefined,
156154
isDeleting ? 'pointer-events-none opacity-50' : undefined,
157-
isInDisabledGroup ? 'opacity-50 grayscale' : undefined,
158155
(isTransitioning || hadRecentStatusChange) && 'animate-diagonal-ring',
159156
isStopped && 'bg-card/65'
160157
)}

0 commit comments

Comments
 (0)