Skip to content

feat(admin): enhance operations dashboards#79

Merged
one-ea merged 11 commits into
mainfrom
dev
May 16, 2026
Merged

feat(admin): enhance operations dashboards#79
one-ea merged 11 commits into
mainfrom
dev

Conversation

@one-ea
Copy link
Copy Markdown
Owner

@one-ea one-ea commented May 16, 2026

Summary

  • Enhance admin operations dashboards across analytics, SEO, settings, and backup recovery.
  • Add actionable analytics insights, SEO quick-fix controls, refreshed site configuration, and safer backup/restore previews.
  • Bump project metadata to v2.4.2 and tag the current dev commit.

Verification

  • cd client && npm run check
  • cd server && npm run check
  • cd client && npm run lint
  • cd server && npx eslint src --max-warnings 0
  • cd client && npm run build
  • Cloudflare deploy verified: Workers 200, Pages 200, AE auth 401, sitemap/robots/rss 200.

Notes

  • This PR was opened from dev to main after pushing commit ac7a302 and tag v2.4.2.
  • Do not merge until required checks pass and review threads are resolved.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

Warning

Rate limit exceeded

@one-ea has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 50 minutes and 51 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8b2b6b28-da89-4bbf-9900-8c646761019d

📥 Commits

Reviewing files that changed from the base of the PR and between b1e6ee1 and 735aa39.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json, !**/package-lock.json
📒 Files selected for processing (29)
  • .release-please-manifest.json
  • client/package.json
  • client/src/components/admin-gate.tsx
  • client/src/components/admin-layout.tsx
  • client/src/components/comments.tsx
  • client/src/components/hero.tsx
  • client/src/components/reading-controls.tsx
  • client/src/components/search.tsx
  • client/src/components/seo-head.tsx
  • client/src/components/toc.tsx
  • client/src/globals.css
  • client/src/lib/api.ts
  • client/src/pages/admin/analytics-ae.tsx
  • client/src/pages/admin/analytics.tsx
  • client/src/pages/admin/backup.tsx
  • client/src/pages/admin/comments.tsx
  • client/src/pages/admin/dashboard.tsx
  • client/src/pages/admin/media.tsx
  • client/src/pages/admin/pages.tsx
  • client/src/pages/admin/seo.tsx
  • client/src/pages/admin/settings.tsx
  • client/src/pages/home.tsx
  • client/src/pages/post.tsx
  • package.json
  • server/package.json
  • server/src/analytics/ae-query.ts
  • server/src/analytics/ae-tracker.ts
  • server/src/analytics/insights.ts
  • server/src/index.ts
📝 Walkthrough

概览

该 PR 是 v2.4.2 补丁版本的大幅功能迭代,涉及分析系统派生数据、备份恢复向导、UI 主题统一、import 元数据扩展、Hero 配置化等多项跨端改动。核心变化包括:

  • 分析洞察系统:新增 server/src/analytics/insights.ts 实现从基础统计派生结构化洞察(KPI、趋势、内容建议、周报),AE 查询支持对比周期与搜索追踪
  • 备份恢复重构:多步骤向导、R2 预览、WebDAV 连接测试、settings 导入选项
  • UI 主题统一:全局 CSS 扩展 analytics 套件样式,admin 页面颜色从 cyan/blue 改为 foreground,添加 Work Sans/Space Grotesk 字体
  • 导入元数据:frontmatter/Hexo 新增 coverImage/publishAt/category,数据库层同步 post-tag 关联
  • Hero 配置化:Hero 组件从静态改为接收 props,Settings 页新增首屏配置项的可编辑列表

变更分布

层级 文件数 主要改动
后端分析 4 insights 生成、AE 查询扩展、API 集成
前端分析 2 analytics-ae/analytics 页面重构
UI 样式 25+ 全局 CSS、主题色更新、responsive 调整
备份系统 2 向导对话框、API 端点
导入流程 7 类型扩展、Hexo 适配、DB 层同步
Hero/首页 3 组件重构、配置解析、页面集成
编辑器 3 布局样式、元数据字段、卡片化展示
其他 20+ 导航搜索、SEO 仪表盘、版本管理

关键代码路径

分析派生流程(6 个文件)

insights.ts (生成) 
  → ae-query.ts (查询挂载)
  → api.ts (客户端类型导出)
  → analytics.tsx (页面展示)

