diff --git a/AGENTS.md b/AGENTS.md
index afee95de..400ed71a 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -77,7 +77,8 @@ and its resources. The source layout stays under `app/`.
by `git ls-remote`), `secrets` (a benchmark's licences, kept per benchmark outside the repository, and the Hugging Face token of Data providers), `sandbox` (Docker's state, and the Docker Hub login Data providers uses) and `redact` at the top.
- `app/templates/`, `app/static/` — the interface, grouped by the same capability
names (`runs/`, `traces/`, `builder/`, …; `base.html`, `style.css` and the fonts at the top), including the command
- builder's JavaScript, which owns the generated recipes.
+ builder's JavaScript, which owns the generated recipes. `app/templates/_tables.html` and
+ `app/static/tables.js` are the table toolkit: one column list builds a table's headers, cells and controls.
- `app/tests/`, `app/ui_tests/` — the backend suite and the route suite.
Beside the backend tests sit scripts run by hand:
`app/tests/field_contract.py`, which refreshes the `field_contract.json` the
diff --git a/app/static/runs/launches.css b/app/static/runs/launches.css
index e6ab049e..05f31fd9 100644
--- a/app/static/runs/launches.css
+++ b/app/static/runs/launches.css
@@ -115,36 +115,21 @@ dialog.std-how.launch-delete { width: min(520px, calc(100vw - 32px)); }
.la-gap { display: block; margin-top: 2px; font: 11.5px var(--sans); color: var(--patch_failed_tests); }
/* the Launches page: one row per launch */
-.inventory .inv-open { display: inline; }
-.inventory .inv-open .linkish { padding: 0; text-align: left; }
-/* as the Runs page's table: text columns keep a floor and short values stay on one line, so past the box's width the table scrolls instead of squeezing */
-.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; }
-@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); }
+#launches .launch-open { display: inline; }
+#launches .launch-open .linkish { padding: 0; text-align: left; }
+#launches .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 [data-col="launch"] { --sticky-left: var(--inv-state-w); }
+#launches :is(th, td)[data-col="state"] { width: 2.2rem; min-width: 2.2rem; padding-left: 0; padding-right: 0; text-align: center; }
/* a run's state: its icon, coloured as the Runs page's state dots */
-.inventory td[data-col="state"] .ic { vertical-align: middle; }
-.inventory .st-finished, .inventory .st-running, .inventory .st-preparing { color: var(--resolved); }
-.inventory .st-failed, .inventory .st-refused, .inventory .st-stopped { color: var(--bad); }
-.inventory .st-paused, .inventory .st-stopping { color: var(--patch_failed_tests); }
-.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; }
+#launches td[data-col="state"] .ic { vertical-align: middle; }
+#launches .st-finished, #launches .st-running, #launches .st-preparing { color: var(--resolved); }
+#launches .st-failed, #launches .st-refused, #launches .st-stopped { color: var(--bad); }
+#launches .st-paused, #launches .st-stopping { color: var(--patch_failed_tests); }
+#launches .st-running { animation: state-beat 2s ease-in-out infinite; }
+@keyframes state-beat { 50% { opacity: .45; } }
+@media (prefers-reduced-motion: reduce) { #launches .st-running { animation: none; } }
.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/settings/settings.css b/app/static/settings/settings.css
index ee07cdfb..b1977e79 100644
--- a/app/static/settings/settings.css
+++ b/app/static/settings/settings.css
@@ -233,11 +233,6 @@
.st-index a span { color: inherit; font-size: 15px; }
.st-index a .ic { flex: none; width: 17px; height: 17px; }
.st-index [hidden] { display: none; }
-.st-search { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: var(--surface-2); color: var(--text-dim); }
-.st-search .ic { flex: none; width: 17px; height: 17px; }
-.st-search input { min-width: 0; width: 100%; padding: 0; border: 0; background: transparent; color: var(--text); font: 13px var(--sans); }
-.st-search input:focus-visible { outline: none; }
-.st-search:focus-within { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.st-search-empty { padding: 8px 12px; font-size: 13px; color: var(--text-dim); }
.st-theme-options { display: flex; flex-wrap: wrap; gap: 8px; }
.st-theme-options .btn[aria-pressed="true"] { border-color: transparent; background: var(--accent-soft); color: var(--text); }
diff --git a/app/static/style.css b/app/static/style.css
index cc25d710..12331dc0 100644
--- a/app/static/style.css
+++ b/app/static/style.css
@@ -352,10 +352,22 @@ 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): controls, 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; }
+/* the controls row: the search takes what the buttons leave, else a line of its own; the buttons go right */
+.table-controls { flex-wrap: wrap; margin-top: 1rem; }
+.table-controls .st-search { flex: 1 1 14rem; margin: 0; }
+.table-buttons, .table-slot { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .75rem; }
+.table-buttons { margin-left: auto; }
+.table-buttons .menu { left: auto; right: 0; } /* opens leftwards, inside the page */
+/* a search box, its icon first (the Settings page's too) */
+.st-search { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: var(--surface-2); color: var(--text-dim); }
+.st-search .ic { flex: none; width: 17px; height: 17px; }
+.st-search input { min-width: 0; width: 100%; padding: 0; border: 0; background: transparent; color: var(--text); font: 13px var(--sans); }
+.st-search input:focus-visible { outline: none; }
+.st-search:focus-within { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.menu-wrap { position: relative; }
.btn.sm { font-size: .8rem; padding: .42rem .75rem; }
.menu {
@@ -376,22 +388,20 @@ button.seg:hover { filter: brightness(1.25); }
.grid.sortable thead th { cursor: pointer; user-select: none; white-space: nowrap; }
.grid.sortable thead th:hover { color: var(--text); }
-/* Arrows are set in a size independent of the small uppercase header text —
- at .76rem uppercase they were rendering near-invisible. */
-.grid.sortable thead th::after {
- content: "↕"; margin-left: .4rem; font-size: 1.05rem; line-height: 0;
- vertical-align: -.1em; opacity: .4; color: var(--text-faint);
-}
-.grid.sortable thead th:hover::after { opacity: .8; color: var(--text-dim); }
-.grid.sortable thead th[data-sorted]::after { opacity: 1; color: var(--accent); font-weight: 500; }
+/* an arrow on the sorted column only, in a size independent of the small uppercase header text */
+.grid.sortable thead th[data-sorted]::after {
+ margin-left: .4rem; font-size: 1.05rem; line-height: 0; vertical-align: -.1em; color: var(--accent); font-weight: 500;
+}
.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; }
.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 th[data-col="dataset"], .grid td[data-col="dataset"] { min-width: 10.5rem; }
+.grid:not(.snug) th[data-col="dataset"], .grid:not(.snug) td[data-col="dataset"] { min-width: 10.5rem; } /* a .snug table fits its columns */
.grid td[data-col="dataset"] { color: var(--text-dim); }
/* ---- wide-table handling: scroll the table, not the page ---- */
@@ -406,21 +416,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 (tables.js `sticky`), 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; }
@@ -429,23 +433,7 @@ button.seg:hover { filter: brightness(1.25); }
.grid.compact th[data-col="dataset"], .grid.compact td[data-col="dataset"] { min-width: 8rem; }
.grid.compact .minibar { width: 56px; }
-/* per-column value filter */
-.th-filter { position: relative; display: inline-block; }
-.filter-btn {
- font: inherit; font-size: .8rem; line-height: 1; cursor: pointer;
- background: none; border: none; padding: 0 .15rem; margin-left: .3rem;
- color: var(--text-faint); border-radius: 4px;
-}
-.filter-btn:hover { color: var(--text); }
-.filter-btn.on { color: var(--accent); }
-.filter-btn.on::after { content: "•"; margin-left: .1rem; }
-.filter-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none; }
-.filter-menu {
- right: 0; left: auto; text-transform: none; letter-spacing: 0;
- font-weight: 400; max-height: 18rem; overflow-y: auto; min-width: 200px;
-}
-/* a table's Filter and Sort by menus (the tools macro): no header carets, an arrow on the sorted column only */
-.grid.sortable.tools thead th:not([data-sorted])::after { content: none; }
+/* a table's Filter and Sort by menus (the controls macro) */
.tools-menu { min-width: 220px; max-height: min(70vh, 34rem); overflow-y: auto; }
.tools-menu fieldset { margin: 0; padding: .3rem 0; border: 0; border-top: 1px solid var(--border-soft); min-width: 0; }
.tools-menu fieldset:first-of-type { border-top: 0; }
@@ -453,14 +441,28 @@ 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 a .snug one (the table macro's), narrow gutters and each column
+ as wide as its widest cell on one line, but the one that expands (its rule beside the table: the rest of the
+ width, no less than --expand-min, wrapping); a header or cell positioned holds a hidden name or reason inside
+ the table's scroll */
+.grid.tools td { vertical-align: top; }
+.grid.snug { --expand-min: 12rem; }
+@media (max-width: 640px) { .grid.snug { --expand-min: 9rem; } } /* a phone keeps room beside a pinned column */
+.grid.snug th, .grid.snug td { width: 1%; white-space: nowrap; padding-left: .4rem; padding-right: .4rem; }
+.grid.snug th { position: relative; }
+.grid td.acts-col { position: relative; white-space: nowrap; }
+.count-btn { font-variant-numeric: tabular-nums; } /* an icon and a count, as one button */
+.btn[aria-disabled="true"] { opacity: .45; cursor: default; } /* greyed: it cannot act here */
+.btn.ghost[aria-disabled="true"]:hover { color: var(--text-dim); border-color: var(--border); background: transparent; }
+.btn:not(.ghost)[aria-disabled="true"]:hover { background: var(--accent); }
+/* a column's alignment (its `align`), header and cells */
+.grid .align-right { text-align: right; }
+.grid .align-center { text-align: center; }
.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 +930,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/tables.js b/app/static/tables.js
index 0f497379..9e71a5f1 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
@@ -49,23 +50,20 @@ window.NulliusTable = {
return resort;
},
- /* The value lists (data-filter-menu) under `scope`: the filter_button
- macro's, each opened by its caret, or the tools macro's. `allowed`:
- column -> the Set of values ticked, or null when all are. A row passes
- when, for each column, one of its values (data-f-
, one per line) is
- ticked; a box unticked at load filters from the start. `changed` runs
- after each change. */
+ /* The value lists (data-filter-menu) under `scope`, the controls macro's
+ Filter menu. `allowed`: column -> the Set of values ticked, or null when
+ all are. A row passes when, for each column, one of its values
+ (data-f-
, one per line) is ticked; a box unticked at load filters
+ from the start. `changed` runs after each change, a list's change event
+ included. */
filters(scope, changed) {
const allowed = {};
scope.querySelectorAll('[data-filter-menu]').forEach(menu => {
const col = menu.dataset.filterMenu;
const boxes = () => [...menu.querySelectorAll('input[data-value]')];
- const btn = scope.querySelector(`.filter-btn[data-filter="${col}"]`);
const read = () => {
const on = boxes().filter(b => b.checked).map(b => b.dataset.value);
- // All checked means "no filter": keeps the active marker honest.
- allowed[col] = on.length === boxes().length ? null : new Set(on);
- btn?.classList.toggle('on', Boolean(allowed[col]));
+ allowed[col] = on.length === boxes().length ? null : new Set(on); // all ticked: no filter
};
const sync = () => { read(); changed(); };
read();
@@ -74,19 +72,6 @@ window.NulliusTable = {
if (e.target.closest('[data-all]')) { boxes().forEach(b => b.checked = true); sync(); }
if (e.target.closest('[data-none]')) { boxes().forEach(b => b.checked = false); sync(); }
});
- if (!btn) return;
- btn.addEventListener('click', e => {
- e.stopPropagation(); // the th itself sorts; don't sort on filter
- const open = menu.hidden;
- scope.querySelectorAll('.filter-menu').forEach(m => m.hidden = true);
- menu.hidden = !open;
- btn.setAttribute('aria-expanded', String(open));
- });
- menu.addEventListener('click', e => e.stopPropagation());
- document.addEventListener('click', () => {
- menu.hidden = true;
- btn.setAttribute('aria-expanded', 'false');
- });
});
const passes = row => Object.entries(allowed).every(([col, set]) =>
!set || (row.getAttribute('data-f-' + col) ?? '').split('\n').some(v => set.has(v)));
@@ -95,48 +80,35 @@ window.NulliusTable = {
menu.querySelectorAll('input[data-value]').forEach(b => b.checked = true);
allowed[menu.dataset.filterMenu] = null;
});
- scope.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('on'));
};
return {allowed, passes, clear};
},
- /* A Columns menu: `btn` opens `menu` (none: the caller opens it), whose
- checkboxes (data-col) show or hide the table's cells of that data-col,
- remembered per viewer under `key`; a disabled one stays on. `hidden`: the
- columns off until the viewer chooses. Returns show(), to apply the choice
- to rows put in since. */
- columns(table, btn, menu, key, hidden = []) {
+ /* A Columns menu (opened by `menu`): its checkboxes (data-col) show or
+ hide the table's cells of that data-col, remembered per viewer under
+ `key`; a disabled one stays on, a data-off one is off until the viewer
+ chooses. Returns show(), to apply the choice to rows put in since. */
+ columns(table, menu, key) {
const boxes = [...menu.querySelectorAll('input[data-col]')];
let stored = null;
try { stored = JSON.parse(localStorage.getItem(key) || 'null'); } catch {}
const show = () => boxes.forEach(cb =>
table.querySelectorAll(`[data-col="${cb.dataset.col}"]`).forEach(el => { el.style.display = cb.checked ? '' : 'none'; }));
boxes.forEach(cb => {
- cb.checked = cb.disabled || (stored ? stored.includes(cb.dataset.col) : !hidden.includes(cb.dataset.col));
+ cb.checked = cb.disabled || (stored ? stored.includes(cb.dataset.col) : !cb.hasAttribute('data-off'));
cb.addEventListener('change', () => {
show();
try { localStorage.setItem(key, JSON.stringify(boxes.filter(b => b.checked).map(b => b.dataset.col))); } catch {}
});
});
show();
- if (!btn) return show;
- btn.addEventListener('click', () => {
- const open = menu.hidden;
- menu.hidden = !open;
- btn.setAttribute('aria-expanded', String(open));
- });
- document.addEventListener('click', e => {
- if (!menu.hidden && !menu.contains(e.target) && !btn.contains(e.target)) {
- menu.hidden = true;
- btn.setAttribute('aria-expanded', 'false');
- }
- });
return show;
},
/* A toolbar's popover: `btn` opens `menu` and puts the focus in it; a click
elsewhere or Tab out of it closes it, and Escape too, giving the focus
- back to `btn`. */
+ back to `btn`. A click on a label's text moves the focus to a focusable
+ ancestor (the page's ): that is not leaving. */
menu(btn, menu) {
const close = () => { menu.hidden = true; btn.setAttribute('aria-expanded', 'false'); };
btn.addEventListener('click', () => {
@@ -147,19 +119,29 @@ window.NulliusTable = {
});
document.addEventListener('click', e => { if (!menu.hidden && !menu.contains(e.target) && !btn.contains(e.target)) close(); });
document.addEventListener('keydown', e => { if (e.key === 'Escape' && !menu.hidden) { close(); btn.focus(); } });
- const left = e => { if (e.relatedTarget && !menu.contains(e.relatedTarget) && !btn.contains(e.relatedTarget)) close(); };
+ const left = e => { const to = e.relatedTarget; if (to && !menu.contains(to) && !btn.contains(to) && !to.contains(menu)) close(); };
menu.addEventListener('focusout', left);
btn.addEventListener('focusout', left);
},
- /* A table's Filter and Sort by menus (the tools macro), under `tools`, in
- place of header carets. Filter counts the columns it narrows; Sort by
- sets the sort, and follows a header click. `changed` runs after either.
- A toolbar without Filter (the macro given no filters) only sorts.
- Returns {passes, resort}, as filters and sortable do. */
+ /* A table's search box, Filter and Sort by menus (the controls macro),
+ under `tools`; each optional. Search keeps the rows whose data-search
+ holds every word of the query, in any order and case; Escape clears it. Filter counts the columns it
+ narrows; Sort by sets the sort, and follows a header click. `changed`
+ runs after any of them. Returns {passes, resort}, as filters and sortable
+ do. */
toolbar(table, tools, changed) {
const [fbtn, fmenu, sbtn, smenu] = ['filter', 'sort'].flatMap(k =>
[tools.querySelector(`[data-tools-btn="${k}"]`), tools.querySelector(`[data-tools="${k}"]`)]);
+ const q = tools.querySelector('[data-search]');
+ if (q) {
+ q.addEventListener('input', changed);
+ q.addEventListener('keydown', e => { if (e.key === 'Escape' && q.value) { e.preventDefault(); q.value = ''; changed(); } });
+ }
+ const found = row => {
+ const text = (row.dataset.search ?? '').toLowerCase();
+ return !q || q.value.toLowerCase().split(/\s+/).every(w => text.includes(w));
+ };
const count = fbtn?.querySelector('.tools-count');
const mark = () => {
const n = Object.values(f.allowed).filter(Boolean).length;
@@ -175,30 +157,98 @@ window.NulliusTable = {
}
const heads = [...table.tHead.rows[0].cells];
const sync = () => {
+ if (!smenu) return;
const {col, dir} = resort.state(), on = col === null ? '' : heads[col].dataset.col;
smenu.querySelectorAll('[data-sort-col]').forEach(r => { r.checked = r.value === on; });
smenu.querySelectorAll('[data-sort-dir]').forEach(r => { r.checked = Boolean(on) && r.value === (dir > 0 ? 'asc' : 'desc'); r.disabled = !on; });
};
const resort = this.sortable(table, () => { sync(); changed(); });
- smenu.addEventListener('change', e => {
- const idx = heads.findIndex(h => h.dataset.col === smenu.querySelector('[data-sort-col]:checked').value);
- if (idx < 0) return resort.set(null);
- const dir = e.target.matches('[data-sort-dir]') ? (e.target.value === 'asc' ? 1 : -1) : (heads[idx].dataset.type === 'num' ? -1 : 1);
- resort.set(idx, dir);
+ if (smenu) {
+ smenu.addEventListener('change', e => {
+ const idx = heads.findIndex(h => h.dataset.col === smenu.querySelector('[data-sort-col]:checked').value);
+ if (idx < 0) return resort.set(null);
+ const dir = e.target.matches('[data-sort-dir]') ? (e.target.value === 'asc' ? 1 : -1) : (heads[idx].dataset.type === 'num' ? -1 : 1);
+ resort.set(idx, dir);
+ });
+ sync();
+ this.menu(sbtn, smenu);
+ }
+ return {passes: row => f.passes(row) && found(row), resort};
+ },
+
+ /* A table of the table macro (data-table): its controls row (id
+
-tools), its Columns menu and checkbox column when it has
+ them, and its pages; choices kept per viewer under
.cols and
+ .per. */
+ wire(table) {
+ const tools = document.getElementById(table.id + '-tools');
+ const cmenu = tools.querySelector('[data-tools="columns"]');
+ if (cmenu) {
+ this.columns(table, cmenu, table.id + '.cols');
+ this.menu(tools.querySelector('[data-tools-btn="columns"]'), cmenu);
+ }
+ const ticks = table.querySelector('[data-check-all]') ? this.checks(table) : () => {};
+ let first = () => {};
+ const t = this.toolbar(table, tools, () => first());
+ first = this.pager(table, table.id + '.per', t.passes, ticks);
+ },
+
+ /* A checkbox column (a `check` column, check_cell in each row): the header
+ ticks or unticks every visible row, and shows all, none or some of them
+ ticked. Returns sync(), to run when rows show or hide. */
+ checks(table) {
+ const all = table.querySelector('[data-check-all]');
+ const shown = () => [...table.tBodies[0].rows].filter(r => !r.hidden).map(r => r.querySelector('[data-check]')).filter(Boolean);
+ const sync = () => {
+ const boxes = shown(), n = boxes.filter(b => b.checked).length;
+ all.checked = boxes.length > 0 && n === boxes.length;
+ all.indeterminate = n > 0 && n < boxes.length;
+ };
+ table.addEventListener('change', e => {
+ if (e.target === all) shown().forEach(b => { b.checked = all.checked; });
+ else if (!e.target.matches('[data-check]')) return;
+ sync();
});
sync();
- this.menu(sbtn, smenu);
- return {passes: f.passes, resort};
+ return sync;
+ },
+
+ /* Sticky columns, those whose header is a .sticky-col: each cell under it
+ pinned at the summed widths of the sticky columns before it, again as
+ they resize, hide or rows come in. A row without a cell under each
+ header (a colspan, an empty row) is left as it is. */
+ sticky(table) {
+ const heads = [...table.tHead.rows[0].cells], pinned = heads.filter(th => th.classList.contains('sticky-col'));
+ const place = () => {
+ let left = 0;
+ pinned.forEach(th => {
+ for (const row of table.rows) {
+ if (row.cells.length !== heads.length) continue;
+ const cell = row.cells[th.cellIndex];
+ cell.classList.add('sticky-col');
+ cell.classList.toggle('sticky-edge', th.classList.contains('sticky-edge'));
+ cell.style.setProperty('--sticky-left', left + 'px');
+ }
+ left += th.getBoundingClientRect().width;
+ });
+ };
+ const resized = new ResizeObserver(place);
+ pinned.forEach(th => resized.observe(th));
+ new MutationObserver(place).observe(table, {childList: true, subtree: true});
+ place();
},
/* 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
- run after a filter or a sort: it shows the first page. */
- pager(table, key, passes = () => true, empty = null) {
- const bar = document.querySelector(`[data-pager="${CSS.escape(table.id)}"]`);
- const [per, note, prev, next] = ['[data-per]', '[data-note]', '[data-prev]', '[data-next]'].map(s => bar.querySelector(s));
- let page = 0;
+ viewer under `key`; its empty note shows when none passes. After a
+ change, not at load, a screen reader hears what shows once the changes
+ pause, counted in the live region's data-noun. `drawn` runs after each
+ page. Returns first(), to run after a filter or a sort: it
+ shows the first page. */
+ pager(table, key, passes = () => true, drawn = () => {}) {
+ const bar = document.querySelector(`[data-pager="${CSS.escape(table.id)}"]`), empty = document.querySelector(`[data-empty="${CSS.escape(table.id)}"]`);
+ const [per, note, prev, next, live] = ['[data-per]', '[data-note]', '[data-prev]', '[data-next]', '[data-live]'].map(s => bar.querySelector(s));
+ let page = 0, said, loaded = false;
try { const n = localStorage.getItem(key); if (n !== null && [...per.options].some(o => o.value === n)) per.value = n; } catch {}
const draw = () => {
const rows = [...table.tBodies[0].rows], hit = rows.filter(passes), n = +per.value || hit.length || 1;
@@ -208,7 +258,10 @@ window.NulliusTable = {
note.textContent = hit.length ? `${page * n + 1}–${Math.min(hit.length, page * n + n)} of ${hit.length}` : '';
prev.disabled = page === 0;
next.disabled = (page + 1) * n >= hit.length;
- if (empty) empty.hidden = hit.length > 0;
+ empty.hidden = hit.length > 0;
+ clearTimeout(said);
+ if (loaded) said = setTimeout(() => { live.textContent = hit.length ? `${note.textContent} ${live.dataset.noun}` : empty.textContent; }, 300);
+ drawn();
};
const first = () => { page = 0; draw(); };
per.addEventListener('change', () => {
@@ -218,6 +271,15 @@ window.NulliusTable = {
prev.addEventListener('click', () => { page--; draw(); });
next.addEventListener('click', () => { page++; draw(); });
draw();
+ loaded = true;
return first;
},
};
+
+/* Every table with sticky columns, and every table of the table macro, set up once the page is read. */
+const nulliusTables = () => document.querySelectorAll('table.grid').forEach(t => {
+ if (t.querySelector('.sticky-col')) NulliusTable.sticky(t);
+ if (t.hasAttribute('data-table')) NulliusTable.wire(t);
+});
+if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', nulliusTables);
+else nulliusTables();
diff --git a/app/static/workspaces/workspaces.css b/app/static/workspaces/workspaces.css
index cc531457..d1d7d456 100644
--- a/app/static/workspaces/workspaces.css
+++ b/app/static/workspaces/workspaces.css
@@ -1,14 +1,11 @@
/* The Workspaces page: one row per workspace; its roots in a dialog (the Launches page's, runs/launches.css). */
.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-current .count-btn { border-color: var(--text-faint); } /* the plain border blends into the open row */
.ws-show { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px .4rem; }
.ws-title { overflow-wrap: anywhere; } /* a name wraps, never cut */
.ws-rename { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.ws-rename input[type=text] { width: min(16rem, 100%); font-size: .9rem; padding: .3rem .5rem; }
-.ws-roots-btn { font-variant-numeric: tabular-nums; }
.launch-delete .ws-root-list { list-style: none; padding: 0; margin: 12px 0 0; }
.ws-root-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border-soft); }
.ws-root-list li > .mono { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; } /* a path wraps, never cut */
@@ -17,3 +14,4 @@
dialog.std-how.launch-delete.wide { width: min(56rem, calc(100vw - 32px)); } /* the roots: room for a path */
.launch-delete .std-how-head h2 { min-width: 0; overflow-wrap: anywhere; }
.grid.tools.ws-table td { vertical-align: middle; } /* a count beside a button: one line */
+.ws-table td[data-col="launches"] { position: relative; } /* holds a greyed count's hidden reason */
diff --git a/app/templates/_tables.html b/app/templates/_tables.html
index fd9e1595..a8a68dc9 100644
--- a/app/templates/_tables.html
+++ b/app/templates/_tables.html
@@ -1,68 +1,145 @@
-{# 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) %}
-
-
-
-
-
-
-
- {% for value, label in choices %}
-
- {% endfor %}
-
-
+{#- 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"). #}
+
+{# A table's columns are one list of definitions, dicts that the headers, the cells, the Columns menu and Sort by
+ all read: `key` (the data-col), `label`; `type` 'text' (default) or 'num', how it sorts; `align` 'left', 'center'
+ or 'right' (a 'num' column's default), of its header and cells; `sticky`: pinned while the table scrolls, the last
+ one drawing the edge; `blank`: no visible name (a status, the actions), neither sorted nor in the Columns menu;
+ `check`: blank, a checkbox that ticks every visible row (check_cell in each row); `sr`: the label for a screen
+ reader only; `title`: its tooltip; `menu` false: not in the Columns menu; `fixed`: in it, always on; `off`: off
+ until the viewer chooses; `width` in a table macro's table: 'fit' (default), as wide as its widest cell on one
+ line, or 'expand', the rest of the width, wrapping. #}
+
+{#- The class attribute of a column's header or cell: its alignment, whether it is pinned, `edge` whether it is the
+ last pinned; `extra` adds to it. #}
+{% macro classes(c, edge, extra='') %}{% set align = c.align or ('right' if c.type == 'num' else 'left') %}
+{%- set cls = ([extra] if extra else []) + (['align-' ~ align] if align != 'left' else []) + (['sticky-col'] if c.sticky else []) + (['sticky-edge'] if c.sticky and edge else []) %}
+{%- if cls %} class="{{ cls|join(' ') }}"{% endif %}{% endmacro %}
+
+{#- The last pinned column's key. #}
+{% macro edge_of(cols) %}{{ (cols|selectattr('sticky')|map(attribute='key')|list)[-1:]|join }}{% endmacro %}
+
+{# The header cells of `cols`. #}
+{% macro heads(cols) %}{% set edge = edge_of(cols) %}
+{%- for c in cols %}{% set named = not (c.blank or c.check) %}
+
+ {%- if c.check %}{% elif c.sr or c.blank %}{{ c.label }}{% else %}{{ c.label }}{% endif %}
+{%- endfor %}
+{%- endmacro %}
+
+{# A whole table (static/tables.js `wire`): its controls row, its headers from `cols`, a row of `rows` each,
+ and its pages. `id` names it, and keys what a viewer chooses; `class` adds to its classes; `tr`: a macro writing a
+ row's attributes. The call block writes a cell: it is called with a row and a column, in the order of `cols`, and
+ writes that cell with the cell macro. Opt-ins: `search`, `columns`, `choices`, `only`, `views`, `actions` as
+ controls'; `empty` and `noun` as pager's. #}
+{% macro table(id, cols, rows, tr, class='', search='', columns=false, choices={}, only={}, empty='No rows match.', noun='rows', views=none, actions=none) %}
+{{ controls(id, cols, search, columns, choices, only, views, actions) }}
+{%- for c in cols if c.width == 'expand' %}
+
+{%- endfor %}
+{%- set edge = edge_of(cols) %}
+
+
+
+
{{ heads(cols) }}
+
+
+ {%- for r in rows %}
+
+ {%- for c in cols %}{{ caller(r, dict(c, edge=c.key == edge)) }}{% endfor %}
+
+ {%- endfor %}
+
+
+
+{{ pager(id, empty, noun) }}
{% endmacro %}
-{# A table's Filter and Sort by menus, in place of header carets (static/tables.js `toolbar`). `filters`: a list of
- (col, label, choices), choices as filter_button's; `sorts`: a list of (col, label), the sortable headers;
- `only`: column -> the one value ticked at load, the others unticked. No filters: no Filter button. #}
-{% macro tools(filters, sorts, only={}) %}
-{% if filters %}
-
-
-
- {% for col, label, choices in filters %}
-
- {% endfor %}
+{#- One cell of the column `c`, as the table macro's call block gets it: its data-col, alignment and pinning from
+ `c`, `sort` its sort key, `class` its own classes; the call block writes what it holds. #}
+{% macro cell(c, sort=none, class='') %}
{{ caller() }}
{% endmacro %}
+
+{# A table's controls row (static/tables.js `toolbar`) over the columns `cols`; each feature on only
+ when asked. `search`: the search box's name and placeholder, over each row's data-search text; `columns`: the
+ Columns menu; `choices`: column -> its (value, label) pairs, a Filter menu of them; `only`: column -> the one value
+ ticked at load, the others unticked; then the Sort by menu. `views` and `actions`: macros writing a page's own
+ buttons, each any number of them, run by the page: views (how the table looks) before Columns, actions (on the
+ rows or the selection) last. The search goes left, the buttons right. `id`: the table's. #}
+{% macro controls(id, cols, search='', columns=false, choices={}, only={}, views=none, actions=none) %}
+
+ {% if search %}{% endif %}
+
+ {{ slot('views', views) }}
+ {% if columns %}
{{ columns_button() }}{{ columns_menu(cols) }}
{% endif %}
+ {% if choices %}
+
+
+
+ {% for c in cols if c.key in choices %}
+
+ {% endfor %}
+
-
-{% endif %}
-
-
-
-
-
+ {% endif %}
+
+
+
+
+
+
+
+ {{ slot('actions', actions) }}
{% endmacro %}
+{#- A controls row's slot `name`: what the macro `fill` writes, in a group spaced as the buttons; nothing when it
+ writes nothing. #}
+{% macro slot(name, fill) %}{% set html = fill() if fill else '' %}{% if html|trim %}
{{ html }}
{% endif %}{% endmacro %}
+
+{# A Columns menu (static/tables.js `columns`): its button, and the menu of `cols`' definitions, each a checkbox that
+ shows or hides the cells of that data-col. The menu opens under the .menu-wrap that holds it. #}
+{% macro columns_button() %}{% endmacro %}
+{% macro columns_menu(cols) %}
+
+ {% for c in cols if c.menu is not sameas false and not (c.blank or c.check) %}{% endfor %}
+
+{% endmacro %}
+
+{#- A header with no visible name, outside a table macro's table: `label` its name for a screen reader. #}
+{% macro blank(label='') %}
{% if label %}{{ label }}{% endif %}
{% endmacro %}
+
+{#- A row's box in a `check` column (static/tables.js `checks`): `label` its name, `value` its value. #}
+{% macro check_cell(label, value) %}
{% 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) %}
+ and the page before and after; `empty` shows when no row passes. After a change, what is shown is read out once
+ typing pauses, counted in `noun`. #}
+{% macro pager(table, empty='No rows match.', noun='rows') %}
+
{{ empty }}
+
{% endmacro %}
-{#- An icon button that cannot act here: greyed, still focusable, `why` its description and, after `action`, its tooltip;
- `id` names the description. The cell or line that holds it is positioned, so the hidden reason stays in it. #}
-{% macro greyed(label, action, why, id, icon='trash') %}{{ why }}{% endmacro %}
+{#- A button that cannot act here: greyed, still focusable, `why` its description and, after `action` when given, its
+ tooltip; `id` names the description. An icon button by default; `class` and `text` make it another, such as a
+ count. The cell or line that holds it is positioned, so the hidden reason stays in it. #}
+{% macro greyed(label, action, why, id, icon='trash', class='icon-btn danger', text='') %}{{ why }}{% endmacro %}
diff --git a/app/templates/runs/index.html b/app/templates/runs/index.html
index 81dbd698..bed90ebc 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 heads, check_cell, controls %}
{% from 'runs/_launch_ask.html' import delete_ask, dialogs %}
{% extends "base.html" %}
{% block title %}Runs — Nullius{% endblock %}
@@ -161,61 +161,20 @@
{{ g.dataset_title if L.dataset else (L.name or g.dataset_title) }}{% if g.n
{{ dialogs() }}
+{#- All runs' own buttons in its controls row: the density, and Compare, greyed until two runs are ticked. #}
+{% macro density() %}{% endmacro %}
+{% macro compare_button() %}{% endmacro %}
-
-
-
-
-
-
-
- {% for col, label in COLUMNS %}
-
- {% endfor %}
-
-
-
-
-
-
+{{ controls('runs', COLUMNS, search='Search by run, agent, model, benchmark or dataset', columns=true, choices=choices, views=density, actions=compare_button) }}
+ {{ heads([dict(key='pick', label='Select all runs for comparison', check=true, sticky=true)] + COLUMNS) }}
@@ -223,11 +182,10 @@
{{ g.dataset_title if L.dataset else (L.name or g.dataset_title) }}{% if g.n
{# A control row carries no outcomes to filter by: the chips count the
agents' trials, and a nop's rejections are not failed verifications. #}
{% set v = verdicts[j.job_id] %}
-
{%- if j.duration_min %}{{ j.duration_min|runtime }}{% else %}—{% endif -%}
{{ j.model_name }}
@@ -265,7 +223,7 @@
{{ g.dataset_title if L.dataset else (L.name or g.dataset_title) }}{% if g.n
{% endif %}
{# present/planned exposes a partial run; the tooltip carries Harbor's
retry and error counters, which have nowhere else to live. #}
-
{{- j.trials|length }}{% if j.n_planned and j.n_planned != j.trials|length %}/{{ j.n_planned }}{% endif -%}
@@ -275,41 +233,41 @@
{{ g.dataset_title if L.dataset else (L.name or g.dataset_title) }}{% if g.n
All three sort at -2 — below the agents and below a run nothing
scored (-1) — so the columns keep the controls apart. #}
{% set ctl_title = v.control ~ " is a Harbor control: it must be " ~ v.expected ~ " on every task — " ~ v.label ~ ". Not a score." %}
-
{{ v.label }}
-
—
-
—
+
{{ v.label }}
+
—
+
—
{% elif j.scored_only %}
{# A benchmark that gives a score and no pass or fail: the mean score where the rate would be, and nothing solved #}
{% set score_title = "This benchmark gives a score and no pass or fail: the mean score" ~ (" over its " ~ j.n_scored_parts ~ " scored" if j.n_scored_parts else "") ~ ", no solve rate" %}
-
—
-
—
-
{{ '%.2f'|format(j.mean_score) }}
+
—
+
—
+
{{ '%.2f'|format(j.mean_score) }}
{% else %}
-
{{ j.n_resolved }}
+
{{ j.n_resolved }}
{# A run nothing scored (a standalone trajectory, a span export) has no
rate, not a rate of zero: it shows absence and sorts below a measured 0%. #}
-
{{ j.raw_solve_rate|pct }}
-
{{ j.adjusted_solve_rate|pct }}
{% endif %}
{# Zero infra errors is a measured fact, and a good one — every trial has
an outcome, so the count is always knowable. #}
-
{{ j.n_infra }}
+
{{ j.n_infra }}
{# Zero regressions is only a fact for a benchmark that checks for them.
Where none were reported the column shows absence, not a reassuring 0. #}
-
localStorage.setItem('runs.compact', on ? '1' : '0');
});
- const sortRows = NulliusTable.sortable(table);
-
- /* ---- filters: outcome (from the bar/chips) + per-column value menus ----
- A run matches an outcome if ANY of its trials had it. Column filters are
- sets of allowed values; all must pass. */
+ /* ---- filters: an outcome (from the bar/chips), and the controls row's search, Filter and Sort by ----
+ A run matches an outcome if ANY of its trials had it. */
let active = null;
- const columns = NulliusTable.filters(document, () => applyFilter());
- const colFilters = columns.allowed; // col -> Set of allowed values, or null for "all"
+ const t = NulliusTable.toolbar(table, tools, () => applyFilter());
function applyFilter() {
let shown = 0;
rows.forEach(r => {
- const hit = (!active || r.dataset.outcomes.split(' ').includes(active)) && columns.passes(r);
+ const hit = (!active || r.dataset.outcomes.split(' ').includes(active)) && t.passes(r);
r.hidden = !hit;
if (hit) shown++;
});
@@ -386,13 +340,12 @@
{{ d.info.title }}
// the launch view's rows: dimmed rather than hidden, so a launch keeps its shape
document.querySelectorAll('.launch-agents tbody tr').forEach(r =>
r.classList.toggle('dim', !!active && !(r.dataset.outcomes || '').split(' ').includes(active)));
- const filtered = active || Object.values(colFilters).some(Boolean);
+ const filtered = active || query.value.trim() || tools.querySelector('[data-tools="filter"] input[data-value]:not(:checked)');
clearBtn.hidden = !filtered;
emptyNote.hidden = shown > 0;
// agents only, as the header counts them
const runRows = rows.filter(r => !r.classList.contains('control-row'));
const agents = runRows.filter(r => !r.hidden).length;
- note.textContent = filtered ? `${agents} of ${runRows.length} runs` : '';
if (filtered) counts.textContent = `${agents} of ${counts.dataset.runs} run${counts.dataset.runs === '1' ? '' : 's'} shown`;
else counts.innerHTML = head;
syncPicks(); // the header checkbox tracks visible rows only
@@ -418,22 +371,18 @@
{{ d.info.title }}
const form = document.getElementById('compare-form');
const compareBtn = document.getElementById('compare-btn');
const pickNote = document.getElementById('pick-note');
- let picks = [...document.querySelectorAll('.pick-run')];
-
- const pickAll = document.getElementById('pick-all');
- const selectable = () => picks.filter(p => !p.closest('tr').hidden);
+ let picks = [...table.querySelectorAll('[data-check]')];
+ // the header box ticks the visible rows, and shows all, none or some of them ticked
+ const ticks = NulliusTable.checks(table);
+ // greyed while fewer than two are ticked: still focusable, its reason its tooltip and description
+ const why = compareBtn.title;
function syncPicks() {
- const on = picks.filter(p => p.checked);
- compareBtn.disabled = on.length < 2;
- pickNote.textContent = on.length
- ? `${on.length} selected`
- : 'Tick two or more runs to compare';
- // Header box reflects the visible rows: all, none, or partial.
- const vis = selectable();
- const hit = vis.filter(p => p.checked).length;
- pickAll.checked = vis.length > 0 && hit === vis.length;
- pickAll.indeterminate = hit > 0 && hit < vis.length;
+ const on = picks.filter(p => p.checked), ready = on.length >= 2;
+ if (ready) ['aria-disabled', 'aria-describedby', 'title'].forEach(a => compareBtn.removeAttribute(a));
+ else Object.entries({'aria-disabled': 'true', 'aria-describedby': 'compare-why', title: why}).forEach(([a, v]) => compareBtn.setAttribute(a, v));
+ pickNote.textContent = on.length ? `${on.length} selected` : '';
+ ticks();
// Rebuild the querystring: ?job=…&job=… in the order they were ticked.
form.querySelectorAll('input[name="job"]').forEach(i => i.remove());
on.forEach(p => {
@@ -444,18 +393,13 @@
{{ d.info.title }}
form.appendChild(hidden);
});
}
- table.addEventListener('change', e => { if (e.target.matches('.pick-run')) syncPicks(); });
-
- // Select/unselect all — scoped to rows the current filter leaves visible.
- pickAll.addEventListener('change', () => {
- selectable().forEach(p => p.checked = pickAll.checked);
- syncPicks();
- });
+ table.addEventListener('change', e => { if (e.target.matches('[data-check], [data-check-all]')) syncPicks(); });
+ form.addEventListener('submit', e => { if (compareBtn.hasAttribute('aria-disabled')) e.preventDefault(); });
clearBtn.addEventListener('click', () => {
active = null;
- columns.clear();
- applyFilter();
+ query.value = '';
+ tools.querySelector('[data-clear]').click(); // clears the Filter menu, then filters again
});
/* ---- the list keeps up by itself ----
@@ -513,14 +457,15 @@
{{ d.info.title }}
});
}
function refreshRows(fresh) {
- document.querySelectorAll('.filter-menu').forEach(menu => {
- const col = menu.dataset.filterMenu;
- const next = fresh.querySelector(`[data-filter-menu="${col}"]`);
+ // each Filter list takes the values the runs have now, ticked as before; a new one ticked unless the list narrows
+ tools.querySelectorAll('[data-filter-menu]').forEach(menu => {
+ const next = fresh.querySelector(`#runs-tools [data-filter-menu="${CSS.escape(menu.dataset.filterMenu)}"]`);
if (!next) return;
+ const boxes = [...menu.querySelectorAll('input[data-value]')], all = boxes.every(b => b.checked);
+ const on = new Set(boxes.filter(b => b.checked).map(b => b.dataset.value));
menu.innerHTML = next.innerHTML;
- menu.querySelectorAll('input[data-value]').forEach(b => {
- b.checked = !colFilters[col] || colFilters[col].has(b.dataset.value);
- });
+ menu.querySelectorAll('input[data-value]').forEach(b => { b.checked = all || on.has(b.dataset.value); });
+ menu.dispatchEvent(new Event('change'));
});
const html = fresh.querySelector('#runs tbody').innerHTML;
if (sent.get('tbody') === html) return;
@@ -528,10 +473,10 @@
{{ d.info.title }}
const ticked = picks.filter(p => p.checked).map(p => p.value);
table.tBodies[0].innerHTML = html;
rows = [...table.tBodies[0].rows];
- picks = [...document.querySelectorAll('.pick-run')];
+ picks = [...table.querySelectorAll('[data-check]')];
picks.forEach(p => { p.checked = ticked.includes(p.value); });
showCols();
- sortRows();
+ t.resort();
}
function refreshHead(fresh) {
document.getElementById('glance').replaceWith(fresh.getElementById('glance'));
diff --git a/app/templates/runs/launches.html b/app/templates/runs/launches.html
index 25c62261..568e4f98 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 table, cell, greyed %}
{% from 'runs/_launch_ask.html' import delete_ask, dialogs %}
{% extends "base.html" %}
{% block title %}Launches — Nullius{% endblock %}
@@ -10,15 +10,18 @@
{#- A workspace that holds the launch: opened on the Runs page at that launch. #}
{% macro open_at(ws, L, label) %}
{%- if workspace and ws.name == workspace.name %}{{ label }}
-{%- else %}{% endif %}
+{%- else %}{% endif %}
{%- endmacro %}
-{#- A run state as its icon, the word its tooltip and name; sorted by how telling it is. #}
-{% macro state_cell(state) %}{% set icon = {'running': 'play', 'preparing': 'hourglass', 'stopping': 'stopping', 'paused': 'pause', 'failed': 'alert',
+{#- A run state as its icon, the word its tooltip and name. #}
+{% macro state_icon(state) %}{% set icon = {'running': 'play', 'preparing': 'hourglass', 'stopping': 'stopping', 'paused': 'pause', 'failed': 'alert',
'refused': 'refused', 'stopped': 'stop', 'finished': 'check'} %}
-
{% if state %}{% endif %}
+{%- if state %}{% endif %}
{%- endmacro %}
+{#- A launch's row: what its search and filters read. #}
+{% macro launch_tr(r) %}{% set L = r.launch %}{% set wss = r.workspaces %} data-launch="{{ L.key }}" data-search="{{ ([L.key, L.title, r.bench[0] if r.bench else ''] + r.agents + wss|map(attribute='label')|list)|select|join(' ') }}" data-f-bench="{{ r.bench[0] if r.bench }}" data-f-dataset="{{ r.datasets|map('first')|join('\n') }}" data-f-state="{{ r.state }}" data-f-machines="{{ r.machines|join('\n') }}" data-f-ws="{{ wss|map(attribute='name')|join('\n') }}"{% endmacro %}
+
{#- A benchmark or a dataset: linked to its catalogue page when it has one. #}
{% macro entry(e) %}{% if e[1] %}{{ e[0] }}{% else %}{{ e[0] }}{% endif %}{% endmacro %}
@@ -26,54 +29,25 @@
Launches
{% if rows %}
-{#- every column the menus name: the Columns menu all but the launch (State always on), Sort by the sortable ones,
- Filter those with choices #}
-{% set cols = [('state', 'State'), ('launch', 'Launch'), ('bench', 'Benchmark'), ('dataset', 'Dataset'), ('started', 'Started'), ('runs', 'Runs'),
- ('checks', 'Checks'), ('shards', 'Shards'), ('machines', 'Machines'), ('size', 'Size'), ('ws', 'Workspaces')] %}
-{% set unsorted = ['machines', 'ws'] %}
-
-
-
-
- {% for col, label in cols if col != 'launch' %}{% endfor %}
-
-
- {%- 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) }}
-
-
-
-
-
-
State
-
Launch
-
Benchmark
-
Dataset
-
Started
-
Runs
-
Checks
-
Shards
-
Machines
-
Size
-
Workspaces
-
-
-
-
- {% for r in rows %}{% set L = r.launch %}{% set wss = r.workspaces %}
-
{% 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..9dd1f398 100644
--- a/app/templates/workspaces/workspaces.html
+++ b/app/templates/workspaces/workspaces.html
@@ -1,29 +1,28 @@
-{% from '_tables.html' import tools, pager, greyed %}
+{% from '_tables.html' import table, cell, greyed %}
{% extends "base.html" %}
{% block title %}Workspaces — Nullius{% endblock %}
{% block crumb %}/ workspaces{% endblock %}
{% block head %}
-
+{# its dialog #}
{% endblock %}
+{#- A workspace's row: the open one marked, what its search reads. #}
+{% macro ws_tr(ws) %} class="{{ 'ws-current' if workspace and ws.name == workspace.name }}" data-ws="{{ ws.name }}" data-search="{{ ws.label }} {{ ws.name }}" data-holder{% endmacro %}
+
{% block body %}
-
-
- {% for ws in workspaces %}
- {% set current = workspace and ws.name == workspace.name %}{% set rs = roots[ws.name] %}{% set clash = labels.count(ws.label) > 1 %}
-
-
{% if current %}●{% endif %}
-
+{% set cols = [dict(key='open', label='Open', blank=true), dict(key='name', label='Name', width='expand'), dict(key='runs', label='Runs', type='num'),
+ dict(key='checks', label='Checks', type='num'), dict(key='opened', label='Last opened', type='num', align='left'),
+ dict(key='launches', label='Launches', type='num', align='right'), dict(key='roots', label='Roots', type='num', align='right'), dict(key='actions', label='Actions', blank=true)] %}
+{% call(ws, c) table('workspaces', cols, workspaces, ws_tr, class='ws-table', search='Search by name', noun='workspaces') %}
+ {%- set current = workspace and ws.name == workspace.name %}{% set rs = roots[ws.name] %}{% set clash = labels.count(ws.label) > 1 %}
+ {%- if c.key == 'open' %}{% call cell(c) %}{% if current %}●{% endif %}{% endcall %}
+ {%- elif c.key == 'name' %}{% call cell(c, sort=ws.label, class='ws-name') %}
+
{#- the label; the name on disk too where two labels are alike #}
{{ ws.label }}{% if clash %} {{ ws.name }}{% endif %}
@@ -32,9 +31,15 @@
-
-
-
+ {% endcall %}
+ {%- elif c.key == 'runs' %}{% call cell(c) %}{{ counts[ws.name].runs }}{% endcall %}
+ {%- elif c.key == 'checks' %}{% call cell(c) %}{{ counts[ws.name].checks }}{% endcall %}
+ {#- the time as digits, UTC as every workspace records it; never opened sorts last, newest first #}
+ {%- elif c.key == 'opened' %}{% call cell(c, sort=ws.opened[:19]|replace('-', '')|replace(':', '')|replace('T', '') or 0, class='mono faint nowrap') %}{{ ws.opened[:16]|replace('T', ' ') }}{% endcall %}
+ {%- elif c.key == 'launches' %}{% call cell(c) %}{% set n = n_launches[ws.name] %}{% if n %}{{ n }}
+ {%- else %}{{ greyed('Launches of ' ~ ws.label ~ ': 0', '', 'No launches in ' ~ ws.label, 'none-' ~ ws.name, icon='launches', class='btn ghost sm count-btn', text='0') }}{% endif %}{% endcall %}
+ {%- elif c.key == 'roots' %}{% call cell(c, sort=rs|length) %}
+