@@ -33,6 +33,43 @@ import { DOCKER_MCP_CONFIG, MCPClient } from '../Constants';
33
33
import { client } from '../App' ;
34
34
import { MCPClientState } from '../MCPClients' ;
35
35
36
+ type Container = {
37
+ Id : string ;
38
+ Names : string [ ] ;
39
+ Image : string ;
40
+ ImageID : string ;
41
+ Command : string ;
42
+ Created : number ;
43
+ Ports : [ ] ;
44
+ Labels : { } ;
45
+ State : string ;
46
+ Status : string ;
47
+ HostConfig : {
48
+ NetworkMode : string ;
49
+ } ;
50
+ NetworkSettings : {
51
+ Networks : {
52
+ bridge : {
53
+ IPAMConfig : null ,
54
+ Links : null ,
55
+ Aliases : null ,
56
+ MacAddress : string ;
57
+ DriverOpts : null ,
58
+ NetworkID : string ;
59
+ EndpointID : string ;
60
+ Gateway : string ;
61
+ IPAddress : string ;
62
+ IPPrefixLen : number ;
63
+ IPv6Gateway : string ;
64
+ GlobalIPv6Address : string ;
65
+ GlobalIPv6PrefixLen : number ;
66
+ DNSNames : null ;
67
+ }
68
+ }
69
+ } ,
70
+ Mounts : [ ]
71
+ }
72
+
36
73
const Settings = ( { settings, setSettings, mcpClientStates, onUpdate } : { onUpdate : ( ) => Promise < void > , settings : { showModal : boolean , pollIntervalSeconds : number } , setSettings : ( settings : any ) => void , mcpClientStates : { [ name : string ] : MCPClientState } } ) => {
37
74
38
75
const updateAndSaveSettings = ( settings : any ) => {
@@ -129,7 +166,7 @@ const Settings = ({ settings, setSettings, mcpClientStates, onUpdate }: { onUpda
129
166
</ AccordionDetails >
130
167
</ Accordion >
131
168
132
- < Accordion defaultExpanded sx = { { width : '100%' } } >
169
+ < Accordion sx = { { width : '100%' } } >
133
170
< AccordionSummary >
134
171
< Typography variant = "h6" > Registries</ Typography >
135
172
</ AccordionSummary >
@@ -212,16 +249,31 @@ const Settings = ({ settings, setSettings, mcpClientStates, onUpdate }: { onUpda
212
249
< Typography variant = "h6" > Developer Settings</ Typography >
213
250
</ AccordionSummary >
214
251
< AccordionDetails >
215
- < Paper elevation = { 0 } sx = { { p : 2 } } >
216
- < Grid2 container spacing = { 3 } >
217
- < Grid2 size = { 12 } >
218
- < Button variant = "contained" color = "primary" onClick = { ( ) => {
219
- localStorage . clear ( ) ;
220
- window . location . reload ( ) ;
221
- } } > Reset Local Storage</ Button >
222
- </ Grid2 >
252
+ < Grid2 container spacing = { 3 } >
253
+ < Grid2 size = { 4 } >
254
+ < Button variant = "contained" color = "warning" onClick = { ( ) => {
255
+ localStorage . clear ( ) ;
256
+ window . location . reload ( ) ;
257
+ } } > Reset Local Storage</ Button >
223
258
</ Grid2 >
224
- </ Paper >
259
+ < Grid2 size = { 4 } >
260
+ < Button variant = "contained" color = "primary" onClick = { async ( ) => {
261
+ setButtonsLoading ( { ...buttonsLoading , restartService : true } ) ;
262
+ const containers = await client . docker . listContainers ( ) as Container [ ] ;
263
+ console . log ( containers ) ;
264
+ const mcpDockerContainer = containers . find ( container => container . Names . includes ( '/docker_labs-ai-tools-for-devs-desktop-extension-service' ) ) ;
265
+ if ( mcpDockerContainer ) {
266
+ try {
267
+ await client . docker . cli . exec ( 'restart' , [ mcpDockerContainer . Id ] ) ;
268
+ } catch ( error ) {
269
+ console . error ( error ) ;
270
+ client . desktopUI . toast . error ( ( error as any ) . stderr ) ;
271
+ }
272
+ }
273
+ setButtonsLoading ( { ...buttonsLoading , restartService : false } ) ;
274
+ } } disabled = { buttonsLoading . restartService } > { buttonsLoading . restartService && < CircularProgress sx = { { mr : 1 } } size = { 16 } /> } Restart mcp/docker Service</ Button >
275
+ </ Grid2 >
276
+ </ Grid2 >
225
277
</ AccordionDetails >
226
278
</ Accordion >
227
279
</ Stack >
0 commit comments