Skip to content

feat(webui): add direct access button on plugin cards and improve embedded page height#8369

Merged
Soulter merged 5 commits into
AstrBotDevs:masterfrom
lxfight:master
May 27, 2026
Merged

feat(webui): add direct access button on plugin cards and improve embedded page height#8369
Soulter merged 5 commits into
AstrBotDevs:masterfrom
lxfight:master

Conversation

@lxfight

@lxfight lxfight commented May 27, 2026

Copy link
Copy Markdown
Member

Modifications / 改动点

  • Backend: Added pages field to /api/plugin/get response, listing discovered page names for each plugin so the
    frontend can determine WebUI availability without an extra detail request.

  • Frontend: Added a "Open Plugin UI" button (mdi-monitor-dashboard) on installed plugin cards, visible only when
    the plugin has pages. Clicking navigates directly to the plugin's first page.

  • UX: Adjusted PluginPagePage iframe minimum height for a better viewing experience.

  • i18n: Added openWebui label for zh-CN, en-US, and ru-RU locales.

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

截屏2026-05-27 17 42 03 image 截屏2026-05-27 17 43 23

Checklist / 检查清单

  • 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
    / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。

  • 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
    / 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”

  • 🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txtpyproject.toml 文件相应位置。

  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Summary by Sourcery

Expose plugin WebUI availability from the backend and add a direct access entry point in the dashboard, along with minor layout and localization updates.

New Features:

  • Return discovered plugin page names in the /api/plugin/get response so the dashboard can detect WebUI support for each plugin.
  • Add an "Open Plugin UI" action on installed plugin cards that navigates directly to the plugin's first page when available.

Enhancements:

  • Reduce the minimum height of embedded plugin pages and loading state to improve the visible area on the PluginPage view.
  • Extend i18n extension labels with an "openWebui" string across supported locales.

lxfight added 2 commits May 27, 2026 17:35
Include discovered page names for each plugin in the /api/plugin/get
response, so the frontend can determine whether a plugin has a WebUI
without an extra detail request.
- Add "open-webui" button on plugin cards when plugin has pages
- Navigate to plugin's first page directly from the card
- Adjust PluginPagePage iframe height for better UX
- Add i18n labels (zh-CN/en-US/ru-RU)
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. area:webui The bug / feature is about webui(dashboard) of astrbot. feature:plugin The bug / feature is about AstrBot plugin system. labels May 27, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In get_plugins, calling _discover_plugin_pages for every plugin on the list endpoint could become expensive with many plugins; consider caching results or providing a lightweight flag on the list and deferring full page discovery to a detail endpoint.
  • The openPluginWebui handler always routes to pages[0]; if the order of pages is not guaranteed or you later support a 'default' page, consider making the target page deterministic (e.g., by sorting, picking a specific name like index, or using a designated default field).
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `get_plugins`, calling `_discover_plugin_pages` for every plugin on the list endpoint could become expensive with many plugins; consider caching results or providing a lightweight flag on the list and deferring full page discovery to a detail endpoint.
- The `openPluginWebui` handler always routes to `pages[0]`; if the order of `pages` is not guaranteed or you later support a 'default' page, consider making the target page deterministic (e.g., by sorting, picking a specific name like `index`, or using a designated default field).

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a feature to discover and open plugin-specific UI pages directly from the dashboard. It updates the backend to fetch plugin pages and adds an "Open Plugin UI" button to the frontend's ExtensionCard component, along with corresponding localization strings. Feedback highlights a potential performance bottleneck due to sequential disk I/O when discovering plugin pages in a loop, recommending concurrent processing using asyncio.gather. Additionally, a UX improvement is suggested to disable the "Open Plugin UI" button when a plugin is deactivated to prevent errors.

Comment thread astrbot/dashboard/routes/plugin.py
Comment thread dashboard/src/components/shared/ExtensionCard.vue
lxfight added 3 commits May 27, 2026 18:03
Replace sequential await loop with concurrent processing to avoid
blocking on disk I/O when discovering plugin pages.
Prevent navigation to a disabled plugin's WebUI page which would
result in an error.
- test_plugin_get_excludes_scanned_pages: expect pages field now present
- test_plugins: use name-based lookup instead of exact count assertion
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels May 27, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 27, 2026
@Soulter Soulter merged commit 23d70db into AstrBotDevs:master May 27, 2026
20 checks passed
):
continue
_plugin_resp.append(_t)
_plugin_resp.append(_t)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

?

lxfight pushed a commit that referenced this pull request May 28, 2026
Fixed the issue of duplicate plugin cards introduced in #8369
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webui The bug / feature is about webui(dashboard) of astrbot. feature:plugin The bug / feature is about AstrBot plugin system. lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants