Skip to content

Conversation

weibaohui
Copy link
Owner

No description provided.

为Helm仓库相关的路由方法添加Swagger注释,包括列表查询、保存、删除和更新索引等接口
为参数管理、用户管理、Helm管理等多个控制器添加Swagger API文档注释,包括接口描述、参数定义和返回格式
统一调整部分接口路由路径,如将/admin/cluster改为/mgm/cluster
补充登录、2FA、API密钥等功能的接口文档说明
新增Helm仓库管理、自定义模板CRUD、用户2FA和API密钥管理等接口定义
移除旧的集群连接和SSO相关接口,统一到新的管理路径下
在Token描述中添加获取路径说明,明确提示用户可在个人中心-API密钥菜单下申请Token
Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Summary by CodeRabbit

  • 新功能

    • 侧边栏新增“开放API”菜单项,可快速访问 API 文档页面。
    • 新增集群下拉选项和表格列表接口,支持按用户权限过滤和证书信息展示。
  • 文档

    • 大量接口补充或完善了 Swagger 风格的 API 文档注释,包括登录、集群、Helm、日志、用户、模板、SSO 等模块。
    • 部分接口路径和描述优化,更清晰标识接口用途和安全要求。
    • BearerAuth 认证说明中新增 API 密钥获取位置说明。

Walkthrough

本次变更主要为后端各控制器方法和部分主入口文件添加或完善了 Swagger 风格的 API 文档注释,调整了部分接口的路由路径和描述信息,并在前端侧菜单中新增了“开放API”入口。所有变更均未涉及实际业务逻辑,仅限于文档和元数据完善。

Changes

文件/分组 变更简述
main.go BearerAuth 安全定义的 Swagger 注释增加了 API 密钥获取说明
pkg/controller/admin/cluster/cluster.go Reconnect 方法的路由由 /admin/cluster/... 改为 /mgm/cluster/...
pkg/controller/helm/helm_chart.go 为 Helm Chart 相关控制器方法添加 Swagger API 注释
pkg/controller/helm/helm_repo.go 为 Helm 仓库相关控制器方法添加 Swagger API 注释
pkg/controller/log/shell_log.go 为日志相关控制器方法添加 Swagger API 注释
pkg/controller/login/login.go 为登录方法添加 Swagger API 注释
pkg/controller/param/cluster.go 新增集群下拉和表格接口,并添加 Swagger API 注释
pkg/controller/param/condition.go 为条件列表接口添加 Swagger API 注释
pkg/controller/param/config.go 为配置查询接口添加 Swagger API 注释
pkg/controller/param/helm.go 为 Helm 仓库下拉接口添加 Swagger API 注释
pkg/controller/param/user.go 为用户角色接口添加 Swagger API 注释
pkg/controller/param/version.go 为版本信息接口添加 Swagger API 注释
pkg/controller/sso/sso.go SSO 相关接口路由由 cluster-scoped 路径调整为 /auth/,并完善注释
pkg/controller/template/template.go 为模板相关接口添加 Swagger API 注释
pkg/controller/user/apikey/apikey.go 为 APIKey 管理相关接口添加 Swagger API 注释
pkg/controller/user/mcpkey/mcpkey.go 为 MCPKey 管理相关接口添加 Swagger API 注释
pkg/controller/user/profile/profile.go 为用户信息、权限、密码修改接口添加 Swagger API 注释
pkg/controller/user/profile/profile_2fa.go 为 2FA 相关接口添加 Swagger API 注释
ui/src/components/Sidebar/menu.tsx 侧边栏新增“开放API”菜单项,跳转到 Swagger UI

Sequence Diagram(s)

sequenceDiagram
    participant 用户
    participant 前端
    participant Swagger UI
    participant 后端API

    用户->>前端: 打开侧边栏,点击“开放API”
    前端->>Swagger UI: 跳转至 /swagger/index.html
    用户->>Swagger UI: 浏览API文档
    Swagger UI->>后端API: 通过注释生成的元数据展示接口信息
Loading

Possibly related PRs

  • weibaohui/k8m#189: 引入 Swagger 支持的基础设施,为本次 PR 的文档注释补充提供了前提。
  • weibaohui/k8m#264: 新增集群管理相关接口及 Reconnect 方法的 Swagger 注释,与本次 PR 对同一方法路由注释的调整直接相关。

Poem

🐰
Swagger 注释齐上阵,
接口文档焕然新。
侧栏一键“开放API”,
路由描述更贴心。
代码未动只加注,
小兔欢跳庆更新!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 370d09d and 7c7332d.

📒 Files selected for processing (19)
  • main.go (1 hunks)
  • pkg/controller/admin/cluster/cluster.go (1 hunks)
  • pkg/controller/helm/helm_chart.go (3 hunks)
  • pkg/controller/helm/helm_repo.go (5 hunks)
  • pkg/controller/log/shell_log.go (2 hunks)
  • pkg/controller/login/login.go (1 hunks)
  • pkg/controller/param/cluster.go (2 hunks)
  • pkg/controller/param/condition.go (1 hunks)
  • pkg/controller/param/config.go (1 hunks)
  • pkg/controller/param/helm.go (1 hunks)
  • pkg/controller/param/user.go (1 hunks)
  • pkg/controller/param/version.go (1 hunks)
  • pkg/controller/sso/sso.go (4 hunks)
  • pkg/controller/template/template.go (3 hunks)
  • pkg/controller/user/apikey/apikey.go (3 hunks)
  • pkg/controller/user/mcpkey/mcpkey.go (3 hunks)
  • pkg/controller/user/profile/profile.go (3 hunks)
  • pkg/controller/user/profile/profile_2fa.go (3 hunks)
  • ui/src/components/Sidebar/menu.tsx (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch swagger

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests 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.

@weibaohui weibaohui merged commit 1632918 into main Jul 21, 2025
4 of 5 checks passed
@weibaohui weibaohui deleted the swagger branch July 21, 2025 00:44
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.

1 participant