Commit Graph

168 Commits

Author SHA1 Message Date
caoqianming 837e648b7d docs: update README for workspace and web split layout
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 08:41:47 +08:00
caoqianming a3bc280c0f chore: remove obsolete root src/ (migrated to crates)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 08:36:27 +08:00
caoqianming 797e96cbb5 refactor(ops): add ops web scaffold and update router for split dirs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 08:33:30 +08:00
caoqianming f9f9915012 refactor(feeder): update static file serving for split web dirs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 08:21:17 +08:00
caoqianming 9bbbb82459 refactor(web): move feeder HTML, JS, and index into web/feeder
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 08:17:51 +08:00
caoqianming 8cea26cb07 refactor(web): move shared HTML partials and CSS into web/core
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 08:15:14 +08:00
caoqianming 56e404555b refactor(web): split modals into core and feeder unit-modal
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 08:12:10 +08:00
caoqianming c3037e52cf docs(code): clean garbled rust comments 2026-04-16 15:40:28 +08:00
caoqianming 60452f9065 test(workspace): verify dual-app release builds 2026-04-16 13:17:41 +08:00
caoqianming 3cc13ccf1e feat(ops): add operation-system app skeleton 2026-04-16 12:59:31 +08:00
caoqianming c562bcc10b feat(feeder): create dedicated feeder distributor app crate 2026-04-16 12:38:58 +08:00
caoqianming 9a3d1f5ebb refactor(core): move websocket runtime and command infrastructure 2026-04-16 11:16:56 +08:00
caoqianming de1879bbf2 refactor(events): add shared event envelopes with namespaces 2026-04-16 09:52:31 +08:00
caoqianming 7d83cf27dd fix(feeder): restore downstream wiring after shared-core extraction 2026-04-16 08:38:47 +08:00
caoqianming 3d18a65c7d refactor(core): move platform data and connection modules 2026-04-16 08:23:49 +08:00
caoqianming 6b3c52e45e refactor(core): finish model import cleanup 2026-04-15 16:20:53 +08:00
caoqianming a1e2536844 refactor(core): complete model and util move 2026-04-15 16:08:58 +08:00
caoqianming b34c898089 refactor(core): move model and util modules into shared crate 2026-04-15 13:14:24 +08:00
caoqianming cf26a1f319 feat(core): add shared platform skeleton 2026-04-15 12:55:52 +08:00
caoqianming 1fdfc4e5fc build(workspace): add dual-app workspace manifests 2026-04-14 16:29:52 +08:00
caoqianming fb6a34a2d9 chore(git): ignore local worktrees directory 2026-04-14 16:00:24 +08:00
caoqianming c472360061 docs(plan): add existing system implementation proposals 2026-04-14 15:56:06 +08:00
caoqianming 87450af171 docs(plan): add dual-app shared-core implementation plan 2026-04-14 15:49:08 +08:00
caoqianming e2a2d4a55e docs(architecture): add dual-app shared-core design 2026-04-14 15:34:24 +08:00
caoqianming 43bbc36106 docs: 一些文档修改 2026-04-01 08:22:34 +08:00
caoqianming 3f517c5f48 feat(app): prevent multiple instances 2026-03-31 10:18:57 +08:00
caoqianming 7a8b0e6ce7 docs(api): document rem_local field and REM control behavior
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 10:52:21 +08:00
caoqianming 737f32af8f fix(event): rem_recovered as warn with manual restart reminder
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 10:47:44 +08:00
caoqianming 7ae952f93e feat(event): add RemLocal/RemRecovered events for REM-triggered auto-stop
When any equipment's REM signal switches to local mode, fire a dedicated
`unit.rem_local` event (with unit + equipment context) and record it to
the event log. Also fire `unit.rem_recovered` when all REM signals return
to remote. AutoControlStopped is still fired alongside RemLocal when
auto was running at the time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 10:39:17 +08:00
caoqianming 4227747852 feat(control): stop auto-control and disable buttons when REM goes local
- Add `rem_local: bool` to UnitRuntime; set true when any equipment's
  REM signal is false with good quality
- Engine check_fault_comm: stop auto-control and fire AutoControlStopped
  when any equipment switches to local mode
