Skip to content

fix: separate per-tool import and import-all buttons in MCP server setup#79

Open
yanniszhou wants to merge 1 commit intodataelement:mainfrom
yanniszhou:fix/mcp-import-all-button-74-v2
Open

fix: separate per-tool import and import-all buttons in MCP server setup#79
yanniszhou wants to merge 1 commit intodataelement:mainfrom
yanniszhou:fix/mcp-import-all-button-74-v2

Conversation

@yanniszhou
Copy link
Contributor

Summary

Fixes #74

The "Import All" (导入全部) button in the MCP Server setup was inside the tool list .map() loop, creating N identical "Import All" buttons — each only importing a single tool, contradicting the label.

Changes

  • Each tool row now has an "Import" button (btn-secondary) — imports only that one tool, with try/catch error handling
  • Added a single "Import All" button (btn-primary) outside the loop, below the tool list — imports all tools at once, shows a failure summary if any fail, then closes the form

Before / After

Before: N × "Import All" buttons, each importing 1 tool, no error feedback

After:

  • N × "Import" buttons (per row, secondary style)
  • 1 × "Import All" button (below list, primary style, closes form on completion)

Test plan

  • Test connection to an MCP server with multiple tools
  • Click "Import" on a single tool row — verify only that tool is imported
  • Click "Import All" — verify all tools are imported and form closes
  • Click "Import All" again — verify error summary shows duplicate conflicts

Made with Cursor

Fixes dataelement#74

- Each tool row now has an "Import" button (btn-secondary) that imports
  only that specific tool, with proper error handling via try/catch
- Added a single "Import All" button (btn-primary) below the tool list
  that imports all discovered tools at once, shows a summary on partial
  failures, and closes the form on completion

Made-with: Cursor
@yaojin3616
Copy link
Collaborator

PR 79 评审意见:

功能改进

  • 修复了 MCP 服务器设置中“导入全部”按钮在循环内重复出现的问题。
  • 实现了单工具“导入”与全局“导入全部”按钮的分离,逻辑更清晰。
  • 增加了批量导入的错误处理逻辑,能够在完成后汇总失败信息,提升了用户体验。

发现的问题

  • 国际化 Key 缺失:在 EnterpriseSettings.tsx 中新增了 enterprise.tools.importenterprise.tools.importFailed,但 PR 并没有在 en.jsonzh.json 中添加对应的字段。虽然目前有硬编码回退(|| 'Import'),但建议补全以保持一致。

评审结论
LGTM。代码逻辑正确,修复了 UI 缺陷。建议合并前或合并后补全以下国际化 Key:

"import": "导入",
"importFailed": "导入失败"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] "Import All" button in MCP Server setup imports single tool instead of all tools

2 participants