Skip to content

Commit

Permalink
Add secret expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinMcNeil committed Feb 26, 2025
1 parent ec64bab commit e34db06
Showing 2 changed files with 62 additions and 47 deletions.
16 changes: 14 additions & 2 deletions src/extension/ui/src/components/PromptCard.tsx
Original file line number Diff line number Diff line change
@@ -4,11 +4,12 @@ import { Card, CardActions, CardContent, CardMedia, Typography } from "@mui/mate
import { Ref } from "../Refs";
import { useState } from "react";
import { trackEvent } from "../Usage";
import { Article, AttachFile, Build } from "@mui/icons-material";
import { Article, AttachFile, Build, LockRounded } from "@mui/icons-material";

export interface CatalogItem {
description?: string;
icon?: string;
secrets?: { name: string }[];
ref: string;
prompts: number;
resources: object[];
@@ -60,7 +61,18 @@ export function CatalogItemCard({ openUrl, item, canRegister, registered, regist
<Build />
</Badge>
</Tooltip>

{item.secrets?.length && (
<Tooltip title={<Stack sx={{ pr: 1 }} direction="column" spacing={1}>
<Typography sx={{ fontWeight: 'bold' }}>Expected secrets:</Typography>
{item.secrets.map(secret => (
<Typography key={secret.name}>{secret.name}</Typography>
))}
</Stack>}>
<Badge badgeContent={item.secrets?.length || "0"} color="warning">
<LockRounded />
</Badge>
</Tooltip>
)}
</Stack>
<Button
size="small"
93 changes: 48 additions & 45 deletions src/extension/ui/src/components/Settings.tsx
Original file line number Diff line number Diff line change
@@ -27,7 +27,8 @@ import {
ContentCopy,
LinkOff,
LinkRounded,
SaveOutlined
SaveOutlined,
InfoOutlined
} from '@mui/icons-material';
import { DOCKER_MCP_CONFIG, MCPClient } from '../Constants';
import { client } from '../App';
@@ -80,50 +81,52 @@ const Settings = ({ settings, setSettings, mcpClientStates, onUpdate }: { onUpda
<List>
{Object.entries(mcpClientStates).map(([name, mcpClientState]) => (
<ListItem key={name} secondaryAction={
<>
{mcpClientState.exists && mcpClientState.configured &&
<Button onClick={async () => {
setButtonsLoading({ ...buttonsLoading, [name]: true });
await mcpClientState.disconnect(client)
await onUpdate();
setButtonsLoading({ ...buttonsLoading, [name]: false });
}} disabled={buttonsLoading[name]} color="warning" variant="outlined" size="small">
<Stack direction="row" alignItems="center" spacing={1}>
<Typography>Disconnect</Typography>
<LinkOff />
{buttonsLoading[name] && <CircularProgress size={16} />}
</Stack>
</Button>
}
{mcpClientState.exists && !mcpClientState.configured &&
<Button onClick={async () => {
setButtonsLoading({ ...buttonsLoading, [name]: true });
await mcpClientState.connect(client)
await onUpdate();
setButtonsLoading({ ...buttonsLoading, [name]: false });
}} disabled={buttonsLoading[name]} color="primary" variant="outlined" size="small">
<Stack direction="row" alignItems="center" spacing={1}>
<Typography>Connect</Typography>
<LinkRounded />
{buttonsLoading[name] && <CircularProgress size={16} />}
</Stack>
</Button>
}
{!mcpClientState.exists &&
<Button color="error" variant="outlined" size="small" onClick={async () => {
setButtonsLoading({ ...buttonsLoading, [name]: true });
await mcpClientState.connect(client)
await onUpdate();
setButtonsLoading({ ...buttonsLoading, [name]: false });
}}>
<Stack direction="row" alignItems="center" spacing={1}>
<SaveOutlined />
<Typography>Write Config</Typography>
{buttonsLoading[name] && <CircularProgress size={16} />}
</Stack>
</Button>
}
</>
<Tooltip title="You need to restart Claude Desktop after changing the connection.">
<span>
{mcpClientState.exists && mcpClientState.configured &&
<Button onClick={async () => {
setButtonsLoading({ ...buttonsLoading, [name]: true });
await mcpClientState.disconnect(client)
await onUpdate();
setButtonsLoading({ ...buttonsLoading, [name]: false });
}} disabled={buttonsLoading[name]} color="warning" variant="outlined" size="small">
<Stack direction="row" alignItems="center" spacing={1}>
<Typography>Disconnect</Typography>
<LinkOff />
{buttonsLoading[name] && <CircularProgress size={16} />}
</Stack>
</Button>
}
{mcpClientState.exists && !mcpClientState.configured &&
<Button onClick={async () => {
setButtonsLoading({ ...buttonsLoading, [name]: true });
await mcpClientState.connect(client)
await onUpdate();
setButtonsLoading({ ...buttonsLoading, [name]: false });
}} disabled={buttonsLoading[name]} color="primary" variant="outlined" size="small">
<Stack direction="row" alignItems="center" spacing={1}>
<Typography>Connect</Typography>
<LinkRounded />
{buttonsLoading[name] && <CircularProgress size={16} />}
</Stack>
</Button>
}
{!mcpClientState.exists &&
<Button color="error" variant="outlined" size="small" onClick={async () => {
setButtonsLoading({ ...buttonsLoading, [name]: true });
await mcpClientState.connect(client)
await onUpdate();
setButtonsLoading({ ...buttonsLoading, [name]: false });
}}>
<Stack direction="row" alignItems="center" spacing={1}>
<SaveOutlined />
<Typography>Write Config</Typography>
{buttonsLoading[name] && <CircularProgress size={16} />}
</Stack>
</Button>
}
</span>
</Tooltip>
}>
<ListItemText
primary={

0 comments on commit e34db06

Please sign in to comment.