Skip to content

feat(monitor): 统一日志与用量的时间筛选交互 - #608

Merged
tbphp merged 6 commits into
mainfrom
tbphp/align-log-time-filters
Sep 9, 2026
Merged

feat(monitor): 统一日志与用量的时间筛选交互#608
tbphp merged 6 commits into
mainfrom
tbphp/align-log-time-filters

Conversation

@tbphp

@tbphp tbphp commented Sep 9, 2026

Copy link
Copy Markdown
Owner

关联 Issue / Related Issue

无。

变更内容 / Change Content

  • Bug 修复 / Bug fix
  • 新功能 / New feature
  • 其他改动 / Other changes

请求日志与用量与成本此前采用不同的时间筛选入口,快捷时间刷新及重置行为也不一致。现统一 Tab 右侧的日期、筛选、刷新操作,并共用时间范围逻辑。

  • 快捷时间显示名称,URL 仅保留 preset,点击刷新按当前时刻重新计算范围;日期面板中的“应用”始终提交固定的自定义时间,URL 使用 from_ms / to_ms
  • 翻页、切换日志与用量、修改普通筛选时保留当前时间区间;重置普通筛选不影响时间。
  • 日志快捷筛选依次为分组、渠道、状态、访问密钥、协议、客户端模型;更多筛选按请求与响应、上游尝试与重试、响应耗时、Token 与缓存、成本与计价分组。
  • 修复日期弹层无法点击及校验信息影响排版的问题,移除时间 tooltip,统一控件高度及访问密钥搜索下拉框的文字、对齐和箭头样式。
  • 清理重复的筛选草稿初始化、数值字段定义、事件包装及无效样式,保留已验收的功能、样式和交互。

验证:当前提交已通过 make check,包含前端 lint、格式检查、类型检查与构建,以及 Go 静态检查、构建和完整测试。页面样式与交互已由用户验收;遵循仓库规则,未运行前端或浏览器测试。

影响范围:仅调整前端,后端查询仍接收明确的 from_ms / to_ms;无后端 API 或数据库迁移变更。本次无需更新公开文档或发布说明。

自查清单 / Checklist

  • 我已运行 make check,或在说明中写明无法运行的原因和未验证范围。 / I ran make check, or documented why it could not run and what remains unverified.
  • 本 PR 范围聚焦,未包含无关改动。 / This PR is focused and contains no unrelated changes.
  • 我已更新必要的公开文档或发布说明。 / I updated any required public documentation or release notes.
  • 我已确认提交、日志和测试数据不包含敏感信息。 / I confirmed that commits, logs, and fixtures contain no sensitive data.
  • 如适用,我已说明兼容性或数据迁移影响。 / Where applicable, I documented compatibility or data-migration impact.

Copilot AI lite review requested due to automatic review settings September 9, 2026 09:45

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-09T09:51:44.679677Z 30d04c1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

本次变更统一日志和用量监控的时间范围及过滤器状态。日志过滤器改用 AppliedLogFiltersDateTimePreset,并更新路由序列化。MonitorView 向两个标签页传递已应用过滤器,并统一刷新逻辑。日志筛选表单新增频道、协议和响应字段。高级筛选抽屉重新组织字段分区。时间范围选择器支持显示预设名称。AccessKeySelect 和相关样式同步调整。

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 30d04

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了本次 PR 的主要变更,即统一监控页面日志与用量的时间筛选交互。标题简洁且与变更内容相关。
Description check ✅ Passed 描述基本完整。已说明变更内容、验证范围、影响范围、兼容性影响和文档发布说明结论,并完成自查清单。关联 Issue 标记为“无”,且未勾选文档更新项并已说明无需更新。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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.

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_msto_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.selectedRequestIDselectedRequestID 控制 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

📥 Commits

Reviewing files that changed from the base of the PR and between fb18dc9 and 30d04c1.

📒 Files selected for processing (14)
  • web/src/components/ui/AppDateTimeRangePicker.vue
  • web/src/features/access-keys/AccessKeySelect.vue
  • web/src/features/monitor/LogsAdvancedFilterDrawer.vue
  • web/src/features/monitor/LogsFilterForm.vue
  • web/src/features/monitor/LogsTab.vue
  • web/src/features/monitor/MonitorView.vue
  • web/src/features/monitor/UsageTab.vue
  • web/src/features/monitor/log-filters.ts
  • web/src/features/monitor/monitor-route.ts
  • web/src/features/monitor/usage-filters.ts
  • web/src/i18n/locales/en-US/monitor.ts
  • web/src/i18n/locales/ja-JP/monitor.ts
  • web/src/i18n/locales/zh-CN/monitor.ts
  • web/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.

@tbphp tbphp self-assigned this Sep 9, 2026
@tbphp tbphp added the enhancement New feature or request label Sep 9, 2026
@tbphp tbphp added this to the v2.0.0 milestone Sep 9, 2026
@tbphp
tbphp merged commit d417b7d into main Sep 9, 2026
11 checks passed
@tbphp
tbphp deleted the tbphp/align-log-time-filters branch September 9, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants