7
7
Card ,
8
8
CardContent ,
9
9
CardHeader ,
10
- Chip ,
11
10
CircularProgress ,
12
11
Collapse ,
13
12
Divider ,
@@ -16,7 +15,6 @@ import {
16
15
ListItem ,
17
16
ListItemText ,
18
17
Stack ,
19
- Theme ,
20
18
Typography
21
19
} from '@mui/material' ;
22
20
import { useEffect , useState } from 'react' ;
@@ -26,7 +24,6 @@ import ContinueIcon from '../../assets/continue.svg';
26
24
import CursorIcon from '../../assets/cursor.svg' ;
27
25
import GordonIcon from '../../assets/gordon-icon.png' ;
28
26
import { CATALOG_LAYOUT_SX , DOCKER_MCP_COMMAND } from '../../Constants' ;
29
- import { LinkOffOutlined , LinkOutlined } from '@mui/icons-material' ;
30
27
31
28
// Initialize the Docker Desktop client
32
29
const client = createDockerDesktopClient ( ) ;
@@ -42,16 +39,6 @@ const iconMap = {
42
39
'Continue.dev' : ContinueIcon ,
43
40
} ;
44
41
45
- const ConnectButtonStyle = ( theme : Theme ) => ( {
46
- fontSize : '1.3em' ,
47
- p : 1 ,
48
- alignItems : 'center' ,
49
- justifyContent : 'center' ,
50
- [ theme . breakpoints . down ( 'sm' ) ] : {
51
- fontSize : '1em' ,
52
- } ,
53
- } ) ;
54
-
55
42
const MCPClientSettings = ( { appProps } : MCPClientSettingsProps ) => {
56
43
// Extract all the values we need from appProps
57
44
const { mcpClientStates, updateMCPClientStates } = appProps ;
@@ -140,7 +127,6 @@ function ClientSetting({
140
127
mcpClientState : any ;
141
128
appProps : any ;
142
129
} ) {
143
-
144
130
const [ expanded , setExpanded ] = useState ( false ) ;
145
131
146
132
// Extract all the values we need from appProps
@@ -163,68 +149,75 @@ function ClientSetting({
163
149
/>
164
150
)
165
151
}
166
- title = { < Typography variant = "subtitle2" > { name } { mcpClientState . exists ? '' : < Chip sx = { { ml : 1 } } label = "Not detected" color = "error" size = "small" /> } </ Typography > }
152
+ title = { < Typography variant = "subtitle2" > { name } </ Typography > }
167
153
subheader = {
168
- < Typography
169
- variant = "body2"
170
- sx = { {
171
- color : 'text.secondary' ,
172
- alignItems : 'center ' ,
173
- display : 'flex ' ,
174
- cursor : 'pointer ' ,
175
- } }
176
- onClick = { ( ) => setExpanded ( ! expanded ) }
177
- >
178
- Manual configuration
179
- {
180
- expanded ? (
154
+ mcpClientState . exists ? (
155
+ < Typography
156
+ variant = "body2"
157
+ sx = { {
158
+ color : 'text.secondary ' ,
159
+ alignItems : 'center ' ,
160
+ display : 'flex ' ,
161
+ cursor : 'pointer' ,
162
+ } }
163
+ onClick = { ( ) => setExpanded ( ! expanded ) }
164
+ >
165
+ Manual configuration
166
+ { expanded ? (
181
167
< KeyboardArrowDownIcon fontSize = "small" />
182
168
) : (
183
169
< KeyboardArrowRightIcon fontSize = "small" />
184
- )
185
- }
186
- </ Typography >
170
+ ) }
171
+ </ Typography >
172
+ ) : (
173
+ < Typography
174
+ variant = "body2"
175
+ sx = { {
176
+ color : 'text.secondary' ,
177
+ } }
178
+ >
179
+ Client not installed
180
+ </ Typography >
181
+ )
187
182
}
188
183
action = {
189
- < Stack direction = "row" spacing = { 1 } >
190
- {
191
- mcpClientState . exists && mcpClientState . configured && (
192
- < Button
193
- onClick = { async ( ) => {
184
+ < Stack direction = "row" spacing = { 1 } >
185
+ { mcpClientState . exists && mcpClientState . configured && (
186
+ < Button
187
+ onClick = { async ( ) => {
188
+ setButtonsLoading ( {
189
+ ...buttonsLoading ,
190
+ [ name ] : true ,
191
+ } ) ;
192
+ try {
193
+ await disconnectClient ( name ) ;
194
+ } finally {
194
195
setButtonsLoading ( {
195
196
...buttonsLoading ,
196
- [ name ] : true ,
197
+ [ name ] : false ,
197
198
} ) ;
198
- try {
199
- await disconnectClient ( name ) ;
200
- } finally {
201
- setButtonsLoading ( {
202
- ...buttonsLoading ,
203
- [ name ] : false ,
204
- } ) ;
205
- }
206
- } }
207
- disabled = {
208
- buttonsLoading [ name ] ||
209
- Boolean ( mcpClientState . preventAutoConnectMessage )
210
199
}
211
- >
212
- < Stack direction = "row" alignItems = "center" spacing = { 1 } sx = { ConnectButtonStyle } >
213
- { ( buttonsLoading [ name ] && (
214
- < >
215
- < Typography sx = { { fontSize : 12 , width : 70 } } >
216
- Connect
217
- </ Typography >
218
- < CircularProgress size = { 12 } />
219
- </ >
220
- ) ) || (
221
- < Typography sx = { { fontSize : 12 , width : 90 } } >
222
- Disconnect
223
- </ Typography >
224
- ) }
225
- </ Stack >
226
- </ Button >
227
- ) }
200
+ } }
201
+ disabled = { buttonsLoading [ name ] }
202
+ color = "warning"
203
+ size = "small"
204
+ >
205
+ < Stack direction = "row" alignItems = "center" spacing = { 1 } >
206
+ { ( buttonsLoading [ name ] && (
207
+ < >
208
+ < Typography sx = { { fontSize : 12 , width : 70 } } >
209
+ Connect
210
+ </ Typography >
211
+ < CircularProgress size = { 12 } />
212
+ </ >
213
+ ) ) || (
214
+ < Typography sx = { { fontSize : 12 , width : 90 } } >
215
+ Disconnect
216
+ </ Typography >
217
+ ) }
218
+ </ Stack >
219
+ </ Button >
220
+ ) }
228
221
{ mcpClientState . exists && ! mcpClientState . configured && (
229
222
< Button
230
223
sx = { { fontSize : 12 } }
@@ -238,23 +231,15 @@ function ClientSetting({
238
231
} finally {
239
232
setButtonsLoading ( {
240
233
...buttonsLoading ,
241
- [ name ] : true ,
234
+ [ name ] : false ,
242
235
} ) ;
243
- try {
244
- await connectClient ( name ) ;
245
- } finally {
246
- setButtonsLoading ( {
247
- ...buttonsLoading ,
248
- [ name ] : false ,
249
- } ) ;
250
- }
251
236
}
252
237
} }
253
238
disabled = { buttonsLoading [ name ] }
254
239
color = "primary"
255
240
size = "small"
256
241
>
257
- < Stack direction = "row" alignItems = "center" spacing = { 1 } sx = { ConnectButtonStyle } >
242
+ < Stack direction = "row" alignItems = "center" spacing = { 1 } >
258
243
{ ( buttonsLoading [ name ] && (
259
244
< >
260
245
< Typography sx = { { fontSize : 12 , width : 70 } } >
@@ -270,47 +255,46 @@ function ClientSetting({
270
255
</ Stack >
271
256
</ Button >
272
257
) }
273
- {
274
- ! mcpClientState . exists && (
275
- < Button
276
- sx = { { fontSize : 12 } }
277
- size = "small"
278
- disabled
279
- onClick = { async ( ) => {
258
+ { ! mcpClientState . exists && (
259
+ < Button
260
+ sx = { { fontSize : 12 } }
261
+ size = "small"
262
+ disabled
263
+ onClick = { async ( ) => {
264
+ setButtonsLoading ( {
265
+ ...buttonsLoading ,
266
+ [ name ] : true ,
267
+ } ) ;
268
+ try {
269
+ await connectClient ( name ) ;
270
+ } finally {
280
271
setButtonsLoading ( {
281
272
...buttonsLoading ,
282
- [ name ] : true ,
273
+ [ name ] : false ,
283
274
} ) ;
284
- try {
285
- await connectClient ( name ) ;
286
- } finally {
287
- setButtonsLoading ( {
288
- ...buttonsLoading ,
289
- [ name ] : true ,
290
- } ) ;
291
- }
292
- } }
293
- >
294
- < Stack direction = "row" alignItems = "center" spacing = { 1 } sx = { ConnectButtonStyle } >
295
- { ( buttonsLoading [ name ] && (
296
- < >
297
- < Typography sx = { { fontSize : 12 , width : 70 } } >
298
- Disconnect
299
- </ Typography >
300
- < CircularProgress size = { 12 } />
301
- </ >
302
- ) ) || (
303
- < Typography sx = { { fontSize : 12 , width : 90 } } >
304
- Connect
305
- </ Typography >
306
- ) }
307
- </ Stack >
308
- </ Button >
309
- ) }
310
- </ Stack >
275
+ }
276
+ } }
277
+ >
278
+ < Stack direction = "row" alignItems = "center" spacing = { 1 } >
279
+ { ( buttonsLoading [ name ] && (
280
+ < >
281
+ < Typography sx = { { fontSize : 12 , width : 70 } } >
282
+ Disconnect
283
+ </ Typography >
284
+ < CircularProgress size = { 12 } />
285
+ </ >
286
+ ) ) || (
287
+ < Typography sx = { { fontSize : 12 , width : 90 } } >
288
+ Connect
289
+ </ Typography >
290
+ ) }
291
+ </ Stack >
292
+ </ Button >
293
+ ) }
294
+ </ Stack >
311
295
}
312
296
/>
313
- < Collapse in = { expanded } timeout = "auto" unmountOnExit >
297
+ < Collapse in = { expanded } timeout = "auto" unmountOnExit >
314
298
< CardContent >
315
299
< Stack direction = "column" justifyContent = "center" spacing = { 1 } >
316
300
< Stack direction = "row" alignItems = "center" spacing = { 1 } >
@@ -361,8 +345,8 @@ function ClientSetting({
361
345
) }
362
346
</ List >
363
347
</ CardContent >
364
- </ Collapse >
365
- </ Card >
348
+ </ Collapse >
349
+ </ Card >
366
350
) ;
367
351
}
368
352
0 commit comments