Skip to content

fix(log): 修复新前端日志按登录类型(type=7)筛选失效 - #5620

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
feitianbubu:fix/log-login-type-filter
Jun 20, 2026
Merged

fix(log): 修复新前端日志按登录类型(type=7)筛选失效#5620
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
feitianbubu:fix/log-login-type-filter

Conversation

@feitianbubu

@feitianbubu feitianbubu commented Jun 20, 2026

Copy link
Copy Markdown
Member

本 PR 由 AI 辅助生成并经人工复核整理。

📝 变更描述 / Description

修复新前端「通用日志」按登录类型(type=7)筛选无效的问题。

根因:路由 search 校验的枚举 logTypeValues 只列了 '0'~'6',漏掉了登录类型 '7'。下拉框选「登录」后 type=['7'] 校验失败,被 .catch([]) 兜底成空数组,导致最终请求丢掉 type 参数,后端按全部类型返回。

修复:将 '7' 补入 logTypeValues,与 LOG_TYPE_ENUM.LOGINLOG_TYPES 保持一致。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)

✅ 提交前检查项 / Checklist

  • 非重复提交
  • 变更理解
  • 范围聚焦
  • 本地验证(抓包确认筛选登录类型后请求携带 type=7)
  • 安全合规

📸 运行证明 / Proof of Work

修复前:选「登录」筛选,请求 URL 无 type 参数,返回所有类型日志。
修复后:请求携带 type=7,仅返回登录日志。

Summary by CodeRabbit

  • New Features
    • Usage logs now support filtering by an additional log type.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a3f0de7b-151a-477e-aa07-f107acb02ef4

📥 Commits

Reviewing files that changed from the base of the PR and between cb84185 and 86e61b5.

📒 Files selected for processing (1)
  • web/default/src/routes/_authenticated/usage-logs/$section.tsx

Walkthrough

The logTypeValues constant in the usage-logs route is extended by adding '7' as an accepted value. This broadens the Zod search schema enum for the type query parameter to include the new log type.

Changes

Usage Logs Route Validation

Layer / File(s) Summary
Extend logTypeValues enum
web/default/src/routes/_authenticated/usage-logs/$section.tsx
Adds '7' to the logTypeValues array, making the type query parameter Zod enum accept the new log type value.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐇 A single digit joins the fold,
The number seven, brave and bold.
In enum arrays it finds its place,
Validated now with quiet grace.
Hop hop hooray, the schema grows! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the bug fix: enabling login type (type=7) filtering in usage logs, which matches the core change of adding '7' to logTypeValues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

路由 search 校验枚举 logTypeValues 漏了 '7'(登录),
选「登录」时 type=['7'] 校验失败被 .catch([]) 兜底成空数组,
最终请求丢掉 type 参数。补上 '7' 与 LOG_TYPE_ENUM.LOGIN 对齐。
@feitianbubu
feitianbubu force-pushed the fix/log-login-type-filter branch from 656f07e to 86e61b5 Compare June 20, 2026 06:26
@Calcium-Ion
Calcium-Ion merged commit 7409174 into QuantumNous:main Jun 20, 2026
1 check passed
ruanhangjian pushed a commit to ruanhangjian/new-api that referenced this pull request Jul 11, 2026
路由 search 校验枚举 logTypeValues 漏了 '7'(登录),
选「登录」时 type=['7'] 校验失败被 .catch([]) 兜底成空数组,
最终请求丢掉 type 参数。补上 '7' 与 LOG_TYPE_ENUM.LOGIN 对齐。
noah-wung pushed a commit to noah-wung/new-api that referenced this pull request Jul 17, 2026
路由 search 校验枚举 logTypeValues 漏了 '7'(登录),
选「登录」时 type=['7'] 校验失败被 .catch([]) 兜底成空数组,
最终请求丢掉 type 参数。补上 '7' 与 LOG_TYPE_ENUM.LOGIN 对齐。
zhaodechao2008 pushed a commit to zhaodechao2008/new-api that referenced this pull request Jul 27, 2026
路由 search 校验枚举 logTypeValues 漏了 '7'(登录),
选「登录」时 type=['7'] 校验失败被 .catch([]) 兜底成空数组,
最终请求丢掉 type 参数。补上 '7' 与 LOG_TYPE_ENUM.LOGIN 对齐。
330079598 pushed a commit to 330079598/new-api that referenced this pull request Aug 19, 2026
路由 search 校验枚举 logTypeValues 漏了 '7'(登录),
选「登录」时 type=['7'] 校验失败被 .catch([]) 兜底成空数组,
最终请求丢掉 type 参数。补上 '7' 与 LOG_TYPE_ENUM.LOGIN 对齐。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants