更新日志页面和统计页面

- 更新 LogsPage 和 StatsPage 组件
- 添加 taskSource 工具模块
- 更新 db/tasks.py
- 重新构建前端静态资源
This commit is contained in:
2025-12-15 16:25:37 +08:00
parent a8b9f225bd
commit 49897081b6
25 changed files with 118 additions and 65 deletions

View File

@@ -79,8 +79,19 @@ def get_task_logs(
params.append(status_filter)
if source_filter:
where_clauses.append("tl.source = ?")
params.append(source_filter)
source_filter = str(source_filter or "").strip()
# 兼容“虚拟来源”:用于筛选 user_scheduled:batch_xxx 这类动态值
if source_filter == "user_scheduled":
where_clauses.append("tl.source LIKE ? ESCAPE '\\\\'")
params.append("user_scheduled:%")
elif source_filter.endswith("*"):
prefix = source_filter[:-1]
safe_prefix = sanitize_sql_like_pattern(prefix)
where_clauses.append("tl.source LIKE ? ESCAPE '\\\\'")
params.append(f"{safe_prefix}%")
else:
where_clauses.append("tl.source = ?")
params.append(source_filter)
if user_id_filter:
where_clauses.append("tl.user_id = ?")
@@ -232,4 +243,3 @@ def get_user_run_stats(user_id, date_filter=None):
"total_items": stats["total_items"] or 0,
"total_attachments": stats["total_attachments"] or 0,
}