备份恢复流程(2 个文件)

backup.tsx (UI 向导)
  → server/index.ts (预检/恢复 API)

导入元数据流(4 个文件)

frontmatter.ts (解析) 
  → hexo.ts (平台转换)
  → types.ts (类型定义)
  → d1/postgres/turso.ts (DB 同步)

风险与注意事项

  1. 分析类型破坏性变更AnalyticsData/AEAnalyticsData 新增必填 derived 字段,客户端/API 调用必须同步更新
  2. 备份预检逻辑readObjectBody 异步流读取,需验证大文件处理与错误重试
  3. 主题 CSS 兼容性:新增 analytics 组件样式与响应式规则较多(2331 行),需验证亮/暗色模式完整性
  4. 导入时序:post-tag 同步依赖 post.tags !== undefined,需验证导入源数据完整性
  5. PWA 缓存/api/auth/api/admin 排除缓存,需确保登录状态变更实时性

Walkthrough

该 PR 升级至 v2.4.2,涵盖分析派生数据系统、备份恢复向导、UI 主题统一迁移、import 元数据扩展、Hero 组件配置化等多项跨端功能。后端新增分析洞察生成引擎与 AE 增强查询,前端重构 analytics、backup、seo、editor、settings 等后台页面,全局 CSS 补齐 analytics 组件套件并更新主题色渐变。

🎯 3 (Moderate) | ⏱️ ~25 分钟

Sequence Diagrams

sequenceDiagram
  participant Client as 客户端<br/>analytics.tsx
  participant API as 后端<br/>analytics API
  participant Insights as insights.ts<br/>派生生成
  participant AE as ae-query.ts<br/>AE查询
  
  Client->>API: GET /api/admin/analytics?days=7
  API->>AE: queryAEAnalytics(env, days, posts)
  AE->>AE: 并行查询当前与对照期<br/>按天/页面/搜索聚合
  AE->>Insights: attachAnalyticsInsights(result)
  Insights->>Insights: 计算KPI/趋势/异常<br/>生成洞察与建议
  Insights-->>AE: 返回 derived 扩展结果
  AE-->>API: return { ...analytics, derived }
  API-->>Client: 派生数据注入页面
  Client->>Client: 渲染KPI卡片/趋势图<br/>内容建议/周报
Loading
sequenceDiagram
  participant User as 用户<br/>backup 页面
  participant UI as AdminBackup<br/>恢复向导
  participant API as 后端<br/>backup API
  participant DB as 数据库<br/>导入逻辑
  
  User->>UI: 点击"恢复"→预检备份
  UI->>API: POST /api/admin/backup/preview
  API->>API: buildBackupPreview()<br/>计算差异统计与风险
  API-->>UI: { summary, diff, warnings }
  UI->>UI: 展示摘要、预检警告<br/>样本文章列表
  User->>UI: 输入OVERWRITE确认→执行恢复
  UI->>API: POST /api/admin/backup/restore<br/>includeSettings: true
  API->>DB: db.importAll({ mode, overwrite })
  DB->>DB: 同步post-tag关联<br/>写入series/category
  DB-->>API: 导入完成统计
  API-->>UI: { created, updated, skipped }
  UI->>UI: 渲染完成页与结果统计
Loading

Possibly Related PRs

  • one-ea/Monolith#52: AE 增强维度与分析埋点工作,与本 PR 的派生洞察系统直接相关
  • one-ea/Monolith#76: D1 schema 对账与导入字段同步,与本 PR 的 reconcile 脚本和 DB 导入逻辑关联
  • one-ea/Monolith#50: SEO 仪表盘改进,与本 PR 的 AdminSeo 重构在同一页面实现

Suggested Labels

backend, frontend, feature, ui, analytics

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch dev

@coderabbitai coderabbitai Bot added bug Something isn't working frontend 前端 (React/Vite) 相关变更 backend 后端 (Hono Workers) 相关变更 styles CSS/UI 样式调整 feature 新功能 labels May 16, 2026
@one-ea one-ea merged commit b2724b2 into main May 16, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 后端 (Hono Workers) 相关变更 bug Something isn't working feature 新功能 frontend 前端 (React/Vite) 相关变更 styles CSS/UI 样式调整

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant