From 1b7edd0b0a99ddbb5ed9756ac23bc3b33787c740 Mon Sep 17 00:00:00 2001 From: Harenome Ranaivoarivony-Razanajato Date: Tue, 17 Nov 2026 14:33:09 +0100 Subject: [PATCH 01/17] refactor(web): keep the shared table styles in one block The rules the Launches and Workspaces tables share move from their page stylesheets into the table block of style.css. The Runs table pins its checkbox and Run columns with .sticky-col, as Launches does, so one rule holds every sticky column. An unsortable header is any header without data-type. The unused .grid.tools row-failed rule goes. --- app/static/runs/launches.css | 11 ++------- app/static/style.css | 36 +++++++++++++++------------- app/static/workspaces/workspaces.css | 1 - app/templates/runs/index.html | 8 +++---- app/ui_tests/test_controls_apart.py | 2 +- app/ui_tests/test_runs_by_launch.py | 2 +- 6 files changed, 28 insertions(+), 32 deletions(-) diff --git a/app/static/runs/launches.css b/app/static/runs/launches.css index e6ab049e..fc418cde 100644 --- a/app/static/runs/launches.css +++ b/app/static/runs/launches.css @@ -121,15 +121,12 @@ dialog.std-how.launch-delete { width: min(520px, calc(100vw - 32px)); } .inventory td[data-col="launch"] { min-width: 12rem; overflow-wrap: anywhere; } .inventory td[data-col="bench"], .inventory td[data-col="ws"] { min-width: 8rem; } .inventory td[data-col="machines"] { min-width: 10rem; } -.inventory td[data-col="started"], .inventory td.num { white-space: nowrap; } +.inventory td[data-col="started"] { white-space: nowrap; } @media (max-width: 640px) { .inventory td[data-col="launch"] { min-width: 9rem; } } /* a phone keeps room beside the pinned title */ -.grid.sortable.inventory thead th:not([data-type]) { cursor: default; } -.grid.sortable.inventory thead th:not([data-type])::after { content: none; } -.inventory td.inv-acts { position: relative; white-space: nowrap; } /* holds its hidden reason, inside the table's scroll */ /* Add, then Delete, side by side on every row */ .inventory .launch-add-btn:focus-visible { color: var(--text); } /* State and Launch stay put while the table scrolls sideways; State's header is its name for a screen reader only */ .inventory { --inv-state-w: 2.2rem; } -.inventory [data-col="state"] { width: var(--inv-state-w); min-width: var(--inv-state-w); padding-left: 0; padding-right: 0; text-align: center; } +.inventory :is(th, td)[data-col="state"] { width: var(--inv-state-w); min-width: var(--inv-state-w); padding-left: 0; padding-right: 0; text-align: center; } .inventory [data-col="launch"] { --sticky-left: var(--inv-state-w); } /* a run's state: its icon, coloured as the Runs page's state dots */ .inventory td[data-col="state"] .ic { vertical-align: middle; } @@ -139,12 +136,8 @@ dialog.std-how.launch-delete { width: min(520px, calc(100vw - 32px)); } .inventory .st-running { animation: inv-beat 2s ease-in-out infinite; } @keyframes inv-beat { 50% { opacity: .45; } } @media (prefers-reduced-motion: reduce) { .inventory .st-running { animation: none; } } -.inv-cols { margin-top: 1rem; } .launch-delete select { margin-left: 8px; } /* Add to workspace: the name field only for a new workspace, under its label as the select is */ .launch-delete .launch-add-new { display: none; } .launch-delete .launch-add-new input { display: block; width: 100%; margin-top: 4px; } .launch-delete form:has(option[value=""]:checked) .launch-add-new { display: block; } -/* ten columns fit at 1280 px: narrower gutters, and a count takes only its width */ -.inventory th, .inventory td { padding-left: .4rem; padding-right: .4rem; } -.inventory th.num, .inventory td.num { width: 1%; } diff --git a/app/static/style.css b/app/static/style.css index cc25d710..cb8f6981 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -352,10 +352,11 @@ button.seg:hover { filter: brightness(1.25); } overflow: hidden; background: var(--surface-2); } -/* table toolbar + column menu */ +/* the table toolkit (templates/_tables.html, static/tables.js): toolbar, menus, sorting, sticky columns, pages */ .table-tools { display: flex; align-items: center; gap: .75rem; margin: 0 0 .6rem; } .artifact-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; } .artifact-tools { flex-wrap: wrap; } +.inv-cols { margin-top: 1rem; } .menu-wrap { position: relative; } .btn.sm { font-size: .8rem; padding: .42rem .75rem; } .menu { @@ -387,10 +388,14 @@ button.seg:hover { filter: brightness(1.25); } .grid.sortable thead th[data-sorted="asc"]::after { content: "↑"; } .grid.sortable thead th[data-sorted="desc"]::after { content: "↓"; } .grid.sortable thead th:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent-soft); } +/* a header without data-type (a checkbox, a state, the actions) does not sort */ +.grid.sortable thead th:not([data-type]) { cursor: default; } +.grid.sortable thead th:not([data-type])::after { content: none; } .nowrap { white-space: nowrap; } /* give the two text-heavy columns room; the rest stay compact */ .grid th[data-col="run"], .grid td[data-col="run"] { min-width: 14rem; } +.grid [data-col="run"] { --sticky-left: 2.2rem; } /* after the checkbox */ .grid th[data-col="dataset"], .grid td[data-col="dataset"] { min-width: 10.5rem; } .grid td[data-col="dataset"] { color: var(--text-dim); } @@ -406,21 +411,15 @@ button.seg:hover { filter: brightness(1.25); } The left-pinned columns below work correctly, because the wrapper really does scroll horizontally. */ -/* the checkbox and Run columns stay put while you scroll sideways, so a row - never loses its identity; so do a table's .sticky-col cells, at --sticky-left */ -.table-wrap .grid th.pick-col, .table-wrap .grid td.pick-col, .table-wrap .grid .sticky-col { +/* a table's .sticky-col cells stay put while it scrolls sideways, at --sticky-left, so a row never loses + its identity; .sticky-edge draws the line after the last one */ +.table-wrap .grid .sticky-col { position: sticky; left: var(--sticky-left, 0); z-index: 2; background: var(--bg); } .table-wrap .grid .sticky-col.sticky-edge { box-shadow: 1px 0 0 var(--border-soft); } -.table-wrap .grid th[data-col="run"], .table-wrap .grid td[data-col="run"] { - position: sticky; left: 2.2rem; z-index: 2; background: var(--bg); - box-shadow: 1px 0 0 var(--border-soft); -} -.table-wrap .grid thead th.pick-col, -.table-wrap .grid thead th[data-col="run"], .table-wrap .grid thead th.sticky-col { z-index: 4; background: var(--bg); } +.table-wrap .grid thead th.sticky-col { z-index: 4; background: var(--bg); } /* opaque sticky cells would hide the row hover, so repaint them to match */ -.table-wrap .grid tbody tr:hover td.pick-col, -.table-wrap .grid tbody tr:hover td[data-col="run"], .table-wrap .grid tbody tr:hover td.sticky-col { background: var(--surface); } +.table-wrap .grid tbody tr:hover td.sticky-col { background: var(--surface); } /* compact density — same data, ~35% less width */ .grid.compact { font-size: .88rem; } @@ -453,14 +452,21 @@ button.seg:hover { filter: brightness(1.25); } .tools-menu .tools-all { display: flex; justify-content: flex-end; gap: .75rem; padding: .3rem .45rem; font-size: .8rem; } .tools-menu label { clear: both; } .tools-menu .tools-clear { align-self: flex-start; padding: .2rem .45rem .4rem; font-size: .8rem; } +/* a list in a .tools table: rows top-aligned; in an .inventory one, narrow gutters, a count only as wide as it + is, and an actions cell (.inv-acts) on one line; a header or cell positioned holds a hidden name or reason + inside the table's scroll */ +.grid.tools td { vertical-align: top; } +.grid.inventory th, .grid.inventory td { padding-left: .4rem; padding-right: .4rem; } +.grid.inventory th { position: relative; } +.grid.inventory th.num, .grid.inventory td.num { width: 1%; } +.inventory td.num { white-space: nowrap; } +.inventory td.inv-acts { position: relative; white-space: nowrap; } .tools-count { margin-left: .4rem; padding: 0 .4em; border-radius: 99px; background: var(--accent-soft); color: var(--text); font-size: .72rem; font-variant-numeric: tabular-nums; } .menu-head { display: flex; gap: .75rem; padding: .15rem .45rem .4rem; border-bottom: 1px solid var(--border-soft); margin-bottom: .25rem; } .chip.clear { border-style: dashed; } .pick-col { width: 2.2rem; } .pick-col input { accent-color: var(--accent); cursor: pointer; } -.grid.sortable thead th.pick-col { cursor: default; } -.grid.sortable thead th.pick-col::after { content: none; } .compare-bar { display: flex; align-items: center; gap: .7rem; margin: 0; } .btn:disabled { opacity: .4; cursor: not-allowed; filter: none; } @@ -928,8 +934,6 @@ button.seg:hover { filter: brightness(1.25); } .legend .chip:hover { cursor: help; } .cat-tag { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--text-dim); } -.grid.tools td { vertical-align: top; } -.grid.tools tr.row-failed td { background: color-mix(in srgb, var(--agent_error) 7%, transparent); } .files { margin: 0; padding-left: 1.1rem; color: var(--text-dim); font-size: .88rem; } .files li { margin: .2rem 0; } diff --git a/app/static/workspaces/workspaces.css b/app/static/workspaces/workspaces.css index cc531457..1d408dbc 100644 --- a/app/static/workspaces/workspaces.css +++ b/app/static/workspaces/workspaces.css @@ -2,7 +2,6 @@ .ws-head { justify-content: space-between; align-items: center; } .ws-current td { background: var(--accent-soft); } .ws-mark { width: 1.2rem; } -.ws-table th { position: relative; } /* holds a header named for a screen reader only, inside the scrolling box */ .ws-name { min-width: 12rem; } .ws-show { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px .4rem; } .ws-title { overflow-wrap: anywhere; } /* a name wraps, never cut */ diff --git a/app/templates/runs/index.html b/app/templates/runs/index.html index 81dbd698..685adb8e 100644 --- a/app/templates/runs/index.html +++ b/app/templates/runs/index.html @@ -186,11 +186,11 @@

