Skip to content

feat(TAP-13326): rework audit log query bar and drop time zone labels - #680

Draft
weiliang110100 wants to merge 2 commits into
developfrom
hardy/TAP-13326-6affee7b
Draft

weiliang110100 wants to merge 2 commits into
developfrom
hardy/TAP-13326-6affee7b

Conversation

@weiliang110100

@weiliang110100 weiliang110100 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

变更说明

审计日志页原先直接使用公共 FilterBar:时间、事件类型、来源、结果、操作人、IP、操作、对象、事件 ID、操作 ID、关键词共 11 项平铺,改动即生效,右上角另有时区文字;控制台「系统趋势」标题下方也显示时区。本 PR 按 TAP-13326 原型调整:

  • 查询区布局(AuditLog.vue):改为页面专用、可自动换行的一行:快捷范围 → 时间范围 → 关键词 → 事件类型 → 操作结果 → 更多筛选(已生效计数)→ 查询 → 重置。「更多筛选」展开来源、操作人、来源 IP、操作内容、操作对象;不再提供事件 ID、操作 ID 查询入口。公共 FilterBar 未修改,不影响其它页面。
  • 时间范围:起止时间合并为一个 el-date-picker(datetimerange,精确到秒,不可清空)。快捷范围按当前时间计算:最近 7 天(往前 6 天 00:00:00 至今天 23:59:59,默认)、今天、最近 24 小时;在面板中手动确定时间后切换为「自定义」。
  • 查询与刷新:区分编辑中条件和已生效条件。修改后提示「条件已修改,待查询」;「查询」写入路由并请求,「刷新」按已生效条件重新拉取当前页。已生效的非时间条件显示为可移除标签,移除后立即重新查询;「重置」恢复最近 7 天并清空其余条件;各输入框内 Enter 触发查询;无结果时显示「暂无匹配的日志」。
  • 操作内容:由手输 action key 改为可搜索的分组下拉。audit-log.ts 维护与后端 AuditAction 一致的 135 个 action 及所属事件类型,复用现有 audit_action_* 译文;已选事件类型时只列该类型的操作,切换事件类型后不匹配的已选操作自动清空。
  • 移除时区文字:删除审计日志右上角时区文字,以及 Dashboard.vue 系统趋势卡片中的时区文字;自定义时间选择器仅在「自定义」时显示,靠右对齐。
  • i18n:zh-CN、zh-TW、en 各新增查询区文案 29 项,删除不再使用的 audit_filter_*、audit_reset_filters、audit_time_zone、dashboard_odh_timezone。表格列名、详情抽屉与 CSV 导出文案不变。

IT 用例与覆盖

本次只修改 tapdata-web 前端视图与文案,不涉及后端接口或 Java 模块,Maven 集成测试不适用(N/A)。

  • 单测:apps/daas/tests/audit-log.test.ts 新增 10 个纯逻辑用例,覆盖快捷范围(含跨月)、路由范围解析、起止时间校验、待查询判断、更多筛选计数、已生效标签、操作分组与联动清空,以及 135 个 action 和查询区文案在三种语言中齐全;原有 11 个用例保留。node --test tests/audit-log.test.ts 在当前 Head 上结果为 21 pass / 0 fail。
  • 页面验收:多宽度中英文布局、日期面板 Enter/Esc/点击外部、真实接口与分页由研发在自有环境手工验收,结果尚未返回。

风险与依赖

  • 静态检查:本次未新增 eslint 错误或类型错误。改动文件中仍有 develop 上已存在的问题:lang 文件的 default export、daas_cluster_cluster_lianjieshuliang_detail 重复键,以及 Dashboard.vue 的 3 个既有类型错误。
  • 关键词搜索:按操作名(如「登录 TapData」)搜索依赖后端 feat(TAP-13326): match audit keyword against localized action names tapdata#3623;后端未合并前只能匹配 action key(如 auth.login)。
  • 枚举同步:前端 action 枚举需随后端 AuditAction 新增同步维护;单测会发现文案缺失,但无法自动发现后端新增的操作。
  • 日期面板交互:Enter、Esc 和点击外部以 Element Plus 自带行为为准,待手工验收确认。
  • 旧链接参数:URL 中旧的 eventId、operationId 参数不再生效。
  • 回滚:revert 本 PR 即可,无数据或接口变更。

关联任务:https://tapdata.atlassian.net/browse/TAP-13326
关联 PR:tapdata/tapdata#3623
验证代码:308ebb0698a19f882c511d28cdeb538df3ca3390
AgenticOps 版本 main-v1.6-69-bce300d8

- Replace the shared FilterBar on the audit log page with a dedicated,
  wrapping query bar: quick range, single datetime range, keyword, event
  type, result, more filters (source, operator, source IP, action, object),
  search and reset. Event ID and operation ID are no longer query inputs.
- Separate draft and applied conditions: show "changes not applied",
  search applies, refresh refetches applied conditions, applied filters
  render as removable tags, reset restores the last 7 days.
- Compute quick ranges from the current time; switch to custom after a
  manual range is confirmed.
- Turn the action filter into a searchable select grouped by event type
  and narrowed by the selected event type (135 actions matching the
  backend AuditAction catalog).
- Remove the time zone text from the audit log header and the system
  trends card, plus unused i18n keys.
- Render the query bar in TablePage's search slot so the table height
  accounts for it and no longer overflows the card.
- Move "changes not applied" and refresh to the end of the action row and
  show the applied-filter row only when filters exist, removing the blank
  gap above the table.
- Use single i18n keys with named interpolation for the more-filters
  count, filter tags and the remove-tag label.
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.

1 participant