feat(access-logs): 日志明细支持按状态码筛选并折叠次要搜索项,修复首页来源分布无数据

- 修复 PostgreSQL/SQLite 日志库下首页「来源分布」卡片无数据:RegionCounts 对空
  节点 ID 误拼 node_id = '' 恒空条件,改为空节点 ID 表示全节点聚合(对齐 CH 语义),
  并过滤空白归属地
- /access-logs?tab=list 新增状态码筛选:状态码下拉含常用 2xx/3xx/4xx/5xx 选项,
  校验 100-599,非法值返回 400;ClickHouse 与 PostgreSQL/SQLite 日志库均支持
- 搜索框折叠:默认仅显示来源 IP 与状态码,节点 ID/访问域名/请求路径折叠进
  「更多筛选」
This commit is contained in:
ryan
2026-08-13 09:59:32 +08:00
parent f1577bf092
commit 75d1fcf345
18 changed files with 322 additions and 75 deletions
@@ -5,6 +5,7 @@ export type SearchDraft = {
remoteAddr: string;
host: string;
path: string;
statusCode: string;
};
export type OverviewRangeHours = 24 | 168 | 360 | 720;
@@ -14,6 +15,23 @@ export type RateLimitRangeHours = 24 | 72;
export const PAGE_SIZE_OPTIONS = [20, 50, 100, 200];
/** 状态码快捷筛选项(空值表示全部,由 Select placeholder 兜底)。 */
export const STATUS_CODE_OPTIONS: { value: string; label: string }[] = [
{ value: '200', label: '200 OK' },
{ value: '301', label: '301 永久重定向' },
{ value: '302', label: '302 临时重定向' },
{ value: '304', label: '304 未修改' },
{ value: '400', label: '400 请求错误' },
{ value: '401', label: '401 未授权' },
{ value: '403', label: '403 禁止访问' },
{ value: '404', label: '404 未找到' },
{ value: '429', label: '429 请求过多' },
{ value: '500', label: '500 服务器错误' },
{ value: '502', label: '502 网关错误' },
{ value: '503', label: '503 服务不可用' },
{ value: '504', label: '504 网关超时' },
];
export const OVERVIEW_RANGE_OPTIONS: {
value: OverviewRangeHours;
label: string;