feat(web): Rotation, Operation History, Config Editor and Backup & Restore become ES-module pages (stage 2) - #727
Conversation
…store become ES-module pages (stage 2) Continues #703. Each partial's inline script moves to static/v3/js/pages/<name>.js with init/destroy under the page registry; the partials carry no <script> and no onclick (buttons are delegated data-actions). Listeners and reads use ctx.signal; writes run to completion and still report. The ten globals the Config Editor and Backup & Restore defined stay as deprecated aliases via window.LEDMatrix. api.js gains a raw body option for uploads, and PluginOrderList.init() a signal option. Adds a DOM suite per page and extends test_es_modules.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 22 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (22)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 3 critical 8 high |
🟢 Metrics 319 complexity · 7 duplication
Metric Results Complexity 319 Duplication 7
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Continues the ES-module migration from #703 with steps 2–5 of
docs/WEB_FRONTEND_ARCHITECTURE.md.What changed
durations.htmlpages/durations.jsoperation_history.htmlpages/operation-history.jsraw_json.htmlpages/raw-json.jsbackup_restore.htmlpages/backup-restore.jsdata-pageroot and no<script>and noonclick. Buttons carrydata-actionand use one delegated listener on the root. The page registry runsinit()once per swap-in anddestroy()on swap-out.ctx.signal, so a swap removes the listeners and cancels the requests. Writes (save, delete, export, restore) are not cancelled: the server finishes them anyway, so the result is still reported in a notification but nothing is drawn into a page that has gone. Timers (the history search debounce, the rotation widget's wait) are cleared indestroy().window.*aliases through the facade, each warning once:formatJson,manualValidateJson,validateJSON,saveMainConfig,saveSecretsConfig,exportBackup,loadBackupList,validateRestoreFile,clearRestore,runRestore.boot.jskeeps each loaded module, sovalidateJSONstill returns its boolean synchronously.api.jstakes a rawbody(aFormDataupload).PluginOrderList.init()takes an optionalsignal.textContentthroughout, which replaces the remaininginnerHTMLtemplates on these pages.innerHTMLunescaped.PluginAPI's cache when it is loaded, as before, so a reloaded tab costs no extra request.Not moved (on purpose)
durations.htmlkeepshx-on:htmx:after-request="showSaveResult(...)"andonsubmit="fixInvalidNumberInputs(this)". Both call shared globals that other tabs use too, andonsubmithas to run before htmx serialises the form. They move with step 6 (Schedule), which handleshx-on. Neither is a<script>.Doc corrections
The migration table said the Config Editor had "no globals" and used CodeMirror. In fact it defined 5 globals and uses plain textareas. The table now marks steps 2–5 done and describes these conventions.
Tests
REQUIRE_DOM=1, real partial from the server and the real API's payload shape). Each one checks that the page mounts once after repeated swaps and that each action makes exactly one request:test/js/dom/test_durations_page.js(25 checks)test/js/dom/test_operation_history_page.js(42)test/js/dom/test_raw_json_page.js(33)test/js/dom/test_backup_restore_page.js(56)signal: ctx.signalmakes it fail.test_es_modules.pycovers the new pages:init<script>and noonclickboot.jsand exported by its module, and no template defines it any moretest_core_modules.jscovers the raw-body upload.test_html_escaping.jsdrops the two template escapers that no longer exist.node test/js/run_all.jswithREQUIRE_DOM=1against a local server: all 23 suites pass.61 failed / 6 errors, with FAILED/ERROR IDs identical to anorigin/mainbaseline run in a separate worktree. The branch has 17 more passing tests.python scripts/build_css.py --check: up to date.Browser smoke test (real app,
origin/mainvs this branch)Each run cycled the four tabs ten times, then re-swapped each panel ten times with
htmx.ajax, then fired one action per page.plugins/installed11 on both)window.validateJSONdirectly.🤖 Generated with Claude Code