Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ config/
- **pdf.js 6 用到的 ES2026 方法由 PDF 页自己补**(`Pdf/pdfjsPolyfills.mjs`,只补缺失):主线程在 react-pdf 之前 import;worker 是独立全局,经 `pdfWorkerSrc.ts` 的 blob 入口先 import 该文件的产物 URL。所以它必须是无 import 的纯 ESM,且不能经 babel(`config/urlAssets.ts`,两份 config 的 chainWebpack 都要调用)。不要换 pdfjs-dist 的 legacy 构建:它内置的 core-js 会强制替换原生 `Promise.try` 等。升级 pdfjs-dist 后用较旧的 Chromium(如沙箱的 /opt/pw-browsers)跑 PDF e2e,看是否又用上了新的内建方法
- **public 资源路径一律经 `PUBLIC_PATH` 拼接**:GitHub Pages 部署在 `/umi-react-admin/` 子路径
- **业务数据只由 `src/demo/generate.ts` 以固定种子生成**,不要在页面里写死示例数据,也不要引入来源不明的第三方数据
- **全局加载占位只认 `src/loading.tsx`**(umi 约定):放在 `src/pages/loading.tsx` 不会生效,分包加载期间整屏空白
- **pages 下不要有名为 `model.ts(x)` 的文件**:umi model 插件会把它当数据模型加载(macOS 大小写不敏感时 `Model.tsx` 同样中招,dev 编译失败)
- **登录后跳转要等登录态提交**:在 `setInitialState` 之后立即 `history.push` 会被路由守卫弹回登录页(登录页用 effect 监听 `initialState.name` 再跳)
- **html2canvas 1.x 解析不了 `oklch()`**:Tailwind 4 调色板是 oklch,被截图区域不要用 Tailwind 颜色工具类或任意 `[#hex]` 颜色类(后者体积门禁也识别不了),改用 style 或 antd token
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ Maintained in the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) forma

## [Unreleased]

### Demo data review fixes (2026-10-22)

- **Store version 4** (`STORE_VERSION`): generation rules changed, so v3 patches are dropped (Reset restores the baseline)
- **Audit log**: "Handle alarm" entries only target alarms that were actually handled and are stamped at the handling moment (ticket creation for ticketed alarms, recovery time for recovered / false-positive ones) — about one in ten used to point at alarms that were still unrecovered and untouched (`ALM-LIVE-*`); ticket assign / close entries use the ticket's own creation / completion time
- **Scenario tickets** use the shared `TICKET_TITLES` templates (e.g. "Verify abnormal signal", "Quarterly routine inspection") instead of their own short titles
- **Scenario events** sit on calendar slots instead of "now + offset": the ad-hoc review takes the next free 10:00 / 14:00 / 16:30 slot at least 30 minutes ahead (skipping one already taken by a regular review), tomorrow's handover is at 09:30, the multi-day inspection starts at 09:00 — previously minutes drifted with the visit time (11:11, 04:32) and the "handover tomorrow" landed at 19:30
- **Ticket board**: routine inspections are created slightly more often (≈1.5 per weekday) with 5–8 days of field work, so "In progress" averages ~9 natural tickets (was ~5, sometimes 1); fault-ticket timing — and with it the SLA and response KPIs — is unchanged
- **Audio**: `scripts/make-demo-audio.mjs` regenerates both clips deterministically as a pentatonic melody with bass and off-beat ticks (stereo) and a swelling arpeggio (mono) — same 16 kHz / 8 s format and size; the waveform now shows note attacks and the spectrum has harmonics instead of a single sine line
- **Excel**: "Load a sample" links under the drop zone feed the bundled sample files through the same validation pipeline, without downloading and re-uploading

### UI review fixes (2026-10-22)

