- #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
@@ -73,9 +73,7 @@ async function deviceFetch(action, params = {}, opts = {}) {
|
||||
const r = await deviceRequest(action, params, opts);
|
||||
const body = await r.json().catch(() => ({}));
|
||||
if (!r.ok) {
|
||||
const d = body.detail;
|
||||
const err = new Error(body.outcome ? changeSummary(body)
|
||||
: typeof d === 'string' ? d : d ? (d.message || JSON.stringify(d)) : r.statusText);
|
||||
const err = new Error(deviceErrorText(r.status, body, currentUnit(), r.statusText));
|
||||
err.status = r.status; err.body = body;
|
||||
throw err;
|
||||
}
|
||||
@@ -102,6 +100,22 @@ function applyControls() {
|
||||
chr.title = s4;
|
||||
document.getElementById('ch-series-note').textContent = s4;
|
||||
setMonitorButtons();
|
||||
applyConfigPanes();
|
||||
}
|
||||
|
||||
// The Config tab by serial (#6): settings are read-only until phase 5, so the
|
||||
// empty legacy edit form stays hidden and the settings box shows from the start.
|
||||
// A different unit's settings are never left on screen.
|
||||
let settingsShownFor = null;
|
||||
function applyConfigPanes() {
|
||||
const serial = normSerial(currentUnit().serial);
|
||||
const p = serialPanes(Boolean(serial), Boolean(serial) && settingsShownFor === serial);
|
||||
document.getElementById('cfg-form').style.display = p.configForm ? '' : 'none';
|
||||
document.getElementById('cfg-settings').style.display = p.settingsBox ? 'block' : 'none';
|
||||
if (p.settingsPlaceholder) {
|
||||
settingsShownFor = null;
|
||||
renderTextTable('cfg-settings-table', [['Settings', 'Not read yet — press Read from Device']]);
|
||||
}
|
||||
}
|
||||
|
||||
async function hangUp() {
|
||||
@@ -430,8 +444,7 @@ async function changeMonitoring(action) {
|
||||
if (body.outcome) {
|
||||
setStatus(changeSummary(body), r.ok ? 'ok' : 'error');
|
||||
} else {
|
||||
const d = body.detail;
|
||||
setStatus(`${verb} monitoring failed: ${typeof d === 'string' ? d : d ? JSON.stringify(d) : r.statusText}`, 'error');
|
||||
setStatus(changeErrorText(verb, r.status, body, currentUnit(), r.statusText), 'error');
|
||||
}
|
||||
} catch (e) {
|
||||
// No reply is not "nothing sent": the request may have reached the unit.
|
||||
@@ -454,7 +467,7 @@ function populateDeviceTab() {
|
||||
const cardData = [
|
||||
{ label:'Serial Number', value: unitInfo.serial || '—' },
|
||||
{ label:'Series', value: confirmedSeries(currentUnit()) ?? '—' },
|
||||
{ label:'Firmware', value: unitInfo.firmware_version || unitInfo.firmware || '—' },
|
||||
{ label:'Firmware', value: firmwareLabel(unitInfo) },
|
||||
{ label:'DSP', value: unitInfo.dsp_version || (unitInfo.detail || {}).dsp_version || '—' },
|
||||
{ label:'Model', value: unitInfo.model || '—' },
|
||||
{ label:'Manufacturer', value: unitInfo.manufacturer || (unitInfo.detail || {}).manufacturer || '—' },
|
||||
@@ -471,6 +484,11 @@ function populateDeviceTab() {
|
||||
cards.appendChild(c);
|
||||
}
|
||||
|
||||
// The legacy settings tables are empty by serial (#12); the Config tab reads them.
|
||||
const legacy = serialPanes(serialMode(), false).legacyDeviceTables;
|
||||
document.getElementById('dev-legacy-tables').hidden = !legacy;
|
||||
document.getElementById('dev-serial-note').hidden = legacy;
|
||||
|
||||
// Compliance table
|
||||
const cc = unitInfo.compliance_config || {};
|
||||
const RECORDING_MODE_LABELS = {0: 'Single Shot', 1: 'Continuous', 3: 'Histogram', 4: 'Histogram + Continuous'};
|
||||
@@ -713,6 +731,7 @@ async function readSettingsBySerial() {
|
||||
try {
|
||||
const st = await deviceFetch('settings');
|
||||
renderTextTable('cfg-settings-table', settingsRows(st));
|
||||
settingsShownFor = normSerial(st.serial);
|
||||
document.getElementById('cfg-settings').style.display = 'block';
|
||||
document.getElementById('cfg-form').style.display = 'none';
|
||||
setCfgStatus(`Settings read from ${st.serial}.`, 'ok');
|
||||
|
||||
Reference in new issue
Block a user