Add Events tab to vibration monitoring location detail page #47

Closed
opened 2026-04-14 00:35:39 -04:00 by serversdown · 1 comment
Owner

Summary

The vibration_location_detail.html page currently has Overview and Settings tabs but no way to view SFM event history for the location. This is the key missing piece in the vibration module.

Backend changes (backend/main.py)

The route handler for vibration location detail (around line 397) currently only fetches the active UnitAssignment. It needs to also pass full assignment_history:

assignment_history = db.query(UnitAssignment)\
    .filter(UnitAssignment.location_id == location.id)\
    .order_by(UnitAssignment.assigned_at.asc())\
    .all()
# pass to template context

Frontend changes (templates/vibration_location_detail.html)

Add an Events tab alongside the existing Overview and Settings tabs. The tab should:

  • Iterate over assignment_history entries
  • For each assignment, fetch events from the SFM proxy:
    GET /api/sfm/db/events?serial={assignment.unit_id}&from_dt={assignment.assigned_at}&to_dt={assignment.assigned_until}
  • Display events in a table grouped by unit serial (with date range shown)
  • PPV color coding: 🟢 green < 0.5 in/s, 🟡 amber < 2.0 in/s, 🔴 red ≥ 2.0 in/s

Secondary task

Add an Event History section to the unit detail page (/unit/{id}) pulling from /api/sfm/db/events?serial={unit.id} for a unit-centric view.

Notes

  • SFM proxy already wired at /api/sfm/*http://localhost:8200
  • Natural join key: unit.id == serial in SFM DB
  • Reference: sfm/sfm_webapp.html History tab (loadHistory()) for existing fetch + render pattern including PPV formatting
## Summary The `vibration_location_detail.html` page currently has Overview and Settings tabs but no way to view SFM event history for the location. This is the key missing piece in the vibration module. ## Backend changes (`backend/main.py`) The route handler for vibration location detail (around line 397) currently only fetches the active `UnitAssignment`. It needs to also pass full `assignment_history`: ```python assignment_history = db.query(UnitAssignment)\ .filter(UnitAssignment.location_id == location.id)\ .order_by(UnitAssignment.assigned_at.asc())\ .all() # pass to template context ``` ## Frontend changes (`templates/vibration_location_detail.html`) Add an **Events** tab alongside the existing Overview and Settings tabs. The tab should: - Iterate over `assignment_history` entries - For each assignment, fetch events from the SFM proxy: `GET /api/sfm/db/events?serial={assignment.unit_id}&from_dt={assignment.assigned_at}&to_dt={assignment.assigned_until}` - Display events in a table grouped by unit serial (with date range shown) - PPV color coding: 🟢 green < 0.5 in/s, 🟡 amber < 2.0 in/s, 🔴 red ≥ 2.0 in/s ## Secondary task Add an Event History section to the unit detail page (`/unit/{id}`) pulling from `/api/sfm/db/events?serial={unit.id}` for a unit-centric view. ## Notes - SFM proxy already wired at `/api/sfm/*` → `http://localhost:8200` - Natural join key: `unit.id` == `serial` in SFM DB - Reference: `sfm/sfm_webapp.html` History tab (`loadHistory()`) for existing fetch + render pattern including PPV formatting
serversdown added the Kind/EnhancementKind/Feature
Priority
Medium
3
labels 2026-04-14 00:36:15 -04:00
serversdown added this to the Terra-View project 2026-04-14 00:36:16 -04:00
Author
Owner
image.png

Separate tabs added including events.

<img width="248" alt="image.png" src="attachments/1524c1d5-b70e-4540-903b-f6e142af4181"> Separate tabs added including events.
2.1 KiB
Sign in to join this conversation.