feat(monitor): 统一日志与用量的时间筛选交互 - #608
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
📝 WalkthroughWalkthrough本次变更统一日志和用量监控的时间范围及过滤器状态。日志过滤器改用 Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Refreshing logs closes the request detail being inspected, and reloading a preset-based paginated link can yield empty or repeated log pages. These monitoring navigation regressions should be fixed before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 6 files. (7 skipped: 7 unsupported.) 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. Comment |
There was a problem hiding this comment.
Note
Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.
🟡 Other comments (2)
web/src/features/monitor/log-filters.ts-304-311 (1)
304-311: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win保留
preset链接中的时间边界,或丢弃不匹配的日志游标。
serializeAppliedLogFilters在存在preset时省略from_ms和to_ms,但logsMonitorQuery仍保留log_cursors。重新加载链接时,parseAppliedLogFilters会按当前时间重新计算区间,parseLogsMonitorState不会清理游标。LogsTab.vue会将该游标与新区间传给requestLogQueryOptions,再由listRequestLogs一起发送。游标可能对应旧区间,导致翻页结果重复或为空。请同时序列化from_ms/to_ms,或在区间被重算时丢弃log_cursors。web/src/features/monitor/LogsTab.vue-452-452 (1)
452-452: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win刷新时保留已选中的日志详情。
LogsTab.refresh使用logsMonitorQuery(appliedFilters.value)的默认状态。该状态会重置分页,但不会保留routeState.value.selectedRequestID。selectedRequestID控制LogDetailDrawer的显示,因此刷新会关闭当前详情抽屉。请在重置分页时透传selectedRequestID。♻️ 建议的修复
- await router.replace(monitorLocation(logsMonitorQuery(appliedFilters.value))) + await router.replace( + monitorLocation( + logsMonitorQuery(appliedFilters.value, { + filtersOpen: false, + cursorHistory: [], + selectedRequestID: routeState.value.selectedRequestID, + }), + ), + )
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: QUIET
Plan: Advanced
Run ID: fb63c687-b1c7-4783-b333-905d8d4726c5
📒 Files selected for processing (14)
web/src/components/ui/AppDateTimeRangePicker.vueweb/src/features/access-keys/AccessKeySelect.vueweb/src/features/monitor/LogsAdvancedFilterDrawer.vueweb/src/features/monitor/LogsFilterForm.vueweb/src/features/monitor/LogsTab.vueweb/src/features/monitor/MonitorView.vueweb/src/features/monitor/UsageTab.vueweb/src/features/monitor/log-filters.tsweb/src/features/monitor/monitor-route.tsweb/src/features/monitor/usage-filters.tsweb/src/i18n/locales/en-US/monitor.tsweb/src/i18n/locales/ja-JP/monitor.tsweb/src/i18n/locales/zh-CN/monitor.tsweb/src/lib/time.ts
💤 Files with no reviewable changes (1)
- web/src/features/monitor/usage-filters.ts
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
关联 Issue / Related Issue
无。
变更内容 / Change Content
请求日志与用量与成本此前采用不同的时间筛选入口,快捷时间刷新及重置行为也不一致。现统一 Tab 右侧的日期、筛选、刷新操作,并共用时间范围逻辑。
preset,点击刷新按当前时刻重新计算范围;日期面板中的“应用”始终提交固定的自定义时间,URL 使用from_ms/to_ms。验证:当前提交已通过
make check,包含前端 lint、格式检查、类型检查与构建,以及 Go 静态检查、构建和完整测试。页面样式与交互已由用户验收;遵循仓库规则,未运行前端或浏览器测试。影响范围:仅调整前端,后端查询仍接收明确的
from_ms/to_ms;无后端 API 或数据库迁移变更。本次无需更新公开文档或发布说明。自查清单 / Checklist
make check,或在说明中写明无法运行的原因和未验证范围。 / I ranmake check, or documented why it could not run and what remains unverified.