Skip to content

chore(workbench): 优化快捷入口路由显示逻辑#643

Merged
kanyxmo merged 3 commits into
mineadmin:masterfrom
muqiuren:chore/workbench-fast-routes
Jul 16, 2025
Merged

chore(workbench): 优化快捷入口路由显示逻辑#643
kanyxmo merged 3 commits into
mineadmin:masterfrom
muqiuren:chore/workbench-fast-routes

Conversation

@muqiuren

@muqiuren muqiuren commented Jul 4, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • 优化
    • 工作台快捷入口数量由10个增加至12个,显示更丰富的快捷方式。
    • 优化了快捷入口的筛选逻辑,提升加载效率和展示准确性。

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 4, 2025
@coderabbitai

coderabbitai Bot commented Jul 4, 2025

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

本次更改重构了仪表盘组件中快捷链接的渲染逻辑。通过引入新的计算属性 visibleRoutes,预先筛选路由,仅保留符合条件的前12个路由用于展示,优化了模板中的遍历方式,并调整了部分筛选规则。

Changes

文件路径 变更摘要
web/src/modules/base/views/dashboard/components/workbench/workbench-fast.vue 新增 visibleRoutes 计算属性,优化路由筛选与渲染逻辑,最大显示数量由10增至12,筛选规则微调,模板遍历方式调整。

Poem

🐇
路由筛选巧安排,
快捷入口更明白。
十二链接齐上阵,
仪表盘上乐开怀。
代码精简又高效,
兔子点赞跳起来!


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 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 or PR title anywhere in the PR title to generate the title automatically.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
web/src/modules/base/views/dashboard/components/workbench/workbench-fast.vue (1)

14-18: 建议考虑添加类型注解

当前的计算属性实现很好,但可以考虑为更好的类型安全性添加明确的类型注解。

-const visibleRoutes = computed(() =>
+const visibleRoutes = computed<RouteRecordNormalized[]>(() =>
   router.getRoutes()
     .filter((v: any) => /^(?!\/$)(?!.*\/uc)(?!.*\/login)(?!.*\/:pathMatch\([^)]*\)).*$/.test(v.path) && v.components)
     .slice(0, 12)
 )

需要从 vue-router 导入 RouteRecordNormalized 类型。

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6af324 and 0b45e05.

📒 Files selected for processing (1)
  • web/src/modules/base/views/dashboard/components/workbench/workbench-fast.vue (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: Test on PHP8.2 Swoole-master
  • GitHub Check: Test on PHP8.1 Swoole-v5.0.3
  • GitHub Check: Test on PHP8.1 Swoole-v5.1.5
  • GitHub Check: Test on PHP8.2 Swoole-v5.1.5
  • GitHub Check: Test on PHP8.1 Swoole-master
  • GitHub Check: Test on PHP8.3 Swoole-master
  • GitHub Check: Test on PHP8.2 Swoole-v5.0.3
  • GitHub Check: Test on PHP8.2 Swow-develop
  • GitHub Check: Test on PHP8.3 Swoole-v5.1.5
  • GitHub Check: Test on PHP8.1 Swow-develop
  • GitHub Check: Test on PHP8.3 Swow-develop
  • GitHub Check: build
  • GitHub Check: build Code coverage report (ubuntu-latest, 8.1, v5.1.3)
🔇 Additional comments (2)
web/src/modules/base/views/dashboard/components/workbench/workbench-fast.vue (2)

14-18: 很好的性能优化实现

将路由过滤逻辑从模板中移动到计算属性中是一个很好的优化。正则表达式准确地排除了不需要的路由(根路径、uc、login、动态匹配路由),并且增加了组件检查以确保路由有效。将显示限制从10个增加到12个也是合理的改进。


28-35: 模板逻辑优化得很好

模板现在更加简洁清晰,直接遍历预过滤的 visibleRoutes 数组。使用 item.name 作为循环键比使用索引更好,这样可以提供更好的Vue响应性性能。

@kanyxmo
kanyxmo merged commit 805b92d into mineadmin:master Jul 16, 2025
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants