feat(webapp): list and download events by serial, for both series

- Load events with a serial lists the shared EventRef shape as a table: index,
  time, type, PVS and the three peaks (or —), each row with its own Download.
- Download POSTs the row's event_id; SFM checks and stores it.  The status bar
  says what was stored (or that it already was), and the stored event opens
  in the viewer.  A refusal shows the server's detail verbatim.
- eventView() (device-routing block, Node-tested) reads both event shapes for
  the table, the chips and the peaks bar.
- A list loaded without a serial keeps the chips and the per-index Load /
  Save / Download buttons, unchanged; for a serial-loaded list those buttons
  are off with a tooltip pointing at the rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-10-29 11:54:43 -04:00
1 parent 44d6e754bd
commit 9aae3b09de
2 files changed
+117 -17

No files matched your search

+17 -1
View File
@@ -24,7 +24,7 @@ PAGE = Path(__file__).resolve().parent.parent / "sfm" / "sfm_webapp.html"
NODE = shutil.which("node")
pytestmark = pytest.mark.skipif(NODE is None, reason="node is not installed; the page-logic tests need it")
EXPORTS = ["seriesFromSerial", "unitQuery", "deviceUrl", "confirmedSeries", "controlsFor",
EXPORTS = ["seriesFromSerial", "unitQuery", "deviceUrl", "confirmedSeries", "controlsFor", "eventView",
"changeSummary", "downloadSummary"]
@@ -188,3 +188,19 @@ def test_device_url_puts_an_event_index_in_the_path():
assert r[0] == {"method": "GET", "path": "/device/event/3/waveform?host=h&tcp_port=9034"}
assert r[1] == {"method": "GET", "path": "/device/event/0/blastware_file?serial=BE9441&host=h&tcp_port=9034"}
assert "throws" in r[2]
def test_event_view_reads_both_event_shapes():
shared = {"event_id": "BE9441:0111f210:20261026170036", "index": 2, "timestamp": "2026-10-26T17:00:36",
"record_type": "histogram", "peak_vector_sum_ips": 1.083,
"peaks_ips": {"tran": 0.25, "vert": 1.08, "long": 0.195}}
legacy = {"index": 0, "timestamp": {"display": "2026-10-26 16:06:37"}, "record_type": "Waveform",
"peak_values": {"tran_in_s": 0.03, "vert_in_s": 0.095, "long_in_s": 0.02,
"peak_vector_sum": 0.1, "micl_psi": 0.0001}}
bare = {"index": 5}
a, b, c = run(["eventView", [shared]], ["eventView", [legacy]], ["eventView", [bare]])
assert a == {"label": "2026-10-26 17:00:36", "title": "histogram",
"peaks": {"tran": 0.25, "vert": 1.08, "long": 0.195, "pvs": 1.083, "micPsi": None}}
assert b == {"label": "2026-10-26 16:06:37", "title": "Waveform",
"peaks": {"tran": 0.03, "vert": 0.095, "long": 0.02, "pvs": 0.1, "micPsi": 0.0001}}
assert c == {"label": "Event 5", "title": "", "peaks": None}