refactor(mcp): redesign MCP management panel UI

- Redesign MCP panel to match main interface style
- Add toggle switch for each MCP server to enable/disable
- Use emerald theme color consistent with MCP button
- Create card-based layout with one MCP per row
- Add dedicated form modal for add/edit operations
- Implement proper empty state with friendly prompts
- Add comprehensive i18n support (zh/en)
- Extend McpServer type to support enabled field
- Backend already supports enabled field via serde_json::Value

Components:
- McpPanel: Main panel container with header and list
- McpListItem: Card-based list item with toggle and actions
- McpFormModal: Independent modal for add/edit forms
- McpToggle: Emerald-themed toggle switch component

All changes passed TypeScript type checking and production build.
This commit is contained in:
Jason
2025-10-09 11:04:36 +08:00
parent 96a4b4fe95
commit 59c13c3366
9 changed files with 566 additions and 301 deletions

View File

@@ -8,6 +8,7 @@
"edit": "Edit",
"delete": "Delete",
"save": "Save",
"saving": "Saving...",
"cancel": "Cancel",
"confirm": "Confirm",
"close": "Close",
@@ -255,9 +256,12 @@
"serverList": "Servers",
"loading": "Loading...",
"empty": "No MCP servers",
"add": "Add Server",
"emptyDescription": "Click the button in the top right to add your first MCP server",
"add": "Add MCP",
"addServer": "Add Server",
"editServer": "Edit Server",
"configPath": "Config Path",
"serverCount": "{{count}} MCP server(s) configured",
"template": {
"fetch": "Quick Template: mcp-fetch"
},
@@ -277,6 +281,8 @@
"msg": {
"saved": "Saved",
"deleted": "Deleted",
"enabled": "Enabled",
"disabled": "Disabled",
"templateAdded": "Template added"
},
"error": {
@@ -288,6 +294,10 @@
"validation": {
"ok": "Command available",
"fail": "Command not found"
},
"confirm": {
"deleteTitle": "Delete MCP Server",
"deleteMessage": "Are you sure you want to delete MCP server \"{{id}}\"? This action cannot be undone."
}
}
}

View File

@@ -8,6 +8,7 @@
"edit": "编辑",
"delete": "删除",
"save": "保存",
"saving": "保存中...",
"cancel": "取消",
"confirm": "确定",
"close": "关闭",
@@ -255,9 +256,12 @@
"serverList": "服务器列表",
"loading": "加载中...",
"empty": "暂无 MCP 服务器",
"add": "新增服务器",
"emptyDescription": "点击右上角按钮添加第一个 MCP 服务器",
"add": "添加 MCP",
"addServer": "新增服务器",
"editServer": "编辑服务器",
"configPath": "配置路径",
"serverCount": "已配置 {{count}} 个 MCP 服务器",
"template": {
"fetch": "快速模板mcp-fetch"
},
@@ -277,6 +281,8 @@
"msg": {
"saved": "已保存",
"deleted": "已删除",
"enabled": "已启用",
"disabled": "已禁用",
"templateAdded": "已添加模板"
},
"error": {
@@ -288,6 +294,10 @@
"validation": {
"ok": "命令可用",
"fail": "命令不可用"
},
"confirm": {
"deleteTitle": "删除 MCP 服务器",
"deleteMessage": "确定要删除 MCP 服务器 \"{{id}}\" 吗?此操作无法撤销。"
}
}
}