- **Build**: the production build failed on `import { default as … } from 'mgrs'` (the ESM entry webpack resolves has only named exports), so the GitHub Pages deploy of the Situation release never shipped; `forward` is resolved through the namespace object like milsymbol. The Cesium lifecycle test mocks `cesium-navigation-es6` (its UMD build requires `'Cesium'`, which Node cannot resolve)
- **Sign-in**: the evidence strip shows live numbers from a new public demo endpoint `GET /api/v1/demo/snapshot` (same aggregation as the dashboard KPIs) instead of hard-coded 236/240 · 12 · 96.4%, and only in demo mode; quick-entry buttons read "Try as …" / 「以…体验」 throughout
- **Loading**: the route skeleton moved to `src/loading.tsx` — umi only picks up that path, so the old `src/pages/loading.tsx` never rendered and chunk loads (e.g. right after sign-in) showed a blank screen. `html` follows the theme's `color-scheme`, so dark mode no longer flashes white during those frames and native scrollbars match
- **Navigation**: en-US top-level groups are Ops / Docs / Errors and top-nav items use 10px side padding, so all eight groups fit from 1280px instead of folding into "···"
- **Cesium**: the scene shell no longer adds its own 40/16px padding on top of DemoPage's (content lines up with other pages, the stage fits the viewport, phones get the full width); the legend moved into the left column under the panels (Situation's group list and legend overlapped); the credit container override uses `!important` because the Viewer rewrites its position inline on resize, which left the ion logo under the legend; the basemap alert spans narrow stages with the retry button below the text. Situation and Direction use neutral monitoring wording (coastal sea & air traffic, cooperative / civil / unidentified / suspicious / non-compliant, groups instead of order of battle; no real sea names or ELINT)
- **Dashboard**: the disposition sankey aligns nodes by level (terminal dispositions no longer share the last column with ticket results, whose labels overlapped); the sunburst labels only cities with ≥4% of devices; the device-health scatter jitters points deterministically and its tooltip names the fields; the scatter and sunburst share one region-to-colour mapping; region uptime bar labels use dark text; alarm types have fixed colours (`ALARM_TYPE_COLOR`: device offline grey, overheating volcano — no green, which means healthy elsewhere) instead of rank-ordered category colours; the 7-day sparkline is visible on dark cards
- **Pages**: the ticket board's columns scroll internally on desktop (the 3-day done column used to stretch the page past 4000px); alarms open the handle menu on click (as do the users, Excel and sign-in language dropdowns) and confirm before closing as false positive; recovered ticketed alarms use the same status dot as other recovered rows; the calendar shows 24-hour `HH:mm` times; the screenshot card lists recent alarms with level tags instead of a one-bar "height = level" chart; the video page replaces xgplayer's "unsupported format" overlay with a load-failure state and retry; spectrum style options are localized; the monthly PDF report's KPI is 30-day alarms instead of today's; copy says 243 stations (240 + 3 demo-scenario stations)

### Review fixes: Cesium scenes, basemap chain and navigation (2026-10-19)

