feat: enhance MCPSettings with server table and clean up NpxSearch component

- Added a debug log for MCP servers in MCPSettings.
- Refactored the MCPSettings component to streamline the server table rendering.
- Removed unnecessary styles from the NpxSearch component for cleaner layout.
This commit is contained in:
kangfenmao 2025-03-17 13:07:05 +08:00
parent 07199d0ed6
commit 187726ae8d
2 changed files with 14 additions and 18 deletions

View File

@ -67,7 +67,7 @@ const NpxSearch: FC = () => {
} }
return ( return (
<SettingGroup theme={theme} style={{ marginTop: 15 }}> <SettingGroup theme={theme}>
<SettingTitle>{t('settings.mcp.npx_list.title')}</SettingTitle> <SettingTitle>{t('settings.mcp.npx_list.title')}</SettingTitle>
<SettingDivider /> <SettingDivider />
<Paragraph type="secondary" style={{ margin: '0 0 10px 0' }}> <Paragraph type="secondary" style={{ margin: '0 0 10px 0' }}>

View File

@ -19,6 +19,8 @@ const MCPSettings: FC = () => {
const { Paragraph, Text } = Typography const { Paragraph, Text } = Typography
const mcpServers = useAppSelector((state) => state.mcp.servers) const mcpServers = useAppSelector((state) => state.mcp.servers)
console.debug(mcpServers)
const handleDelete = (serverName: string) => { const handleDelete = (serverName: string) => {
window.modal.confirm({ window.modal.confirm({
title: t('settings.mcp.confirmDelete'), title: t('settings.mcp.confirmDelete'),
@ -145,7 +147,6 @@ const MCPSettings: FC = () => {
{t('settings.mcp.editJson')} {t('settings.mcp.editJson')}
</Button> </Button>
</HStack> </HStack>
</SettingGroup>
<Table <Table
dataSource={mcpServers} dataSource={mcpServers}
columns={columns} columns={columns}
@ -154,15 +155,10 @@ const MCPSettings: FC = () => {
size="small" size="small"
locale={{ emptyText: t('settings.mcp.noServers') }} locale={{ emptyText: t('settings.mcp.noServers') }}
rowClassName={(record) => (!record.isActive ? 'inactive-row' : '')} rowClassName={(record) => (!record.isActive ? 'inactive-row' : '')}
onRow={(record) => ({ onRow={(record) => ({ style: !record.isActive ? inactiveRowStyle : {} })}
style: !record.isActive ? inactiveRowStyle : {} style={{ marginTop: 15 }}
})}
style={{
borderRadius: '8px',
overflow: 'hidden',
border: '0.5px solid var(--color-border)'
}}
/> />
</SettingGroup>
<NpxSearch /> <NpxSearch />
</SettingContainer> </SettingContainer>
) )