镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

feat(web): Schedule and General become ES-module pages (stage 3) - #767

Merged
ChuckBuilds merged 2 commits into
mainfrom
claude/esm-pages-stage3
Oct 5, 2026
Merged

ChuckBuilds merged 2 commits into
mainfrom
claude/esm-pages-stage3

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

Stage 3 of the web UI's move to ES modules (docs/WEB_FRONTEND_ARCHITECTURE.md, migration steps 6 and 7). Follows #703 and #727.

What changes

Schedule (partials/schedule.html → static/v3/js/pages/schedule.js, 193 inline lines → 0)

  • Both schedule pickers are drawn from the saved config, which the partial now carries as JSON in data-schedule-config / data-dim-schedule-config instead of templating it into a script.
  • The two hx-on:htmx:after-request handlers become one htmx:afterRequest listener on the page root. The forms are marked data-reports-result, and app.js treats that like an hx-on after-request handler, so a save still shows exactly one notification.
  • The dim brightness slider's oninput moves into the module.

General (partials/general.html → static/v3/js/pages/general.js, 153 inline lines → 0)

  • The timezone picker reads the saved zone from data-timezone.
  • The Security section's three forms and two buttons carry data-action and use one delegated submit and one delegated click listener. A token row added after a create needs no listener of its own.
  • Login requests go through core/api.js. The optional login's "sign in again" answer no longer flashes an error while the page navigates away. A change made just before a swap is still reported, but nothing is drawn into the page that has gone.
  • The settings form keeps its hx-on call to the shared showSaveResult, as the Rotation form does.

Old globals stay as deprecated aliases through window.LEDMatrix (one console warning each): handleScheduleResponse, handleDimScheduleResponse, and webLogin (an object with its five methods). boot.js gains aliasObject() for that last one.

Behaviour is otherwise unchanged. Two small differences on error paths: a null JSON answer to a schedule save now reports an error instead of throwing, and a picker widget that loads late is retried for a few seconds instead of once.

Tests

  • New DOM suites test/js/dom/test_schedule_page.js (28 checks) and test/js/dom/test_general_page.js (49 checks), built like the cache suite: the real partial, the real widget and the real API shape, then five swaps followed by one action that must make exactly one request. They also cover cancel-on-swap, late widgets, hostile token names and the old entry points. Both suites were mutation-checked.
  • unit/test_general_web_login_token.js now imports the module instead of slicing the template's script.
  • unit/test_restart_banner.js covers the data-reports-result marker.
  • test/web_interface/test_es_modules.py registers both pages and aliases, and checks that no template still names a moved global. It also renders schedule.html with a hostile config (quotes, </div>) and checks the attribute parses back to the same value.

Local runs (Windows):

  • REQUIRE_DOM=1 node test/js/run_all.js against web_interface.app in emulator mode: all 33 suites pass.
  • python scripts/build_css.py --check: up to date.
  • pytest on test/web_interface plus the web smoke, auth, partial-save, legacy-flags and JS-unit tests, on this branch and on an origin/main worktree:
    • FAILED/ERROR lists are identical (11 pre-existing failures, all in test_starlark_pixlet_routes.py).
    • Passes go from 1098 to 1107.
  • Browser (the real web UI on :5000):
    • Schedule: both pickers drawn, the slider label tracks, each Save shows one toast, and an htmx re-swap leaves one mounted page.
    • General: the timezone picker is drawn. Create token adds the row with a hostile name shown as text and clears data-dirty; Revoke removes it; Save General shows one toast. A section reload re-mounts once.
    • No console errors apart from the browser pane refusing clipboard write permission on Copy, which the old code did too (it has no .catch).

🤖 Generated with Claude Code

Schedule and General follow stage 2 (#727): no inline scripts or inline
handlers in either partial. Their code moves to static/v3/js/pages/schedule.js
and pages/general.js, started per swap-in by the page registry.

- Schedule: both pickers are drawn from the saved config carried as JSON in
  data-* attributes. The forms' hx-on save handlers become one
  htmx:afterRequest listener on the page; the forms are marked
  data-reports-result, which app.js now treats like an hx-on after-request
  handler, so a save still shows one notification.
- General: the timezone picker reads data-timezone. The Security section's
  forms and buttons are delegated data-actions; requests go through
  core/api.js, so the login redirect is quiet, and a change made just
  before a swap is still reported.
- handleScheduleResponse, handleDimScheduleResponse and webLogin stay as
  deprecated aliases through window.LEDMatrix.
- New DOM suites test_schedule_page.js and test_general_page.js; the web
  login unit suite imports the module; test_es_modules.py pins the pages,
  the aliases, and the schedule config's round trip through its attribute.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1cc2c50f-dca8-4b4b-ae73-ccad857d6240
📥 Commits

Reviewing files that changed from the base of the PR and between 3866aa4 and 82a1144.

📒 Files selected for processing (15)
  • CHANGELOG.md
  • docs/WEB_FRONTEND_ARCHITECTURE.md
  • test/js/README.md
  • test/js/dom/test_general_page.js
  • test/js/dom/test_schedule_page.js
  • test/js/run_all.js
  • test/js/unit/test_general_web_login_token.js
  • test/js/unit/test_restart_banner.js
  • test/web_interface/test_es_modules.py
  • web_interface/static/v3/app.js
  • web_interface/static/v3/js/core/boot.js
  • web_interface/static/v3/js/pages/general.js
  • web_interface/static/v3/js/pages/schedule.js
  • web_interface/templates/v3/partials/general.html
  • web_interface/templates/v3/partials/schedule.html
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

codacy-production Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 2 high

Alerts:
⚠ 2 issues (≤ 0 issues of at least minor severity)

Results:
2 new issues

Category Results
Security 2 high

View in Codacy

🟢 Metrics 168 complexity · 9 duplication

Metric Results
Complexity 168
Duplication 9

View in Codacy

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.

…ge 3 modules

Codacy flagged two unused catch variables and dynamic-key writes in
pages/schedule.js and boot.js. The schedule config is read with
getAttribute, and the default days and the webLogin alias object are built
with Object.fromEntries. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChuckBuilds
ChuckBuilds merged commit 5a7893b into main Oct 5, 2026
14 of 15 checks passed
@ChuckBuilds
ChuckBuilds deleted the claude/esm-pages-stage3 branch October 5, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant