Repository navigation
perf(web): render each Launches and Workspaces dialog once, and load a workspace's roots when asked - #231
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #229
What
Two commits.
runs/launches.html,runs/_launch_ask.html). The page renders one Add to workspace template, listing every workspace. Each row's button carriesdata-add(its launch's add address) anddata-title. On click, a small handler sets the heading and the form's action, and removes the workspaces in the row'sdata-f-ws, which the row already had.dialogs()uses the page's template when a row has none. The Delete dialog does not change.workspaces/workspaces.html,web/workspaces.py).workspaces/_roots.html. A new GET route,/workspaces/<name>/roots, renders it, with the same_root()checks. On open, the dialog shows the.skelblocks 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.data-label,data-actionanddata-judged.The
.gitignoreignoresworkspaces/, so_roots.htmlis added withgit add -f, like the folder's other template. The package'stemplates/**/*.htmlglob includes it.Touches
routes (
web/workspaces.py) · templates (runs/launches.html,runs/_launch_ask.html,workspaces/workspaces.html,workspaces/_roots.html) · testsBefore and after
The dialogs look as before. The Roots dialog now loads when it opens: its skeleton, and its line when the fetch fails.
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).<option>/<template>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, thenpython3 app/tests/parallel.py app/ui_tests: 662 tests in 55 modules, OK.Browser checks, Chromium (Playwright 1.49.1), light at 1280 px and dark at 390 px, main beside the branch:
No page JavaScript error. Not checked: a screen reader.
Risk
workspace.jsonnames it differently from its folder gets a 404 and shows the failure line. Its Delete and Unlink already fail the same way.dialogs()registers. It does, because that script comes earlier on the page.