Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: improve MCP configuration page style #4475

Merged
merged 1 commit into from
Mar 14, 2025

Conversation

erha19
Copy link
Member

@erha19 erha19 commented Mar 13, 2025

Types

  • 🎉 New Features
  • 💄 Style Changes

Background or solution

image

Changelog

improve MCP configuration page style

Summary by CodeRabbit

  • 样式改进

    • 优化了服务器列表项的背景色、排版和按钮交互效果,使整体界面更清爽、直观。
    • 表单中的取消按钮现采用了次级样式,提升了视觉层次感。
  • 界面优化

    • 新增服务器状态图标及工具徽章,直观展示服务器运行状态和关联工具。
    • 操作按钮现支持悬停提示,改善了用户操作反馈。
  • 国际化更新

    • 更新了状态文案,新增启用/禁用提示和操作标题,表述更清晰。

Copy link
Contributor

coderabbitai bot commented Mar 13, 2025

Walkthrough

本次 PR 主要涉及 MCP 组件及其样式的调整和改进。包括 LESS 样式文件的更新,调整了服务器项目的背景色、按钮交互和状态图标;修改了 MCPConfigView 和 MCPServerForm 组件的 UI 交互方式,引入了 Popover、Button 以及 Badge 组件;同时更新了相关接口和类型,增强了服务器数据结构(如新增 MCPTool 信息);此外,本次更新还对中英文国际化语言包中的键值做出了相应调整。

Changes

File(s) Change Summary
packages/ai-native/src/browser/mcp/config/components/mcp-config.module.less 修改 .serverItem 背景色;新增嵌套样式(如 .serverTitleRow.serverActions.serverStatusIcon);重命名 .serverHeader.serverTitleRow
packages/ai-native/src/browser/mcp/config/components/mcp-config.view.tsx
packages/ai-native/src/browser/mcp/config/components/mcp-server-form.tsx
更新 UI 交互:引入 Button, Popover, Badge 组件;调整服务器状态图标显示;改进操作按钮样式及逻辑(例如取消按钮类型由 ghost 变为 primary 并添加新样式)。
packages/ai-native/src/browser/mcp/config/components/mcp-server-form.module.less .formActions 中新增 CSS 类 .secondaryButton,设置 opacity0.6
packages/ai-native/src/common/index.ts
packages/ai-native/src/common/types.ts
packages/ai-native/src/node/mcp/sumi-mcp-server.ts
更新常量 BUILTIN_MCP_SERVER_NAME(从 'builtin' 改为 'Builtin');调整 getServers() 方法返回值和 MCPServer 接口,将工具属性从字符串数组改为 MCPTool 对象数组;修改工具映射逻辑,移除旧日志输出。
packages/i18n/src/common/en-US.lang.ts
packages/i18n/src/common/zh-CN.lang.ts
国际化调整:移除 'ai.native.mcp.running''ai.native.mcp.stopped' 键;新增 'ai.native.mcp.enabled', 'ai.native.mcp.disabled', 'ai.native.mcp.enable.title''ai.native.mcp.disable.title' 键。

Sequence Diagram(s)

sequenceDiagram
    participant U as 用户
    participant V as MCPConfigView
    participant T as 组件库 (Button, Popover, Badge)
    participant B as 后台接口

    U->>V: 点击服务器操作按钮
    V->>T: 触发 Popover 显示操作提示
    V->>B: 请求服务器状态及工具信息
    B-->>V: 返回更新后的数据
    V->>T: 更新界面显示 (状态图标及 Badge)
Loading

Possibly related PRs

Suggested labels

💄 style change, 🎨 feature

Suggested reviewers

  • Aaaaash
  • life2015
  • Ricbet

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

