Skip to content

Commit 8c2ea01

Browse files
author
colinmcneil
committed
Include config path in UI
1 parent 62deeb8 commit 8c2ea01

File tree

7 files changed

+27
-348
lines changed

7 files changed

+27
-348
lines changed

src/extension/ui/src/App.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import AddIcon from '@mui/icons-material/Add';
33
import { createDockerDesktopClient } from '@docker/extension-api-client';
44
import { Stack, Typography, Button, ButtonGroup, Grid, debounce, Card, CardContent, IconButton, Alert, DialogTitle, Dialog, DialogContent, FormControlLabel, Checkbox, CircularProgress, Paper, DialogActions, Box } from '@mui/material';
55
import { CatalogItemWithName } from './components/PromptCard';
6-
import { RegistrySyncStatus } from './components/RegistrySyncStatus';
76
import { getRegistry } from './Registry';
8-
import { ClaudeConfigSyncStatus, setNeverShowAgain } from './components/ClaudeConfigSyncStatus';
97
import { Close, FolderOpenRounded, } from '@mui/icons-material';
108
import { ExecResult } from '@docker/extension-api-client-types/dist/v0';
119
import { CatalogGrid } from './components/CatalogGrid';

src/extension/ui/src/Constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const DOCKER_MCP_CONFIG = {
1717
export type MCPClient = {
1818
name: string;
1919
url: string;
20-
readFile: (client: v1.DockerDesktopClient) => Promise<string | undefined | null>;
20+
readFile: (client: v1.DockerDesktopClient) => Promise<{ content: string | null | undefined, path: string }>;
2121
connect: (client: v1.DockerDesktopClient) => Promise<void>;
2222
disconnect: (client: v1.DockerDesktopClient) => Promise<void>;
2323
validateConfig: (content: string) => boolean;
@@ -47,9 +47,9 @@ export const SUPPORTED_MCP_CLIENTS: MCPClient[] = [
4747
path = path.replace('$USER', user)
4848
try {
4949
const result = await client.docker.cli.exec('run', ['--rm', '--mount', `type=bind,source="${path}",target=/config.json`, 'alpine:latest', 'sh', '-c', `"cat /config.json"`])
50-
return result.stdout || undefined;
50+
return { content: result.stdout || undefined, path: path };
5151
} catch (e) {
52-
return null;
52+
return { content: null, path: path };
5353
}
5454
},
5555
connect: async (client: v1.DockerDesktopClient) => {

src/extension/ui/src/MCPClients.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@ import { MCPClient, SUPPORTED_MCP_CLIENTS } from "./Constants";
44
export interface MCPClientState extends MCPClient {
55
exists: boolean;
66
configured: boolean;
7+
path: string;
78
}
89

910
export const getMCPClientStates = async (ddClient: v1.DockerDesktopClient) => {
1011
const mcpClientStates: { [name: string]: MCPClientState } = {};
1112
for (const mcpClient of SUPPORTED_MCP_CLIENTS) {
12-
const file = await mcpClient.readFile(ddClient);
13-
if (file === null) {
14-
mcpClientStates[mcpClient.name] = { exists: false, configured: false, ...mcpClient };
15-
} else if (file === undefined) {
16-
mcpClientStates[mcpClient.name] = { exists: true, configured: false, ...mcpClient };
13+
const { path, content } = await mcpClient.readFile(ddClient);
14+
if (content === null) {
15+
mcpClientStates[mcpClient.name] = { exists: false, configured: false, path, ...mcpClient };
16+
} else if (content === undefined) {
17+
mcpClientStates[mcpClient.name] = { exists: true, configured: false, path, ...mcpClient };
1718
}
1819
else {
19-
mcpClientStates[mcpClient.name] = { exists: true, configured: mcpClient.validateConfig(file), ...mcpClient };
20+
mcpClientStates[mcpClient.name] = { exists: true, configured: mcpClient.validateConfig(content), path: path, ...mcpClient };
2021
}
2122
}
2223
return mcpClientStates;

src/extension/ui/src/components/ClaudeConfigSyncStatus.tsx

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

0 commit comments

Comments
 (0)