feat(dashboard): add session monitor room#405
Open
nil-err wants to merge 4 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景和目标
Dashboard 目前每个会话只能单独点击「终端」查看 Web Terminal。这个 PR 新增「监控室」能力,让用户可以把多个会话的终端放在同一个页面里观察,适合长时间跟进多路任务执行状态。
功能变更情况
localStorage,不引入服务端持久化,也不会影响其他浏览器或其他用户。代码更改情况
src/dashboard/web/monitor-room-store.ts:封装监控室会话 ID 列表和「空列表显示活跃会话」开关的localStorage读写逻辑。src/dashboard/web/session-terminal.ts:抽出单会话终端 URL 生成逻辑,供会话页、监控室 iframe 和浮层复用。src/dashboard/web/monitor-room.ts:实现监控室页面渲染、手动/自动会话列表选择、终端 iframe、比例缩放、动态网格布局、浮层终端、移除和清空交互。src/dashboard/web/dashboard-routes.ts:注册#/monitor-room路由。src/dashboard/web/sessions.ts/sessions-page.tsx:增加监控室入口、批量添加按钮,并将入口改为当前页跳转。src/dashboard/web/i18n.ts:补充监控室、自动活跃开关和浮层相关中英文文案。src/dashboard/web/style.css:增加监控室网格、会话面板、iframe 容器、自动开关、浮层终端、占位态样式;补充顶部对齐、动态比例和 iframe 等比例缩放布局。test/dashboard-monitor-room.test.ts:覆盖监控列表存储、自动活跃开关存储、终端 URL、iframe 缩放几何计算和动态网格几何计算。验证情况
git diff --check通过。corepack pnpm test -- test/dashboard-monitor-room.test.ts通过,9 个用例通过。corepack pnpm exec tsc通过。node scripts/build-dashboard.mjs通过。window.innerWidth / window.innerHeight一致,列数会随窗口变化;iframe 内部终端 viewport 跟随当前真实窗口尺寸;右上角终端按钮弹出页面内浮层且不新建页面。兼容性和风险
localStorage,刷新和重开页面仍保留,但不会跨浏览器同步。