- #6 Config tab by serial: the empty legacy edit form stays hidden (settings are read-only until phase 5); the settings box shows from the start, 'Not read yet', and a different unit's settings are never left on screen. - #10 A start/stop that went out but was not confirmed is no longer called 'failed'. The route now adds 'sent' (acknowledged / unknown) and 'audit_id' to a ChangeUnconfirmed -- same status, same message -- and the page says 'Start monitoring not confirmed: <what happened, audit record>'. - #12 Device tab by serial: the empty legacy Compliance/Project tables are hidden behind a pointer to the Config tab; a Micromate's Firmware card reads 'Thor line (version not read)' (its version string is in 0x01, undecoded). - #16 A 504 with nothing sent adds: the connection opened, so the modem is reachable -- another program (THOR or Blastware) may be holding the line, or the unit is busy. Measured 2026-10-29: THOR polling leaves SFM a 0-byte 504. New logic lives in sfm/static/device_routing.js (firmwareLabel, deviceErrorText, changeErrorText, serialPanes) under Node tests; the page glue in sfm_webapp.js only applies them. Checked in jsdom against the real page (served at a fake origin, /static from disk): all four, legacy mode unchanged, no script errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
1 parent
2b886c4f39
commit
8123d75d72
7 files changed
+163
-22
No files matched your search
@@ -154,4 +154,42 @@ function downloadSummary(body) {
|
||||
if (body.inserted === false) return `already stored — ${body.stored_filename}`;
|
||||
return `stored ${body.stored_filename}, ${body.filesize} bytes, check: ${(body.detail || {}).check}`;
|
||||
}
|
||||
|
||||
// A Micromate's version string lives in 0x01, undecoded; which firmware line it
|
||||
// runs comes free with every reply (bench finding #12).
|
||||
const FIRMWARE_LINES = { thor: 'Thor line (version not read)', blastware: 'Blastware line (version not read)' };
|
||||
function firmwareLabel(info) {
|
||||
const i = info || {};
|
||||
return i.firmware_version || i.firmware || FIRMWARE_LINES[(i.detail || {}).firmware_line] || '—';
|
||||
}
|
||||
|
||||
// A failed device request's message. A 504 is a unit that took the connection
|
||||
// but never answered: while THOR polls a Micromate, SFM's connection is accepted
|
||||
// and gets 0 bytes (measured 2026-10-29, bench finding #16). The hint is left
|
||||
// off once a change was sent -- its own message says what happened.
|
||||
const NO_REPLY_HINT = 'the connection opened, so the modem is reachable — another program (THOR or '
|
||||
+ "Blastware) may be holding this unit's line, or the unit is busy (e.g. its sensor check)";
|
||||
function errorDetail(body, statusText) {
|
||||
const b = body || {}, d = b.detail;
|
||||
return b.outcome ? changeSummary(b) : typeof d === 'string' ? d : d ? (d.message || JSON.stringify(d)) : statusText;
|
||||
}
|
||||
function deviceErrorText(status, body, unit, statusText) {
|
||||
const text = errorDetail(body, statusText);
|
||||
return status === 504 && !(body || {}).sent && unit && unit.host ? `${text} — ${NO_REPLY_HINT}` : text;
|
||||
}
|
||||
|
||||
// A start/stop that went out (or may have) is not "failed": its body carries
|
||||
// `sent` (ChangeUnconfirmed, bench finding #10), and its message says what the
|
||||
// unit did and names the audit record.
|
||||
function changeErrorText(verb, status, body, unit, statusText) {
|
||||
if ((body || {}).sent) return `${verb} monitoring not confirmed: ${errorDetail(body, statusText)}`;
|
||||
return `${verb} monitoring failed: ${deviceErrorText(status, body, unit, statusText)}`;
|
||||
}
|
||||
|
||||
// By serial, settings are read-only until phase 5: no empty legacy edit form or
|
||||
// legacy tables, and the settings box shows from the start (#6, #12).
|
||||
function serialPanes(bySerial, settingsRead) {
|
||||
return { configForm: !bySerial, settingsBox: bySerial, settingsPlaceholder: bySerial && !settingsRead,
|
||||
legacyDeviceTables: !bySerial };
|
||||
}
|
||||
/* </device-routing> */
|
||||
Reference in new issue
Block a user