feat(webapp): edit a unit's settings by serial: preview, send, read back
The Config tab by serial is now the unit's edit form, headed 'On the unit <serial> -- read HH:MM' and built from the server's editable fields. Preview runs a dry run and shows old -> new, notes and anything that blocks the change; Send (confirm) sends exactly what was previewed, with its revision, then shows what the unit now holds and re-reads it. An edit after a preview disables Send until the next preview. The by-host form loses its write button; the read stays. Logic in device_routing.js (Node-tested), glue in sfm_webapp.js, no inline JS. 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
e8eabee4a2
commit
385716d8e1
7 files changed
+351
-77
No files matched your search
@@ -57,3 +57,17 @@ def test_the_page_scripts_are_served_from_static(name):
|
||||
|
||||
def test_a_missing_static_file_is_a_404():
|
||||
assert _get("/static/nope.js")[0] == 404
|
||||
|
||||
|
||||
def test_the_config_write_is_the_audited_preview_and_send():
|
||||
# Phase 5: the legacy by-host "Write to Device" is gone; the serial-mode edit
|
||||
# form's Preview and Send are wired from sfm_webapp.js, not inline handlers.
|
||||
html = PAGE.read_text()
|
||||
assert 'id="cfg-write-btn"' not in html
|
||||
for el in ("cfg-edit", "cfg-preview-btn", "cfg-send-btn", "cfg-preview", "cfg-result"):
|
||||
tag = re.search(r'<[^>]*id="%s"[^>]*>' % el, html)
|
||||
assert tag is not None and "onclick" not in tag.group(0), el
|
||||
js = (PAGE.parent / "static" / "sfm_webapp.js").read_text()
|
||||
assert "config_write" not in js and "function writeConfig" not in js
|
||||
assert "getElementById('cfg-preview-btn').addEventListener" in js
|
||||
assert "getElementById('cfg-send-btn').addEventListener" in js
|
||||
Reference in new issue
Block a user