- **Military symbols**: unknown and hostile SIDCs were written as `UFA-…`/`HFA-…` (affiliation in the coding-scheme position); milsymbol rejected them and drew them as **friendly** blue frames, so the Situation page's hostile and unknown tracks contradicted their red/yellow labels and trails. Sea-surface function codes (`MS`) were invalid too. The table now uses valid codes (`symbols.test.ts` asserts validity and affiliation for every entry), and `militarySymbol` returns the real `width`/`height` plus an anchor `offset` — the labelled station symbol (95×41) used to be stretched into a square
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE) [![Deploy](https://github.com/Jerry-CodeHub/umi-react-admin/actions/workflows/deploy.yml/badge.svg?branch=master)](https://github.com/Jerry-CodeHub/umi-react-admin/actions/workflows/deploy.yml) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](./CONTRIBUTING.md)

`umi-react-admin` is an open-source admin template built on **Umi Max 4 + React 19 + Ant Design 6 + ProComponents**. Unlike most templates, its demo tells **one coherent story**: a fictional IoT monitoring platform — 240+ stations, ~90 days of alarms, tickets derived from those alarms, 86 operators with role-based permissions and audit logs. Every number on the dashboard is aggregated live from those records, and holds up to scrutiny.
`umi-react-admin` is an open-source admin template built on **Umi Max 4 + React 19 + Ant Design 6 + ProComponents**. Unlike most templates, its demo tells **one coherent story**: a fictional IoT monitoring platform — 243 stations, ~90 days of alarms, tickets derived from those alarms, 86 operators with role-based permissions and audit logs. Every number on the dashboard is aggregated live from those records, and holds up to scrutiny.

**[Live demo](https://jerry-codehub.github.io/umi-react-admin/)** — one-click sign-in for five roles (`admin` / `lead` / `operator` / `analyst` / `guest`) sharing the same dataset, so you can compare permission differences across menus, buttons and API responses (see `docs/demo/role-matrix.md`).

Expand All @@ -19,7 +19,7 @@
| Dashboard | KPIs (online devices, alarms today, SLA rate, avg response), alarm trend, type mix, regional online rate, disposition flow, device health, distribution, latest activity |
| System | Users (filter / sort / batch / detail drawer), roles (permission tree), audit logs, access demo (route-level / button-level / data-level) |
| Operations | Device registry, alarm center (convert to ticket / recover / false positive), ticket board (drag & drop, keyboard accessible), spectrum occupancy (D3) |
| Maps | AMap, OpenLayers (same station set); six Cesium scenes: GeoHash grid, direction & distance, heatmap, routes & coverage, box-select & measure, air/sea situation |
| Maps | AMap, OpenLayers (same station set); six Cesium scenes: GeoHash grid, direction & distance, heatmap, routes & coverage, box-select & measure, sea & air traffic |
| Components | Calendar (FullCalendar), rich text (self-hosted TinyMCE with data-generated weekly report), signature (ticket acceptance), page screenshot (html2canvas) |
| Media / Documents | Video, music player, waveform; browser-side monthly PDF report and Excel import/export (row-level validation) generated live from the data |

Expand Down
4 changes: 2 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE) [![Deploy](https://github.com/Jerry-CodeHub/umi-react-admin/actions/workflows/deploy.yml/badge.svg?branch=master)](https://github.com/Jerry-CodeHub/umi-react-admin/actions/workflows/deploy.yml) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](./CONTRIBUTING.zh-CN.md)

`umi-react-admin` 是基于 **Umi Max 4 + React 19 + Ant Design 6 + ProComponents** 的开源后台模板。和多数模板不同,它的演示内容讲的是**同一个故事**:一个虚构的「物联网监测运营平台」——240 台监测站、近 90 天告警、由告警派生的工单、86 名运维人员、角色权限与操作审计,工作台上的每个数字都由这些明细实时聚合,经得起推敲。
`umi-react-admin` 是基于 **Umi Max 4 + React 19 + Ant Design 6 + ProComponents** 的开源后台模板。和多数模板不同,它的演示内容讲的是**同一个故事**:一个虚构的「物联网监测运营平台」——243 台监测站、近 90 天告警、由告警派生的工单、86 名运维人员、角色权限与操作审计,工作台上的每个数字都由这些明细实时聚合,经得起推敲。

**[在线演示](https://jerry-codehub.github.io/umi-react-admin/)** —— 登录页提供五种角色的一键体验(`admin` 管理员 / `lead` 值班长 / `operator` 运维工程师 / `analyst` 数据分析员 / `guest` 访客),共用同一份演示数据,可直接对比菜单、按钮与接口层的权限差异(见 `docs/demo/role-matrix.md`)。

Expand All @@ -19,7 +19,7 @@
| 工作台 | KPI(在线设备、今日告警、工单时限达成率、平均响应)、告警趋势、类型占比、各大区在线率、处置流向、设备健康、设备分布、最新动态 |
| 系统管理 | 用户管理(筛选 / 排序 / 批量 / 详情抽屉)、角色权限(权限点树)、操作日志、权限演示(路由级 / 按钮级 / 数据级) |
| 设备运维 | 设备台账、告警中心(转工单 / 恢复 / 误报关闭)、工单看板(拖拽流转,支持键盘)、频谱占用(D3) |
| 地图 | 高德、OpenLayers(同一批站点);Cesium 六个场景:GeoHash 网格、方位测距、场强热力图、路线与覆盖、框选与测距、海空态势 |
| 地图 | 高德、OpenLayers(同一批站点);Cesium 六个场景:GeoHash 网格、方位测距、场强热力图、路线与覆盖、框选与测距、海空目标 |
| 组件 | 日程(FullCalendar)、富文本(自托管 TinyMCE,预置按数据生成的周报)、电子签名(工单验收)、页面截图(html2canvas) |
| 多媒体 / 文档 | 视频、音乐播放器、波形;浏览器内按数据生成的月报 PDF、Excel 导入导出(逐行校验) |

Expand Down
2 changes: 1 addition & 1 deletion THIRD-PARTY-NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Direct dependencies are predominantly permissive; the full transitive inventory

| Resource | Source | License |
| --- | --- | --- |
| `public/audio/audio.wav`, `public/audio/stereo.wav` | Project-made (sine-synthesized audio) | MIT, with the project |
| `public/audio/audio.wav`, `public/audio/stereo.wav` | Project-made (synthesized by `scripts/make-demo-audio.mjs`) | MIT, with the project |
| `public/data/cesium/*.json` (coverage envelopes, field-strength tests, station-coverage polygons), `src/demo/` (demo data generators and name catalogs) | Project-made demo data | MIT, with the project |
| `public/logo.svg`, `public/favicon.svg`, `public/favicon.ico`, `public/apple-touch-icon.png` | Project-made logo (monitoring-radar mark; the ICO/PNG are deterministically rasterized from the two SVGs by `scripts/make-icons.mjs`) | MIT, with the project |
| `public/_headers`, `public/_redirects`, `public/api-not-configured.json` | Project-made deployment configuration (Cloudflare Pages response headers and the `/api` rewrite) | MIT, with the project |
Expand Down
2 changes: 1 addition & 1 deletion THIRD-PARTY-NOTICES.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

| 资源 | 来源 | 许可 |
| --- | --- | --- |
| `public/audio/audio.wav`、`public/audio/stereo.wav` | 项目自制(正弦合成音频) | 随项目 MIT |
| `public/audio/audio.wav`、`public/audio/stereo.wav` | 项目自制(`scripts/make-demo-audio.mjs` 合成) | 随项目 MIT |
| `public/data/cesium/*.json`(覆盖包络、场强测试、站点覆盖多边形)、`src/demo/`(演示数据生成器与词库) | 项目自制演示数据 | 随项目 MIT |
| `public/logo.svg`、`public/favicon.svg`、`public/favicon.ico`、`public/apple-touch-icon.png` | 项目自制标识(监测雷达图形;ICO/PNG 由 `scripts/make-icons.mjs` 从两份 SVG 确定性栅格化) | 随项目 MIT |
| `public/_headers`、`public/_redirects`、`public/api-not-configured.json` | 项目自制的部署配置(Cloudflare Pages 响应头与 `/api` 改写) | 随项目 MIT |
Expand Down
6 changes: 3 additions & 3 deletions docs/demo/demo-scenarios.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": 3,
"storeKey": "umi-react-admin:demo-store:v3",
"version": 4,
"storeKey": "umi-react-admin:demo-store:v4",
"generatedBy": "src/demo/scenarios.ts(src/demo/manifest.test.ts 生成)",
"accounts": [
{
Expand Down Expand Up @@ -191,7 +191,7 @@
"EV-SCN-MULTIDAY",
"EV-SCN-CROSSMONTH"
],
"initialState": "今天稍后 / 明天 / 明天全天 / 跨天 / 跨月(本月最后一天 → 下月第一天)",
"initialState": "下一场临时评审(最近的工作时段)/ 明早值班交接 / 后天全天 / 跨天 / 跨月(本月最后一天 → 下月第一天)",
"demonstrates": "新建/编辑/改期/详情/空态/未来列表"
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/demo/demo-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
- **精确操作**:
1. 点「示例文件 ▾」下拉 → 下载「全部无效(错误邮箱 / 非法登录名 / 缺必填)」(`users-invalid.xlsx`);
2. 把文件拖入(或点击选择)上传区 → 查看红色错误预览态 → 点「重新选择文件」;
3. 再从「示例文件」下载「全有效(3 行 · 主线导入用)」(`users-valid.xlsx`)并上传 → 预览绿色全有效 → 点「导入 3 条有效数据」;
3. 再从「示例文件」下载「全有效(3 行 · 主线导入用)」(`users-valid.xlsx`)并上传(或直接点上传区下方「直接载入示例」里的「全有效」,免下载再上传)→ 预览绿色全有效 → 点「导入 3 条有效数据」;
4. 打开 `/system/users`,关键字输入 `demo.` 查询。
- **语义对象 ID**:新用户 `demo.iris` / `demo.hugo` / `demo.nora`。
- **预期可见结果**:
Expand All @@ -129,7 +129,7 @@

- **预算时长**:1.5 分钟。
- **起点**:任意页(先退出登录)。
- **精确操作**:头像菜单「退出登录」→ 登录页点「数据分析员体验」(`analyst` / `demo`)→ 看 `/dashboard`(与 admin 所见同一份数据)→ 地址栏直接输入 `/system/users` → 再打开 `/ops/alarms` 找一条未恢复告警 → (可选)打开开发者工具 Network 面板演示接口层拒绝。
- **精确操作**:头像菜单「退出登录」→ 登录页点「以数据分析员体验」(`analyst` / `demo`)→ 看 `/dashboard`(与 admin 所见同一份数据)→ 地址栏直接输入 `/system/users` → 再打开 `/ops/alarms` 找一条未恢复告警 → (可选)打开开发者工具 Network 面板演示接口层拒绝。
- **语义对象 ID**:无(看的是权限行为;告警仍以 `ALM-SCN-*` 为例)。
- **预期可见结果**:
- 工作台指标与刚才 admin 看到的一致(含 O+1 后的在线数)——同一份数据,只是权限不同;
Expand Down
14 changes: 7 additions & 7 deletions docs/demo/role-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

登录页(演示模式)提供五个一键体验入口,实现见 [src/pages/Login/index.tsx](../../src/pages/Login/index.tsx) 与 [src/demo/scenarios.ts](../../src/demo/scenarios.ts) 的 `DEMO_ACCOUNTS`。演示环境任意密码均可登录,约定统一填 `demo`:

| 账号 | 角色 | 登录页按钮 | 定位 |
| ---------- | ------------------- | -------------- | ---------------------------------- |
| `admin` | admin 系统管理员 | 以管理员体验 | 全部权限,负责账号、角色与平台配置 |
| `lead` | lead 值班长 | 值班长体验 | 当班指挥:告警研判、工单派发与关闭 |
| `operator` | operator 运维工程师 | 运维工程师体验 | 现场处置:处理告警与工单 |
| `analyst` | analyst 数据分析员 | 数据分析员体验 | 只读业务数据,可导出报表 |
| `guest` | viewer 访客 | 访客体验 | 只读工作台与设备概况 |
| 账号 | 角色 | 登录页按钮 | 定位 |
| ---------- | ------------------- | ---------------- | ---------------------------------- |
| `admin` | admin 系统管理员 | 以管理员体验 | 全部权限,负责账号、角色与平台配置 |
| `lead` | lead 值班长 | 以值班长体验 | 当班指挥:告警研判、工单派发与关闭 |
| `operator` | operator 运维工程师 | 以运维工程师体验 | 现场处置:处理告警与工单 |
| `analyst` | analyst 数据分析员 | 以数据分析员体验 | 只读业务数据,可导出报表 |
| `guest` | viewer 访客 | 以访客体验 | 只读工作台与设备概况 |

## 权限矩阵

Expand Down
Loading
Loading