yarn install v1.22.22
[1/4] Resolving packages...
warning [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/[email protected]: Use @eslint/config-array instead
warning eslint > @humanwhocodes/config-array > @humanwhocodes/[email protected]: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > [email protected]: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning eslint-import-resolver-typescript > [email protected]: Glob versions prior to v9 are no longer supported
error Couldn't find any versions for "@opensumi/ide-dev-tool" that matches "workspace:*"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/ai-native/src/browser/mcp/config/components/mcp-config.module.less (1)

51-84: 检查 .serverHeader 命名与样式设计
.serverItem 内部新增了 .serverHeader 及其嵌套规则,定义了按钮区域(包括 .iconButton.serverActionButton)的交互样式。根据 PR 描述,建议确认是否需要将 .serverHeader 重命名统一为 .serverTitleRow,或两者需明确区分用途,确保组件调用时名称一致。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6ddd66 and 3b02bed.

📒 Files selected for processing (9)
  • packages/ai-native/src/browser/mcp/config/components/mcp-config.module.less (2 hunks)
  • packages/ai-native/src/browser/mcp/config/components/mcp-config.view.tsx (3 hunks)
  • packages/ai-native/src/browser/mcp/config/components/mcp-server-form.module.less (1 hunks)
  • packages/ai-native/src/browser/mcp/config/components/mcp-server-form.tsx (1 hunks)
  • packages/ai-native/src/common/index.ts (2 hunks)
  • packages/ai-native/src/common/types.ts (1 hunks)
  • packages/ai-native/src/node/mcp/sumi-mcp-server.ts (4 hunks)
  • packages/i18n/src/common/en-US.lang.ts (1 hunks)
  • packages/i18n/src/common/zh-CN.lang.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: unittest (ubuntu-latest, 18.x, jsdom)
  • GitHub Check: unittest (ubuntu-latest, 18.x, node)
  • GitHub Check: build (ubuntu-latest, 20.x)
  • GitHub Check: unittest (macos-latest, 18.x, jsdom)
  • GitHub Check: ubuntu-latest, Node.js 20.x
  • GitHub Check: build (macos-latest, 20.x)
  • GitHub Check: unittest (macos-latest, 18.x, node)
  • GitHub Check: build-windows
🔇 Additional comments (20)
packages/ai-native/src/browser/mcp/config/components/mcp-server-form.module.less (1)

49-51: 样式改进:二级按钮的透明度设置

新增的 .secondaryButton 类通过设置透明度为 0.6,使得取消按钮的视觉权重降低,与主按钮形成层次对比,提升了用户界面的视觉层次感。

packages/ai-native/src/common/types.ts (1)

49-49: 接口增强:工具数据结构优化

tools 属性从简单的字符串数组升级为 MCPTool 对象数组,使得工具信息更加结构化和丰富,可以包含更多元数据如描述、输入模式等。这种更改有利于提供更丰富的 UI 展示和更好的用户体验。

packages/ai-native/src/browser/mcp/config/components/mcp-server-form.tsx (1)

266-267: UI 交互改进:取消按钮样式优化

将取消按钮的类型从 ghost 变更为 primary 并应用 secondaryButton 样式,使得取消按钮与确认按钮形成视觉上的层次关系,同时保持一致的按钮风格。这种变更提升了界面的一致性和专业感。

packages/i18n/src/common/zh-CN.lang.ts (1)

1387-1390: 术语优化:状态描述更清晰

将服务状态描述从"运行/停止"更改为"启用/禁用",并新增了相应的操作提示文本。这种表述更加贴近用户理解,使界面交互逻辑更加清晰,提升了用户体验。

packages/i18n/src/common/en-US.lang.ts (1)

1624-1627: 语言包键值更新更好地反映了服务状态

这个更改将"running/stopped"的状态描述改为了"enabled/disabled",并添加了操作提示,更准确地反映了服务的状态概念,使界面语言更加一致和专业。

packages/ai-native/src/node/mcp/sumi-mcp-server.ts (2)

139-149: 工具表示方式的增强,提供更丰富的元数据

将简单的工具名称数组改为包含更多元数据(描述、输入模式和提供者名称)的对象数组,使客户端能够展示更丰富的工具信息,提升了用户体验。


157-158: 统一使用增强的工具数据结构

在所有服务器类型的返回对象中,统一使用增强后的tools数组,保持了数据结构的一致性。

Also applies to: 168-169, 176-177, 185-186

packages/ai-native/src/common/index.ts (2)

40-40: 改进内置服务器的显示名称

将内置服务器的名称从"builtin"更改为"Builtin",使其在UI中显示更加专业,与其他首字母大写的服务器名称风格保持一致。


137-137: 更新接口定义以支持增强的工具数据结构

更新了getServers()方法的返回类型,添加了tools: MCPTool[]属性,使其与实现保持一致,确保类型安全。

packages/ai-native/src/browser/mcp/config/components/mcp-config.view.tsx (5)

4-4: 引入增强UI组件

添加了ButtonPopoverPopoverTriggerType组件的导入,为UI提供了更丰富的交互和视觉效果。


181-186: 添加服务器状态可视化指示器

为服务器名称旁添加了状态图标,通过不同的样式直观地显示服务器是否处于活动状态,提升了用户体验。


189-212: 改进服务器操作按钮的交互和可视化效果

使用Popover组件为按钮添加了悬停提示,显示操作的具体含义。同时使用Button组件替换原有按钮,添加图标和反映服务器状态的文本,使操作更加直观。


214-231: 统一编辑和删除按钮的样式

将编辑和删除按钮替换为带有图标的Button组件,保持了UI的一致性和现代感。


248-250: 使用Badge组件美化工具标签

将简单的span标签替换为Badge组件来显示工具名称,同时添加了工具描述的提示,使界面更加美观且信息更加丰富。

packages/ai-native/src/browser/mcp/config/components/mcp-config.module.less (6)

48-48: 更新背景色变量确认
此处将 .serverItem 的背景色修改为 var(--editor-background),符合新的视觉风格。请确认全局主题中该变量的定义是否符合预期。


91-96: 新增 .serverTitleRow 样式
新增的 .serverTitleRow 通过 display: flex 布局,并设置了 gap: 8pxtext-indent: 12px,有助于排版调整。建议在各种屏幕尺寸中测试其响应效果,确保间距符合设计预期。


98-103: .serverActions 布局优化
新增的 .serverActions 样式为服务器操作按钮提供了横向对齐与右对齐支持,通过 flex: 1justify-content: flex-end 实现。这提升了整体交互体验,请在不同分辨率下确认布局效果。


105-112: 更新 .serverName 样式
.serverName 新增了 display: flexalign-items: centerjustify-content: center 属性,使服务器名称能够水平垂直居中显示。建议验证在长名称或多语言场景下,文本显示不会出现意外截断或排版问题。


113-128: 新增 .serverStatusIcon 样式
添加了 .serverStatusIcon 用于显示服务器状态,设置了圆形(border-radius: 50%)、固定尺寸、左右间距及根据状态变化的背景色和边框阴影。此举能有效增强状态反馈的视觉效果,请在不同浏览器下测试其呈现效果。


221-221: 增强交互提示
.toolTag 内新增了 cursor: pointer; 样式,使得该元素在悬浮时显示为可点击状态,提升用户体验。确认此交互行为与其它类似组件保持一致。

Copy link

codecov bot commented Mar 13, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 53.23%. Comparing base (d6ddd66) to head (3b02bed).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/ai-native/src/node/mcp/sumi-mcp-server.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4475      +/-   ##
==========================================
- Coverage   53.24%   53.23%   -0.01%     
==========================================
  Files        1663     1663              
  Lines      102619   102619              
  Branches    22201    22202       +1     
==========================================
- Hits        54639    54633       -6     
- Misses      39920    39925       +5     
- Partials     8060     8061       +1     
Flag Coverage Δ
jsdom 48.73% <25.00%> (-0.01%) ⬇️
node 12.20% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erha19 erha19 merged commit b1eeb00 into main Mar 14, 2025
13 checks passed
@erha19 erha19 deleted the feat/improve-mcp-server-config branch March 14, 2025 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants