Skip to content

Commit 89c820a

Browse files
author
colinmcneil
committed
Improve state for unconfigured clients
1 parent 902c59f commit 89c820a

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/extension/ui/src/App.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect, useState } from 'react';
22
import AddIcon from '@mui/icons-material/Add';
33
import { createDockerDesktopClient } from '@docker/extension-api-client';
4-
import { Stack, Typography, Button, ButtonGroup, Grid, debounce, Card, CardContent, IconButton, Alert, DialogTitle, Dialog, DialogContent, FormControlLabel, Checkbox, CircularProgress, Paper, DialogActions } from '@mui/material';
4+
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';
66
import { RegistrySyncStatus } from './components/RegistrySyncStatus';
77
import { getRegistry } from './Registry';
@@ -85,6 +85,8 @@ export function App() {
8585
</Paper>
8686
}
8787

88+
const hasMCPConfigured = Object.values(mcpClientStates).some(state => state.exists && state.configured)
89+
8890
return (
8991
<div>
9092
<Dialog open={settings.showModal} onClose={() => setSettings({ ...settings, showModal: false })}>
@@ -97,8 +99,9 @@ export function App() {
9799
</Dialog>
98100
<Stack direction="column" spacing={1} justifyContent='center' alignItems='center'>
99101
<img src={MCPCatalogLogo} alt="MCP Catalog" height={100} />
100-
<CatalogGrid settingsBadgeProps={Object.values(mcpClientStates).some(state => state.exists && state.configured) ? {} : {
101-
color: Object.values(mcpClientStates).some(state => state.exists) ? 'warning' : 'error',
102+
{hasMCPConfigured ? <></> : <Alert action={<Button variant='outlined' color='secondary' onClick={() => setSettings({ ...settings, showModal: true })}>Configure</Button>} severity="error" sx={{ fontWeight: 'bold' }}>MCP Clients are not configured. Please configure MCP Clients to use the MCP Catalog.</Alert>}
103+
<CatalogGrid settingsBadgeProps={hasMCPConfigured ? {} : {
104+
color: hasMCPConfigured ? 'default' : 'error',
102105
badgeContent: '0 MCP Clients',
103106
sx: {
104107
width: 80,

src/extension/ui/src/components/CatalogGrid.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ export const CatalogGrid: React.FC<CatalogGridProps> = ({
142142
</Alert>}
143143
<FormGroup sx={{ width: '100%' }}>
144144
<Stack direction="row" spacing={1} alignItems='center'>
145-
<FormControlLabel control={<Switch checked={showRegistered} onChange={(e) => setShowRegistered(e.target.checked)} />} label="Show Registered" />
146-
<FormControlLabel control={<Switch checked={showUnregistered} onChange={(e) => setShowUnregistered(e.target.checked)} />} label="Show Unregistered" />
145+
<FormControlLabel control={<Switch checked={showRegistered} onChange={(e) => setShowRegistered(e.target.checked)} />} label="Show Allowed Prompts" />
146+
<FormControlLabel control={<Switch checked={showUnregistered} onChange={(e) => setShowUnregistered(e.target.checked)} />} label="Show Blocked Prompts" />
147147
<Link sx={{ fontWeight: 'bold' }} href="https://vonwig.github.io/prompts.docs/tools/docs/" target="_blank" rel="noopener noreferrer" onClick={() => {
148148
client.host.openExternal('https://vonwig.github.io/prompts.docs/tools/docs/');
149149
}}>⇱ Documentation</Link>

src/extension/ui/src/components/PromptCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface CatalogItemWithName extends CatalogItem {
2222
export function CatalogItemCard({ openUrl, item, canRegister, registered, register, unregister }: { openUrl: () => void, item: CatalogItemWithName, canRegister: boolean, registered: boolean, register: (item: CatalogItemWithName) => Promise<void>, unregister: (item: CatalogItemWithName) => Promise<void> }) {
2323
const [isRegistering, setIsRegistering] = useState(false)
2424
return (
25-
<Card sx={(theme) => ({ height: '100%', borderColor: registered ? theme.palette.docker.blue[500] : theme.palette.docker.grey[500], borderWidth: registered ? 2 : 1 })} variant="outlined" >
25+
<Card sx={(theme) => ({ height: '100%', borderColor: registered ? theme.palette.docker.grey[600] : theme.palette.docker.grey[400], borderWidth: registered ? 2 : 1 })} variant="outlined" >
2626
<Stack direction="column" height="100%" sx={{ justifyContent: 'space-between' }}>
2727
<CardContent>
2828
<a href="">
@@ -81,7 +81,7 @@ export function CatalogItemCard({ openUrl, item, canRegister, registered, regist
8181
}}
8282
disabled={!canRegister || isRegistering}
8383
>
84-
{isRegistering ? <CircularProgress size={20} /> : registered ? 'Remove' : 'Add'}
84+
{isRegistering ? <CircularProgress size={20} /> : registered ? 'Block' : 'Allow'}
8585
</Button>
8686
</Stack>
8787

0 commit comments

Comments
 (0)