Skip to content

perf(web): render each Launches and Workspaces dialog once, and load a workspace's roots when asked - #231

Merged
harenome merged 2 commits into
ThinkFlowLab:mainfrom
harenome:perf/page-dialogs
Nov 19, 2026
Merged

harenome merged 2 commits into
ThinkFlowLab:mainfrom
harenome:perf/page-dialogs

Conversation

@harenome

@harenome harenome commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #229

What

Two commits.

  1. Launches (runs/launches.html, runs/_launch_ask.html). The page renders one Add to workspace template, listing every workspace. Each row's button carries data-add (its launch's add address) and data-title. On click, a small handler sets the heading and the form's action, and removes the workspaces in the row's data-f-ws, which the row already had. dialogs() uses the page's template when a row has none. The Delete dialog does not change.
  2. Workspaces (workspaces/workspaces.html, web/workspaces.py).
    • The Roots dialog's markup moves unchanged into workspaces/_roots.html. A new GET route, /workspaces/<name>/roots, renders it, with the same _root() checks. On open, the dialog shows the .skel blocks of the page skeleton, fetches the route, then focuses its first control. If the fetch fails, it shows "Could not load the roots. Close and try again." The page no longer runs _root() on every folder of every workspace.
    • The Delete dialog is one template. Each row's button carries data-label, data-action and data-judged.
    • The rename form of each row stays as it is.

The .gitignore ignores workspaces/, so _roots.html is added with git add -f, like the folder's other template. The package's templates/**/*.html glob includes it.

Touches

routes (web/workspaces.py) · templates (runs/launches.html, runs/_launch_ask.html, workspaces/workspaces.html, workspaces/_roots.html) · tests

Before and after

The dialogs look as before. The Roots dialog now loads when it opens: its skeleton, and its line when the fetch fails.

1280 px, light 390 px, dark
Loading after-roots-skeleton-light-1280 after-roots-skeleton-dark-390
Failed after-roots-failed-light-1280 after-roots-failed-dark-390

Verified

A synthetic profile in a rootless Podman container: 100 workspaces, 2000 Harbor jobs, 200 run records. Server times are the median of requests 2 to 5, browser loads the median of loads 2 to 5 (loadEventEnd).

Launches, main Launches, branch Workspaces, main Workspaces, branch
HTML 1,554,225 B 574,000 B 862,519 B 293,050 B
<option> / <template> 20,204 options 106 options 503 templates 1 template
Server 0.51 s 0.42 s 0.63 s 0.53 s
Browser load 763 ms 678 ms 803 ms 614 ms

The Roots route takes 0.18 s for a workspace with four folders.

  • python3 app/tests/parallel.py: 3060 tests in 155 modules, OK.
  • pip install -r app/requirements.txt, then python3 app/tests/parallel.py app/ui_tests: 662 tests in 55 modules, OK.
  • New and changed route tests: the Add dialog is drawn once, with every workspace in order and each row's attributes; Workspaces has no folder list and one template; the Roots route, its 404 and its Unlink forms' CSRF token; the Delete button's attributes.

Browser checks, Chromium (Playwright 1.49.1), light at 1280 px and dark at 390 px, main beside the branch:

  • Add to workspace on a launch in no workspace, in one and in two: same heading, accessible name, options, New workspace… field, Cancel, Escape and focus. Add to an existing and to a new workspace both post and update the row.
  • Roots: the skeleton while the fetch is held, then the list. A folder's delete prompt and Keep it. Escape returns focus to the row's button. A forced 500 shows the line.
  • Delete on two workspaces: heading, action and text. A real delete and a real Unlink on a scratch profile.

No page JavaScript error. Not checked: a screen reader.

Risk

  • The Roots dialog now needs a request. A workspace whose workspace.json names it differently from its folder gets a 404 and shows the failure line. Its Delete and Unlink already fail the same way.
  • The Add dialog's handler must run after the one dialogs() registers. It does, because that script comes earlier on the page.
  • A revert restores the per-row templates.

Every row carried a hidden copy of the Add dialog with a select of every
workspace the launch was not in: with 200 launches and 100 workspaces,
about 20,000 options and two thirds of the page's bytes. The page now
draws the dialog once; a row's button carries its add URL and title, and
opening it drops the workspaces the row already lists (data-f-ws).
The Workspaces page rendered every workspace's Roots dialog and Delete
prompt as hidden templates. The Roots dialog is now fetched from
/workspaces/<name>/roots when it opens, with a skeleton while it loads
and one line when it cannot; the page no longer reads every root's run
record. Delete is one template filled from the row's button.
@harenome
harenome merged commit 252a5b8 into ThinkFlowLab:main Nov 19, 2026
2 checks passed
@harenome
harenome deleted the perf/page-dialogs branch November 19, 2026 13:31
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.

Launches and Workspaces: every row carries its own hidden copy of a dialog

1 participant