- Block start-auto when rem_local (backend + error message)
- Frontend: disable Start Auto button in units/ops views when rem_local
- Frontend: disable equipment Start/Stop buttons in config view when
  unit's rem_local is true

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 10:30:43 +08:00
caoqianming 1354f89204 db: enforce unique signal_role per equipment on point
Prevents accidentally binding two points with the same role to the
same equipment at the database level.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 22:14:27 +08:00
caoqianming 45b2317ee8 feat(docs): add README.md button opening shared doc drawer
Reuses the existing API.md drawer for README; switching between
docs reloads content and updates the drawer title. Backend serves
README.md via /api/docs/readme-md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 16:27:51 +08:00
caoqianming c2cac19f7e fix(points): ensure equipment map is loaded before rendering point list
loadPoints() relies on state.equipmentMap to display bound equipment names.
Running it in parallel with loadEquipments() caused a race condition where
points rendered before the map was populated, showing all as "Unbound".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 16:21:57 +08:00
caoqianming c1c70ed7f6 refactor(web): remove topbar equipment filter 2026-03-26 15:33:19 +08:00
caoqianming 656a2a6b36 feat: api文档更新 2026-03-26 13:55:35 +08:00
caoqianming 68b4eec610 fix(logs): follow rotated log files in stream 2026-03-26 13:41:36 +08:00
caoqianming 9f833f3a5e fix(control): refresh unit mappings on config changes 2026-03-26 13:30:14 +08:00
caoqianming dbfa673468 fix(control): validate unit timing configuration 2026-03-26 13:19:10 +08:00
caoqianming 86e651d9ca refactor(sort): order units and equipment by code 2026-03-26 12:57:01 +08:00
caoqianming ad4b0c0680 docs(api): update control section for fault-guard changes
- start-auto now requires fault_locked=false and manual_ack_required=false
- batch-start-auto now also skips units with manual_ack_required
- add manual_ack_required to pre-flight check list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 11:12:00 +08:00
caoqianming ce8383e815 feat(ops): replace signal dots with pills, gate Start/Stop on REM/FLT
Signal indicators are now wider pill badges (40×20px rect) with the role
label (REM/RUN/FLT) embedded inside, replacing the 10px dot+label rows.

Equipment Start/Stop buttons are disabled when:
- auto control is active
- REM = 0 (device in local mode, not accepting remote commands)
- FLT = 1 (fault active)

Button state reacts in real time to WS signal updates via a per-equipment
syncBtns closure registered in state.opsUnitSyncFns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 11:09:23 +08:00
caoqianming 00c16ae3d7 fix(unit): block auto control start when fault is active or unacknowledged
Prevent starting unit auto control while fault_locked or manual_ack_required,
enforcing that faults must be manually acknowledged before resuming automation.
Also disable the Start Auto button in the frontend with descriptive tooltips.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 10:54:10 +08:00
caoqianming f37924ae36 feat(events): color-code event level badges by severity
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 10:44:12 +08:00
caoqianming 8e52a327f5 fix(events): load system events on page refresh in ops view
Events were only loaded when switching to config view, but the
system events panel lives in ops view, leaving it empty on refresh.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 10:41:27 +08:00
caoqianming 4338895e0a refactor(ops): use units-embedded equipments, lazy-load config data
Ops view now reads equipment+role_points from state.units (returned by
unit list API) instead of state.equipments, eliminating the loadEquipments()
call on bootstrap.

Config data (sources, equipments, events, points) is deferred until the
user first switches to config view. On WS reconnect, loadEquipments is
only refreshed when config view is active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 10:33:19 +08:00
caoqianming 0545388b85 feat(unit): embed equipments with role_points in unit list and get responses
Unit list and single-unit endpoints now include per-unit equipment list
with signal-role points and monitor data, consistent with unit detail.
Uses batch queries to avoid N+1 DB calls.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 10:26:45 +08:00
caoqianming 5a481a5eb3 refactor(simulate): consolidate all simulation code into simulate.rs
Moved simulate_run_feedback from command.rs into simulate.rs where it
reuses patch_signal. command.rs now only contains real PLC command logic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 10:17:44 +08:00
caoqianming 532eeaba42 feat(simulate): chaos task for rem/flt signal testing
When SIMULATE_PLC=true, a background task randomly disrupts rem or flt
signals on equipment (rem=false for 5-15s, flt=true for 3-10s) to
exercise fault detection, comm lock, and recovery logic in the engine.
Uses XorShift64 PRNG with no extra dependencies.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 10:11:05 +08:00
caoqianming 9d787e452b feat(events): use Chinese messages with entity names
Event messages are now stored and displayed in Chinese. Names/codes are
resolved via lightweight DB lookups in persist_event_if_needed (entities
still exist at processing time). SourceDelete passes the name explicitly
since the source is deleted before the async event is processed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 09:53:26 +08:00
caoqianming 0b7f2401bd feat(ws): refresh units and equipments on WebSocket reconnect
After a disconnect/reconnect, re-fetch units (runtimes) and equipments
(monitor data) so the UI reflects current server state without requiring
a page reload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 09:37:00 +08:00