{{ g.dataset_title if L.dataset else (L.name or g.dataset_title) }}{% if g.n - - + @@ -226,9 +226,9 @@

{{ g.dataset_title if L.dataset else (L.name or g.dataset_title) }}{% if g.n

- - ]*>.*?', html, re.S) if ']*>.*?', html, re.S) if '{% endmacro %} + {# The pages of the table whose id is `table` (static/tables.js `pager`): how many rows a page shows, 25 at first, and the page before and after. #} {% macro pager(table) %} diff --git a/app/templates/runs/index.html b/app/templates/runs/index.html index 685adb8e..d77138a4 100644 --- a/app/templates/runs/index.html +++ b/app/templates/runs/index.html @@ -1,5 +1,5 @@ {% from 'runs/_runtime.html' import what_ran %} -{% from '_tables.html' import filter_button %} +{% from '_tables.html' import filter_button, columns_button, columns_menu %} {% from 'runs/_launch_ask.html' import delete_ask, dialogs %} {% extends "base.html" %} {% block title %}Runs — Nullius{% endblock %} @@ -163,16 +163,11 @@

{{ g.dataset_title if L.dataset else (L.name or g.dataset_title) }}{% if g.n
- + + {#- the menu opens under Compact #} diff --git a/app/templates/runs/launches.html b/app/templates/runs/launches.html index 25c62261..bd137387 100644 --- a/app/templates/runs/launches.html +++ b/app/templates/runs/launches.html @@ -1,4 +1,4 @@ -{% from '_tables.html' import tools, pager, greyed %} +{% from '_tables.html' import tools, pager, greyed, columns_button, columns_menu, blank %} {% from 'runs/_launch_ask.html' import delete_ask, dialogs %} {% extends "base.html" %} {% block title %}Launches — Nullius{% endblock %} @@ -32,12 +32,7 @@ ('checks', 'Checks'), ('shards', 'Shards'), ('machines', 'Machines'), ('size', 'Size'), ('ws', 'Workspaces')] %} {% set unsorted = ['machines', 'ws'] %}
- + {%- set filters = [] %}{% for col, label in cols if col in choices %}{% set _ = filters.append((col, label, choices[col])) %}{% endfor %} {{ tools(filters, cols|rejectattr(0, 'in', unsorted)|list, only) }}
@@ -56,7 +51,7 @@

- + {{ blank() }} diff --git a/app/templates/settings/settings.html b/app/templates/settings/settings.html index 4a1b73dd..0bf6f14b 100644 --- a/app/templates/settings/settings.html +++ b/app/templates/settings/settings.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% from '_tables.html' import blank %} {% block title %}Settings — Nullius{% endblock %} {% block crumb %}/ settings{% endblock %} {% block head %}{% endblock %} @@ -301,7 +302,7 @@

Judges

{% macro never(icon, why) %}{% endmacro %}
+ RunRun Agent{{ filter_button('agent', choices.agent) }} Version Start
{{ j.job_id }} + {{ j.job_id }} {%- if j.is_preparing %} preparing {%- elif j.is_running and ended[j.job_id] %} ', html, re.S).group(0)) def row(self, html, job_id): - rows = [r for r in re.findall(r'
' % job_id in r] + rows = [r for r in re.findall(r'
' % job_id in r] self.assertEqual(len(rows), 1, job_id) return rows[0] diff --git a/app/ui_tests/test_runs_by_launch.py b/app/ui_tests/test_runs_by_launch.py index 4a43e05f..1847d80b 100644 --- a/app/ui_tests/test_runs_by_launch.py +++ b/app/ui_tests/test_runs_by_launch.py @@ -291,7 +291,7 @@ def test_the_flat_table_is_the_second_view(self): self.assertEqual(between.count("")) # a sibling, never inside the hidden view self.assertIn('aria-pressed="true">All runs', html) for job in self.jobs: - self.assertIn(f'', html) # every run, one row + self.assertIn(f'', html) # every run, one row self.assertIn("Tick two or more runs to compare", html) From 305299c5a0cee38560d377332d2f29ee9c476842 Mon Sep 17 00:00:00 2001 From: Harenome Ranaivoarivony-Razanajato Date: Tue, 17 Nov 2026 14:33:22 +0100 Subject: [PATCH 02/17] refactor(web): share the Columns menu and unnamed headers as table macros columns_button and columns_menu give the Runs and Launches tables one Columns menu; blank gives the Launches, Workspaces and Hosts tables one header with a screen-reader name only. --- app/templates/_tables.html | 15 +++++++++++++++ app/templates/runs/index.html | 13 ++++--------- app/templates/runs/launches.html | 11 +++-------- app/templates/settings/settings.html | 3 ++- app/templates/workspaces/workspaces.html | 4 ++-- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/app/templates/_tables.html b/app/templates/_tables.html index fd9e1595..88e8f193 100644 --- a/app/templates/_tables.html +++ b/app/templates/_tables.html @@ -1,3 +1,5 @@ +{#- The table toolkit: each macro is a feature a table opts into, run by static/tables.js (NulliusTable) and + styled in style.css ("the table toolkit"). #} {# Value filter for one column: a caret in the header opening a checkbox list of `choices`, (value, label) pairs. Values start all-checked; unchecking hides the matching rows (static/tables.js). #} {% macro filter_button(col, choices) %} @@ -51,6 +53,19 @@ {% endmacro %} +{# A Columns menu (static/tables.js `columns`): its button, and the menu of `cols`, (col, label) pairs, each a checkbox + that shows or hides the cells of that data-col; a col in `fixed` always shows. The menu opens under the + .menu-wrap that holds it. #} +{% macro columns_button() %}{% endmacro %} +{% macro columns_menu(cols, fixed=[]) %} + +{% endmacro %} + +{#- A header with no visible name (a checkbox, a status, the actions): `label` its name for a screen reader. #} +{% macro blank(label='') %}{% if label %}{{ label }}{% endif %}Machines Size Workspaces
- + {{ blank('Status') }}{{ blank('Actions') }} {% for m in machines %}{% set mi = loop.index %}{% set t = (m.found or {}).get('test') or {} %} {#- a machine: its row, then a row per panel, one open at a time (hosts.js) -#} diff --git a/app/templates/workspaces/workspaces.html b/app/templates/workspaces/workspaces.html index 6a9e7572..e9ee7a24 100644 --- a/app/templates/workspaces/workspaces.html +++ b/app/templates/workspaces/workspaces.html @@ -1,4 +1,4 @@ -{% from '_tables.html' import tools, pager, greyed %} +{% from '_tables.html' import tools, pager, greyed, blank %} {% extends "base.html" %} {% block title %}Workspaces — Nullius{% endblock %} {% block crumb %}/ workspaces{% endblock %} @@ -16,7 +16,7 @@
StatusHostEngineCapacityActions
HostEngineCapacity
- + {{ blank('Open') }}{{ blank('Actions') }} {% for ws in workspaces %} From eb373b973c15a498e9a61e31e9905fa2647e0456 Mon Sep 17 00:00:00 2001 From: Harenome Ranaivoarivony-Razanajato Date: Tue, 17 Nov 2026 14:33:22 +0100 Subject: [PATCH 03/17] refactor(web): start a table's toolbar and pages in one call NulliusTable.paged joins toolbar and pager, as the Launches and Workspaces tables both did by hand. --- app/static/tables.js | 15 +++++++++++++-- app/templates/runs/launches.html | 4 +--- app/templates/workspaces/workspaces.html | 4 +--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/static/tables.js b/app/static/tables.js index 0f497379..e35bbff4 100644 --- a/app/static/tables.js +++ b/app/static/tables.js @@ -1,5 +1,6 @@ -/* A table.grid's sortable headers and per-column value filters, shared by the - tables that have them. */ +/* The table toolkit's script: each function is a feature a table.grid opts + into (the macros of templates/_tables.html; their styles in style.css, + "the table toolkit"). */ window.NulliusTable = { /* A header with data-type sorts its column on a click or Enter; num sorts descending first. A cell's data-sort wins over its text. A header that @@ -191,6 +192,16 @@ window.NulliusTable = { return {passes: f.passes, resort}; }, + /* A table with a toolbar (`tools`, as toolbar) and pages (as pager, the + page size kept under `key`): back to the first page after each filter or + sort. Returns toolbar's {passes, resort}. */ + paged(table, tools, key, empty = null) { + let first = () => {}; + const t = this.toolbar(table, tools, () => first()); + first = this.pager(table, key, t.passes, empty); + return t; + }, + /* A table's pages (the pager macro named after its id): the rows `passes` lets through, a page of them at a time, the page's size remembered per viewer under `key`; `empty` shows when none passes. Returns first(), to diff --git a/app/templates/runs/launches.html b/app/templates/runs/launches.html index bd137387..2106f734 100644 --- a/app/templates/runs/launches.html +++ b/app/templates/runs/launches.html @@ -94,9 +94,7 @@ {% else %} diff --git a/app/templates/workspaces/workspaces.html b/app/templates/workspaces/workspaces.html index 0b0a7e25..94d68eed 100644 --- a/app/templates/workspaces/workspaces.html +++ b/app/templates/workspaces/workspaces.html @@ -1,9 +1,9 @@ -{% from '_tables.html' import tools, pager, greyed, blank %} +{% from '_tables.html' import table, greyed %} {% extends "base.html" %} {% block title %}Workspaces — Nullius{% endblock %} {% block crumb %}/ workspaces{% endblock %} {% block head %} - +{# its dialog #} {% endblock %} {% block body %} @@ -12,16 +12,13 @@ {% if workspaces %} {% set labels = workspaces|map(attribute='label')|list %} -
{{ tools([], [('name', 'Name'), ('roots', 'Roots'), ('runs', 'Runs'), ('checks', 'Checks'), ('launches', 'Launches'), ('opened', 'Last opened')]) }}
-
-
OpenNameRootsRunsChecksLaunchesLast openedActions
NameRootsRunsChecksLaunchesLast opened
- - {{ blank('Open') }}{{ blank('Actions') }} - - +{% set cols = [dict(key='name', label='Name', width='expand'), dict(key='runs', label='Runs', type='num', num=true), + dict(key='checks', label='Checks', type='num', num=true), dict(key='opened', label='Last opened', type='num'), + dict(key='launches', label='Launches', type='num', num=true), dict(key='roots', label='Roots', type='num')] %} +{% call table('workspaces', cols, class='ws-table', search='Search by name or folder', status='Open', actions='Actions') %} {% for ws in workspaces %} {% set current = workspace and ws.name == workspace.name %}{% set rs = roots[ws.name] %}{% set clash = labels.count(ws.label) > 1 %} - + + + + {#- the time as digits, UTC as every workspace records it; never opened sorts last, newest first #} + + - - - - {#- the time as digits, UTC as every workspace records it; never opened sorts last, newest first #} - -
NameRootsRunsChecksLaunchesLast opened
{% if current %}●{% endif %} {#- the label; the name on disk too where two labels are alike #} @@ -33,8 +30,13 @@ {{ counts[ws.name].runs }}{{ counts[ws.name].checks }}{{ ws.opened[:16]|replace('T', ' ') }}{% set n = n_launches[ws.name] %}{% if n %}{{ n }}{% else %}0{% endif %} - + {{ counts[ws.name].runs }}{{ counts[ws.name].checks }}{% set n = n_launches[ws.name] %}{% if n %}{{ n }}{% else %}0{% endif %}{{ ws.opened[:16]|replace('T', ' ') }} +