From dfa768724753d78afa4f4b66cc577642d2d592ab Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 01:33:55 +0200 Subject: [PATCH 01/22] Design refresh: warm graphite palette, green accent, sentence-case labels, LLR gauge for SPRT tests --- OpenBench/static/refresh.css | 235 ++++++++++++++++++++ OpenBench/templatetags/uitags.py | 22 +- Templates/OpenBench/Blocks/testsummary.html | 8 +- Templates/OpenBench/base.html | 5 +- 4 files changed, 266 insertions(+), 4 deletions(-) create mode 100644 OpenBench/static/refresh.css diff --git a/OpenBench/static/refresh.css b/OpenBench/static/refresh.css new file mode 100644 index 0000000..87ce581 --- /dev/null +++ b/OpenBench/static/refresh.css @@ -0,0 +1,235 @@ +/* ========================================================================== + OpenBench - design refresh + + Loaded last (after style.css, ux.css, board.css). Only overrides tokens and + a handful of rules, so the older theme stays intact. Drop the in + base.html to revert everything in one step. + + Direction: warm graphite surfaces, bone-coloured text, a single board-green + accent. Colour is reserved for results (green / amber / red). The LLR gauge + on running SPRT tests is the one distinctive element; the rest stays quiet. + ========================================================================== */ + +:root { + /* Surfaces */ + --color1: #14161A; + --color2: #1A1D22; + --color3: #23272D; + --surface-head: #1F2227; + --surface-hover: #252A30; + + /* Lines */ + --line: #2A2E35; + --line-strong: #3A3F48; + + /* Text */ + --color-font1: #EDEAE3; + --color-font2: #C9C6BE; + --color-font3: #A9CDB3; + --muted: #8C8F96; + + /* Accent: board green. Buttons use the darker value so white text passes AA. */ + --accent: #4F8160; + --accent-hover: #6BA17D; + --accent-soft: rgba(94, 139, 106, 0.16); + --link: #8FC3A0; + --link-hover: #B9E0C6; + + /* Results */ + --ok: #6EDB9A; + --warn: #E8B84A; + --bad: #EF7B72; + --orange: #E8955A; + --purple: #B79FE0; + --purple-soft: rgba(183, 159, 224, 0.14); + + --font-sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; + + --radius: 3px; + --shadow-card: none; +} + +::selection { + background: rgba(94, 139, 106, 0.4); +} + +/* ---------- Chrome ---------- */ + +#topbar { + background: rgba(20, 22, 26, 0.92); +} + +#topbar .brand-name { + font-weight: 650; +} + +.page-title { + font-size: 26px; + font-weight: 600; + letter-spacing: -0.015em; +} + +/* ---------- Labels: sentence case instead of tracked capitals ---------- */ + +#sidebar .nav-title, +.card-title, +.badge, +.flag, +#content .table-header th, +#content .table-small-header th, +.stat-label, +.ev-meta dt, +.ev-facts dt, +.ev-player small, +.ev-sel-stats span { + text-transform: none; + letter-spacing: 0; +} + +#sidebar .nav-title { + font-size: 12.5px; + font-weight: 600; +} + +.card-title { + color: var(--color-font2); + font-size: 14px; + font-weight: 600; +} + +#content .table-header th, +#content .table-small-header th { + font-size: 12.5px; + font-weight: 600; +} + +/* The header's accent stripe carried no information */ +#content .table-header th:first-child { + border-left: 0; +} + +.stat-label, +.ev-meta dt, +.ev-facts dt, +.ev-player small { + font-size: 12.5px; +} + +.flag { + font-size: 11px; + font-weight: 600; +} + +.badge { + font-size: 12px; + font-weight: 600; +} + +/* ---------- Surfaces: borders instead of shadows ---------- */ + +.card, +.stat-card { + box-shadow: none; +} + +/* Fleet and queue counters: number first, icon as a quiet marker */ +.stat-card { + flex-direction: row-reverse; + justify-content: space-between; + align-items: flex-start; +} + +.stat-icon { + width: auto; + height: auto; + background: none !important; + font-size: 14px; +} + +.stat-value { + font-size: 26px; + font-weight: 600; +} + +/* ---------- Colour tokens that were hardcoded in older files ---------- */ + +.badge-info { + border-color: rgba(94, 139, 106, 0.45); + color: #A9D4B7; +} + +#content a.seg-btn.active { + box-shadow: inset 0 0 0 1px rgba(94, 139, 106, 0.5); +} + +.ev-move.is-active { + border-color: rgba(94, 139, 106, 0.5); +} + +.ev-white .ev-piece { background-color: #EDEAE3; } +.ev-black .ev-piece { background-color: #14161A; } + +/* ========================================================================== + LLR gauge (running SPRT tests) + + The track runs from the lower bound (left) to the upper bound (right). + The tall tick marks LLR = 0; the fill grows from it towards the current + LLR, so direction and distance to a decision read at a glance. + ========================================================================== */ + +.llr { + position: relative; + min-width: 150px; + height: 6px; + margin-top: 10px; + background-color: var(--line); + border-radius: 1px; +} + +/* Bound markers at both ends */ +.llr::before, +.llr::after { + content: ''; + position: absolute; + top: -3px; + bottom: -3px; + width: 2px; + background-color: var(--line-strong); +} + +.llr::before { left: 0; } +.llr::after { right: 0; } + +.llr-fill { + position: absolute; + top: 0; + bottom: 0; + background-color: var(--muted); +} + +.llr-pos .llr-fill { background-color: var(--ok); } +.llr-neg .llr-fill { background-color: var(--bad); } + +.llr-zero { + position: absolute; + top: -4px; + bottom: -4px; + width: 1px; + background-color: var(--color-font2); +} + +.llr-scale { + display: flex; + justify-content: space-between; + margin-top: 5px; + color: var(--muted); + font-family: var(--font-mono); + font-size: 10.5px; + font-variant-numeric: tabular-nums; + line-height: 1; +} + +.llr-scale b { + color: var(--color-font1); + font-weight: 500; +} diff --git a/OpenBench/templatetags/uitags.py b/OpenBench/templatetags/uitags.py index 90e739c..681db67 100644 --- a/OpenBench/templatetags/uitags.py +++ b/OpenBench/templatetags/uitags.py @@ -57,7 +57,27 @@ def progress_info(test): else: fraction, tone = 0.0, 'neutral' - return { 'pct' : int(max(0.0, min(1.0, fraction)) * 100), 'tone' : tone } + info = { 'pct' : int(max(0.0, min(1.0, fraction)) * 100), 'tone' : tone } + + # Data for the LLR gauge: the track runs lower -> upper bound, the fill + # grows from LLR = 0 towards the current LLR. Strings are formatted here + # so locale settings can never turn a decimal point into a comma. + + if lower < 0 < upper: + span = upper - lower + pos = max(0.0, min(1.0, (current - lower) / span)) * 100 + zero = (0.0 - lower) / span * 100 + info.update({ + 'gauge' : True, + 'llr' : '%.2f' % current, + 'lower' : '%.2f' % lower, + 'upper' : '%.2f' % upper, + 'zero' : '%.1f' % zero, + 'left' : '%.1f' % min(pos, zero), + 'width' : '%.1f' % abs(pos - zero), + }) + + return info if test.max_games: fraction = test.games / float(test.max_games) diff --git a/Templates/OpenBench/Blocks/testsummary.html b/Templates/OpenBench/Blocks/testsummary.html index 4da61c4..592107f 100644 --- a/Templates/OpenBench/Blocks/testsummary.html +++ b/Templates/OpenBench/Blocks/testsummary.html @@ -6,7 +6,13 @@ {% if test.error %}crash{% endif %} {% if test|test_is_fischer %}frc{% endif %} {% with progress=test|progress_info %} - {% if progress %} + {% if progress.gauge %} +
+ + +
+
{{ progress.lower }}{{ progress.llr }}{{ progress.upper }}
+ {% elif progress %}
{% endif %} {% endwith %} diff --git a/Templates/OpenBench/base.html b/Templates/OpenBench/base.html index 17aca09..f284f76 100644 --- a/Templates/OpenBench/base.html +++ b/Templates/OpenBench/base.html @@ -7,7 +7,7 @@ - + @@ -17,12 +17,13 @@ + - + RektBench From 7718d593f4618eb579681ffc25346afcc3064093 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 01:41:03 +0200 Subject: [PATCH 02/22] Result cells: outline for tests without a verdict, diagonal hatching for stopped tests, clearer blue --- OpenBench/static/refresh.css | 43 +++++++++++++++++++++ Templates/OpenBench/Blocks/testsummary.html | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/OpenBench/static/refresh.css b/OpenBench/static/refresh.css index 87ce581..7619c36 100644 --- a/OpenBench/static/refresh.css +++ b/OpenBench/static/refresh.css @@ -233,3 +233,46 @@ color: var(--color-font1); font-weight: 500; } + +/* ========================================================================== + Result cells + + A filled cell is a verdict: green passed, blue passed as a non-regression + test, amber and red failed. A cell without a fill has no verdict yet, so it + is only outlined, in warm grey that cannot be mistaken for the blue. + A stopped test keeps the outline and gains diagonal hatching, like an entry + that has been struck out. + ========================================================================== */ + +:root { + --hatch: rgba(237, 234, 227, 0.14); +} + +/* Blue: a stronger fill, so it holds its own beside the green */ +#content .statblock-blue { + background-color: rgba(76, 141, 255, 0.2); + color: #A9CBFF; +} + +/* No verdict yet: running, pending, awaiting artifacts, stopped. + .statblock- is the empty colour name the template renders for them, which + also covers result cells that carry no state class. */ +#content .statblock.statblock-, +#content .statblock.state-running, +#content .statblock.state-pending, +#content .statblock.state-awaiting, +#content .statblock.state-stopped { + background-color: transparent; + box-shadow: inset 0 0 0 1px var(--line-strong); + color: var(--color-font2); +} + +/* Nothing has been played yet */ +#content .statblock.state-pending, +#content .statblock.state-awaiting { + color: var(--muted); +} + +#content .statblock.state-stopped { + background-image: repeating-linear-gradient(135deg, transparent 0, transparent 6px, var(--hatch) 6px, var(--hatch) 7.5px, transparent 7.5px, transparent 9px); +} diff --git a/Templates/OpenBench/Blocks/testsummary.html b/Templates/OpenBench/Blocks/testsummary.html index 592107f..2b0c014 100644 --- a/Templates/OpenBench/Blocks/testsummary.html +++ b/Templates/OpenBench/Blocks/testsummary.html @@ -23,4 +23,4 @@ {% if test|test_is_time_odds %}time odds{% endif %} {% if test|test_is_smp_odds %}thread odds{% endif %} -{{test|shortStatBlock|linebreaksbr}} +{{test|shortStatBlock|linebreaksbr}} From 236d69cfb836e0094de1f0283d81424bb143d411 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 11:55:32 +0200 Subject: [PATCH 03/22] Workload page: result hero, hide unavailable actions, confirm destructive ones Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01TyAt5S5MAwLBY2idan1SwU --- OpenBench/static/workload-refresh.css | 42 +++++++++++++++++++++++++ Templates/OpenBench/workload.html | 45 +++++++++++++++++++-------- 2 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 OpenBench/static/workload-refresh.css diff --git a/OpenBench/static/workload-refresh.css b/OpenBench/static/workload-refresh.css new file mode 100644 index 0000000..2d97c41 --- /dev/null +++ b/OpenBench/static/workload-refresh.css @@ -0,0 +1,42 @@ +/* Workload page additions for the design refresh. Loaded after workload.css. */ + +.result-hero { + grid-column: 1 / -1; + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 24px; + padding: 18px 20px; + background: var(--color2); + border: 1px solid var(--line); + border-radius: var(--radius); +} + +.result-hero .statblock { + padding: 12px 18px; + border-radius: var(--radius); + font-family: var(--font-mono); + font-size: 15px; + line-height: 1.5; + white-space: nowrap; +} + +.result-hero .result-hero-gauge { + flex: 1 1 260px; + min-width: 220px; +} + +.result-hero .llr { + margin-top: 0; + height: 8px; +} + +.result-hero .llr-scale { + font-size: 12px; +} + +.result-hero-note { + margin: 8px 0 0; + color: var(--muted); + font-size: 13px; +} diff --git a/Templates/OpenBench/workload.html b/Templates/OpenBench/workload.html index e00dd48..ba0d587 100644 --- a/Templates/OpenBench/workload.html +++ b/Templates/OpenBench/workload.html @@ -5,6 +5,7 @@ {% block scripts %} + {% endblock %} @@ -15,6 +16,24 @@
+ {% if type == "TEST" %} + {% with progress=workload|progress_info %} +
+
{{ workload|shortStatBlock|linebreaksbr }}
+ {% if progress.gauge %} +
+
+ + +
+
{{ progress.lower }}LLR {{ progress.llr }}{{ progress.upper }}
+
+ {% endif %} +
+ {% endwith %} + {% endif %} + +

Configuration

@@ -83,25 +102,25 @@ {% elif not workload.approved and request.user.is_superuser %} Approve {% else %} - Approve + {% endif %} {% if workload.finished and not workload.passed and not workload.failed and profile.approver %} - Restart + Restart {% elif workload.finished and not workload.passed and not workload.failed and profile.user.username == workload.author %} - Restart + Restart {% elif workload.finished %} - Restart + {% endif %} {% if not workload.finished and profile.approver %} - Stop + Stop {% elif not workload.finished and profile.user.username == workload.author %} - Stop + Stop {% elif not workload.finished %} - Stop + {% endif %} @@ -109,13 +128,13 @@ {% if workload.deleted %} Restore {% else %} - Delete + Delete {% endif %} {% else %} {% if workload.deleted %} - Restore + {% else %} - Delete + {% endif %} {% endif %} @@ -174,18 +193,18 @@
- +
- +
{% if type == "TEST" or type == "DATAGEN" %}
- +
{% endif %} From e16b2e0b60720f7bee8d950074f2f2bd4a2f044e Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 11:59:25 +0200 Subject: [PATCH 04/22] Workload config as Dev/Base comparison, full author names, server-rendered + - + From e67bdfaa03c55b5acc25b72501a88e697edda3b7 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 12:23:03 +0200 Subject: [PATCH 05/22] Workload page: load uitags so test_status and progress_info resolve (fixes 500) --- Templates/OpenBench/workload.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/OpenBench/workload.html b/Templates/OpenBench/workload.html index 1105590..35fa72a 100644 --- a/Templates/OpenBench/workload.html +++ b/Templates/OpenBench/workload.html @@ -1,6 +1,6 @@ {% extends "OpenBench/base.html" %} -{% load mytags %} +{% load mytags uitags %} {% load static %} {% block scripts %} From 44d6bfe7e8bd8a79cb12d7bb65519a682d76a91f Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 12:25:18 +0200 Subject: [PATCH 06/22] Remove result cell restyling (outline, hatching, blue); keep full author names --- OpenBench/static/refresh.css | 43 ------------------------------------ 1 file changed, 43 deletions(-) diff --git a/OpenBench/static/refresh.css b/OpenBench/static/refresh.css index fec7d7a..de3b284 100644 --- a/OpenBench/static/refresh.css +++ b/OpenBench/static/refresh.css @@ -234,49 +234,6 @@ font-weight: 500; } -/* ========================================================================== - Result cells - - A filled cell is a verdict: green passed, blue passed as a non-regression - test, amber and red failed. A cell without a fill has no verdict yet, so it - is only outlined, in warm grey that cannot be mistaken for the blue. - A stopped test keeps the outline and gains diagonal hatching, like an entry - that has been struck out. - ========================================================================== */ - -:root { - --hatch: rgba(237, 234, 227, 0.14); -} - -/* Blue: a stronger fill, so it holds its own beside the green */ -#content .statblock-blue { - background-color: rgba(76, 141, 255, 0.2); - color: #A9CBFF; -} - -/* No verdict yet: running, pending, awaiting artifacts, stopped. - .statblock- is the empty colour name the template renders for them, which - also covers result cells that carry no state class. */ -#content .statblock.statblock-, -#content .statblock.state-running, -#content .statblock.state-pending, -#content .statblock.state-awaiting, -#content .statblock.state-stopped { - background-color: transparent; - box-shadow: inset 0 0 0 1px var(--line-strong); - color: var(--color-font2); -} - -/* Nothing has been played yet */ -#content .statblock.state-pending, -#content .statblock.state-awaiting { - color: var(--muted); -} - -#content .statblock.state-stopped { - background-image: repeating-linear-gradient(135deg, transparent 0, transparent 6px, var(--hatch) 6px, var(--hatch) 7.5px, transparent 7.5px, transparent 9px); -} - /* Author names are shown in full; very long ones are clipped with an ellipsis */ #content td.col-author { max-width: 14ch; From 54538edcb1c0b96f8caed823dd930055d255c961 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 12:25:23 +0200 Subject: [PATCH 07/22] Test list: drop state class from result cell --- Templates/OpenBench/Blocks/testsummary.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/OpenBench/Blocks/testsummary.html b/Templates/OpenBench/Blocks/testsummary.html index f0c1c03..095df0f 100644 --- a/Templates/OpenBench/Blocks/testsummary.html +++ b/Templates/OpenBench/Blocks/testsummary.html @@ -23,4 +23,4 @@ {% if test|test_is_time_odds %}time odds{% endif %} {% if test|test_is_smp_odds %}thread odds{% endif %} - + From 142296006b45185eb33c1af875591be79b7e41e6 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 12:26:12 +0200 Subject: [PATCH 08/22] Workload page: revert hero, Dev/Base table, action hiding and confirms; keep full author names and server-rendered timestamps --- OpenBench/static/workload-refresh.css | 90 --------------- Templates/OpenBench/workload.html | 152 ++++++++++---------------- 2 files changed, 59 insertions(+), 183 deletions(-) delete mode 100644 OpenBench/static/workload-refresh.css diff --git a/OpenBench/static/workload-refresh.css b/OpenBench/static/workload-refresh.css deleted file mode 100644 index 159d042..0000000 --- a/OpenBench/static/workload-refresh.css +++ /dev/null @@ -1,90 +0,0 @@ -/* Workload page additions for the design refresh. Loaded after workload.css. */ - -.result-hero { - grid-column: 1 / -1; - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 24px; - padding: 18px 20px; - background: var(--color2); - border: 1px solid var(--line); - border-radius: var(--radius); -} - -.result-hero .statblock { - padding: 12px 18px; - border-radius: var(--radius); - font-family: var(--font-mono); - font-size: 15px; - line-height: 1.5; - white-space: nowrap; -} - -.result-hero .result-hero-gauge { - flex: 1 1 260px; - min-width: 220px; -} - -.result-hero .llr { - margin-top: 0; - height: 8px; -} - -.result-hero .llr-scale { - font-size: 12px; -} - -/* Dev / Base comparison */ -.config-compare { - width: 100%; - border-collapse: collapse; - margin-bottom: 8px; -} - -.config-compare th { - text-align: left; - padding: 8px 12px; - font-size: 12.5px; - font-weight: 600; - color: var(--muted); - border-bottom: 1px solid var(--line); -} - -.config-compare td { - padding: 8px 12px; - vertical-align: top; - overflow-wrap: anywhere; - border-bottom: 1px solid var(--line); -} - -.config-compare .td-label { - width: 1%; - white-space: nowrap; - color: var(--muted); -} - -.config-compare .mono { - font-family: var(--font-mono); - font-size: 13px; -} - -/* A value that differs between Dev and Base */ -.config-compare td.diff { - background: var(--accent-soft); - box-shadow: inset 2px 0 0 var(--accent); -} - -.config-shared { - margin-top: 8px; -} - -@media (max-width: 640px) { - .config-compare td, .config-compare th { padding: 6px 8px; } -} - -.result-hero-note { - margin: 8px 0 0; - color: var(--muted); - font-size: 13px; -} diff --git a/Templates/OpenBench/workload.html b/Templates/OpenBench/workload.html index 35fa72a..e3f4811 100644 --- a/Templates/OpenBench/workload.html +++ b/Templates/OpenBench/workload.html @@ -1,11 +1,10 @@ {% extends "OpenBench/base.html" %} -{% load mytags uitags %} +{% load mytags %} {% load static %} {% block scripts %} - {% endblock %} @@ -16,102 +15,57 @@
- {% if type == "TEST" %} - {% with progress=workload|progress_info %} -
-
{{ workload|shortStatBlock|linebreaksbr }}
- {% if progress.gauge %} -
-
- - -
-
{{ progress.lower }}LLR {{ progress.llr }}{{ progress.upper }}
-
- {% endif %} -
- {% endwith %} - {% endif %} -

Configuration

+
{{test.author|capfirst|slice:":6"}}{{test.author|capfirst}} {{test.dev_engine}} {{test|prettyDevName}} diff --git a/Templates/OpenBench/base.html b/Templates/OpenBench/base.html index f284f76..57909af 100644 --- a/Templates/OpenBench/base.html +++ b/Templates/OpenBench/base.html @@ -47,7 +47,8 @@ }; for (var i = 0; i < timestamps.length; i++) { - var date = new Date(1000 * timestamps[i].innerHTML); + var epoch = timestamps[i].getAttribute('data-epoch'); + var date = new Date(1000 * (epoch !== null ? epoch : timestamps[i].innerHTML)); timestamps[i].innerHTML = date.toLocaleString(undefined, options); } } diff --git a/Templates/OpenBench/workload.html b/Templates/OpenBench/workload.html index ba0d587..1105590 100644 --- a/Templates/OpenBench/workload.html +++ b/Templates/OpenBench/workload.html @@ -33,58 +33,85 @@ {% endwith %} {% endif %} -

Configuration

- + +
+ + + + + {% if type == "TEST" or type == "DATAGEN" %}{% endif %} + + + + + + + {% if type == "TEST" or type == "DATAGEN" %}{{workload.base_repo}}{% endif %} + + + + + {% if type == "TEST" or type == "DATAGEN" %}{% endif %} + + + + + {% if type == "TEST" or type == "DATAGEN" %}{% endif %} + + + + + {% if type == "TEST" or type == "DATAGEN" %}{% endif %} + + + + + {% if type == "TEST" or type == "DATAGEN" %}{{workload.base_netname}}{% endif %} + + + + + {% if type == "TEST" or type == "DATAGEN" %}{{workload.base_options}}{% endif %} + + + + + {% if type == "TEST" or type == "DATAGEN" %}{{workload.base_time_control}}{% endif %} + + +
{{dev_text}}Base
Source{{workload.dev_repo}}
Branch{{workload.dev.name|prettyName}}{{workload.base.name|prettyName}}
Commit{{workload.dev.sha}}{{workload.base.sha}}
Bench{{workload.dev.bench}}{{workload.base.bench}}
Network{{workload.dev_netname}}
Options{{workload.dev_options}}
Time control{{workload.dev_time_control}}
+ + + - - - - - - - - - - - - - {% if type == "TEST" or type == "DATAGEN" %} - - - - - - - - {% endif %} + {% if book_url %} - + {% else %} - + {% endif %} - - - + + + {% if type == "TUNE" %} - + - + {% elif type == "DATAGEN" %} - - + + {% endif %} -
Author{{workload.author|capfirst}}
Creation{{workload.creation|date:'U'}}
{{dev_text}} Source{{workload.dev_repo}}
{{dev_text}} Sha{{workload.dev.sha}}
{{dev_text}} Branch{{workload.dev.name|prettyName}}
{{dev_text}} Bench{{workload.dev.bench}}
{{dev_text}} Network{{workload.dev_netname}}
{{dev_text}} Options{{workload.dev_options}}
{{dev_text}} Time{{workload.dev_time_control}}
Base Source{{workload.base_repo}}
Base Sha{{workload.base.sha}}
Base Branch{{workload.base.name|prettyName}}
Base Bench{{workload.base.bench}}
Base Network{{workload.base_netname}}
Base Options{{workload.base_options}}
Base Time{{workload.base_time_control}}
Created
Opening Book{{workload.book_name}}
Opening book{{workload.book_name}}
Opening Book{{workload.book_name}}
Opening book{{workload.book_name}}
Upload PGNs{{workload.upload_pgns}}
Syzygy WDL{{workload.syzygy_wdl}}
Syzygy ADJ.{{workload.syzygy_adj}}
Win ADJ.{{workload.win_adj}}
Draw ADJ.{{workload.draw_adj}}
Syzygy adjudication{{workload.syzygy_adj}}
Win adjudication{{workload.win_adj}}
Draw adjudication{{workload.draw_adj}}
Alpha{{workload.spsa.Alpha}}
Gamma{{workload.spsa.Gamma}}
A-Ratio{{workload.spsa.A_ratio}}
A-ratio{{workload.spsa.A_ratio}}
Reporting{{workload.spsa.reporting_type}}
Distribution{{workload.spsa.distribution_type}}
Pairs Per Point{{workload.workload_size}}
Pairs per point{{workload.workload_size}}
Genfens Args{{workload.genfens_args}}
Play Reverses{{workload.play_reverses}}
Genfens args{{workload.genfens_args}}
Play reverses{{workload.play_reverses}}
@@ -101,8 +128,6 @@ Approve {% elif not workload.approved and request.user.is_superuser %} Approve - {% else %} - {% endif %} @@ -110,8 +135,6 @@ Restart {% elif workload.finished and not workload.passed and not workload.failed and profile.user.username == workload.author %} Restart - {% elif workload.finished %} - {% endif %} @@ -119,8 +142,6 @@ Stop {% elif not workload.finished and profile.user.username == workload.author %} Stop - {% elif not workload.finished %} - {% endif %} @@ -130,26 +151,20 @@ {% else %} Delete {% endif %} - {% else %} - {% if workload.deleted %} - - {% else %} - - {% endif %} {% endif %} {% if type == "TEST" or type == "DATAGEN" %}
- +
{% endif %} {% if type == "TEST" or type == "DATAGEN" %}
- +
{% endif %} @@ -178,11 +193,11 @@ {% if type == "TEST" %} -
{{workload|longStatBlock|linebreaksbr}}
+
{{workload|longStatBlock|linebreaksbr}}
{% elif type == "TUNE" %} -
{{workload|shortStatBlock|linebreaksbr}}
+
{{workload|shortStatBlock|linebreaksbr}}
{% elif type == "DATAGEN" %} -
{{workload|longStatBlock|linebreaksbr}}
+
{{workload|longStatBlock|linebreaksbr}}
{% endif %} @@ -276,7 +291,7 @@
{{result.data.machine.id}} {{result.data.machine.user.username|capfirst}}{{result.data.updated|date:'U'}} {{result.data.games}} {{result.data.wins}} {{result.data.losses}}{{test|shortStatBlock|linebreaksbr}}{{test|shortStatBlock|linebreaksbr}}
- -
- - - - - {% if type == "TEST" or type == "DATAGEN" %}{% endif %} - - - - - - - {% if type == "TEST" or type == "DATAGEN" %}{{workload.base_repo}}{% endif %} - - - - - {% if type == "TEST" or type == "DATAGEN" %}{% endif %} - - - - - {% if type == "TEST" or type == "DATAGEN" %}{% endif %} - - - - - {% if type == "TEST" or type == "DATAGEN" %}{% endif %} - - - - - {% if type == "TEST" or type == "DATAGEN" %}{{workload.base_netname}}{% endif %} - - - - - {% if type == "TEST" or type == "DATAGEN" %}{{workload.base_options}}{% endif %} - - - - - {% if type == "TEST" or type == "DATAGEN" %}{{workload.base_time_control}}{% endif %} - - -
{{dev_text}}Base
Source{{workload.dev_repo}}
Branch{{workload.dev.name|prettyName}}{{workload.base.name|prettyName}}
Commit{{workload.dev.sha}}{{workload.base.sha}}
Bench{{workload.dev.bench}}{{workload.base.bench}}
Network{{workload.dev_netname}}
Options{{workload.dev_options}}
Time control{{workload.dev_time_control}}
- - - - + + + + + + + + + + + + + {% if type == "TEST" or type == "DATAGEN" %} + + + + + + + + {% endif %} {% if book_url %} - + {% else %} - + {% endif %} - - - + + + {% if type == "TUNE" %} - + - + {% elif type == "DATAGEN" %} - - + + {% endif %} +
Author{{workload.author|capfirst}}
Created
Creation
{{dev_text}} Source{{workload.dev_repo}}
{{dev_text}} Sha{{workload.dev.sha}}
{{dev_text}} Branch{{workload.dev.name|prettyName}}
{{dev_text}} Bench{{workload.dev.bench}}
{{dev_text}} Network{{workload.dev_netname}}
{{dev_text}} Options{{workload.dev_options}}
{{dev_text}} Time{{workload.dev_time_control}}
Base Source{{workload.base_repo}}
Base Sha{{workload.base.sha}}
Base Branch{{workload.base.name|prettyName}}
Base Bench{{workload.base.bench}}
Base Network{{workload.base_netname}}
Base Options{{workload.base_options}}
Base Time{{workload.base_time_control}}
Opening book{{workload.book_name}}
Opening Book{{workload.book_name}}
Opening book{{workload.book_name}}
Opening Book{{workload.book_name}}
Upload PGNs{{workload.upload_pgns}}
Syzygy WDL{{workload.syzygy_wdl}}
Syzygy adjudication{{workload.syzygy_adj}}
Win adjudication{{workload.win_adj}}
Draw adjudication{{workload.draw_adj}}
Syzygy ADJ.{{workload.syzygy_adj}}
Win ADJ.{{workload.win_adj}}
Draw ADJ.{{workload.draw_adj}}
Alpha{{workload.spsa.Alpha}}
Gamma{{workload.spsa.Gamma}}
A-ratio{{workload.spsa.A_ratio}}
A-Ratio{{workload.spsa.A_ratio}}
Reporting{{workload.spsa.reporting_type}}
Distribution{{workload.spsa.distribution_type}}
Pairs per point{{workload.workload_size}}
Pairs Per Point{{workload.workload_size}}
Genfens args{{workload.genfens_args}}
Play reverses{{workload.play_reverses}}
Genfens Args{{workload.genfens_args}}
Play Reverses{{workload.play_reverses}}
@@ -128,20 +82,26 @@ Approve {% elif not workload.approved and request.user.is_superuser %} Approve + {% else %} + Approve {% endif %} {% if workload.finished and not workload.passed and not workload.failed and profile.approver %} - Restart + Restart {% elif workload.finished and not workload.passed and not workload.failed and profile.user.username == workload.author %} - Restart + Restart + {% elif workload.finished %} + Restart {% endif %} {% if not workload.finished and profile.approver %} - Stop + Stop {% elif not workload.finished and profile.user.username == workload.author %} - Stop + Stop + {% elif not workload.finished %} + Stop {% endif %} @@ -149,7 +109,13 @@ {% if workload.deleted %} Restore {% else %} - Delete + Delete + {% endif %} + {% else %} + {% if workload.deleted %} + Restore + {% else %} + Delete {% endif %} {% endif %}
@@ -157,14 +123,14 @@ {% if type == "TEST" or type == "DATAGEN" %}
- +
{% endif %} {% if type == "TEST" or type == "DATAGEN" %}
- +
{% endif %} @@ -193,11 +159,11 @@ {% if type == "TEST" %} -
{{workload|longStatBlock|linebreaksbr}}
+
{{workload|longStatBlock|linebreaksbr}}
{% elif type == "TUNE" %} -
{{workload|shortStatBlock|linebreaksbr}}
+
{{workload|shortStatBlock|linebreaksbr}}
{% elif type == "DATAGEN" %} -
{{workload|longStatBlock|linebreaksbr}}
+
{{workload|longStatBlock|linebreaksbr}}
{% endif %} @@ -208,18 +174,18 @@
- +
- +
{% if type == "TEST" or type == "DATAGEN" %}
- +
{% endif %} @@ -305,4 +271,4 @@ -{% endblock %} +{% endblock %} \ No newline at end of file From 0dab31718a94590ad609d7648ee7f93a6f083b79 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 12:27:50 +0200 Subject: [PATCH 09/22] Restore result cell styling (outline, hatching, clearer blue) --- OpenBench/static/refresh.css | 43 +++++++++++++++++++++ Templates/OpenBench/Blocks/testsummary.html | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/OpenBench/static/refresh.css b/OpenBench/static/refresh.css index de3b284..fec7d7a 100644 --- a/OpenBench/static/refresh.css +++ b/OpenBench/static/refresh.css @@ -234,6 +234,49 @@ font-weight: 500; } +/* ========================================================================== + Result cells + + A filled cell is a verdict: green passed, blue passed as a non-regression + test, amber and red failed. A cell without a fill has no verdict yet, so it + is only outlined, in warm grey that cannot be mistaken for the blue. + A stopped test keeps the outline and gains diagonal hatching, like an entry + that has been struck out. + ========================================================================== */ + +:root { + --hatch: rgba(237, 234, 227, 0.14); +} + +/* Blue: a stronger fill, so it holds its own beside the green */ +#content .statblock-blue { + background-color: rgba(76, 141, 255, 0.2); + color: #A9CBFF; +} + +/* No verdict yet: running, pending, awaiting artifacts, stopped. + .statblock- is the empty colour name the template renders for them, which + also covers result cells that carry no state class. */ +#content .statblock.statblock-, +#content .statblock.state-running, +#content .statblock.state-pending, +#content .statblock.state-awaiting, +#content .statblock.state-stopped { + background-color: transparent; + box-shadow: inset 0 0 0 1px var(--line-strong); + color: var(--color-font2); +} + +/* Nothing has been played yet */ +#content .statblock.state-pending, +#content .statblock.state-awaiting { + color: var(--muted); +} + +#content .statblock.state-stopped { + background-image: repeating-linear-gradient(135deg, transparent 0, transparent 6px, var(--hatch) 6px, var(--hatch) 7.5px, transparent 7.5px, transparent 9px); +} + /* Author names are shown in full; very long ones are clipped with an ellipsis */ #content td.col-author { max-width: 14ch; diff --git a/Templates/OpenBench/Blocks/testsummary.html b/Templates/OpenBench/Blocks/testsummary.html index 095df0f..f0c1c03 100644 --- a/Templates/OpenBench/Blocks/testsummary.html +++ b/Templates/OpenBench/Blocks/testsummary.html @@ -23,4 +23,4 @@ {% if test|test_is_time_odds %}time odds{% endif %} {% if test|test_is_smp_odds %}thread odds{% endif %} -{{test|shortStatBlock|linebreaksbr}} +{{test|shortStatBlock|linebreaksbr}} From cbf4e59672ad5e7fdf706043771de497d249d14c Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 12:47:06 +0200 Subject: [PATCH 10/22] Index: drop the Awaiting artifacts counter card --- Templates/OpenBench/index.html | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Templates/OpenBench/index.html b/Templates/OpenBench/index.html index 30c5d0c..572ebb3 100644 --- a/Templates/OpenBench/index.html +++ b/Templates/OpenBench/index.html @@ -24,13 +24,6 @@
Pending approval
-
- -
-
{{ awaiting|length }}
-
Awaiting artifacts
-
-
{% if fleet %}
From 0b8862cc2c18301cf6b22137271f799d1ae1a49e Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 12:56:01 +0200 Subject: [PATCH 11/22] Quick search: palette markup partial --- Templates/OpenBench/Blocks/palette.html | 83 +++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Templates/OpenBench/Blocks/palette.html diff --git a/Templates/OpenBench/Blocks/palette.html b/Templates/OpenBench/Blocks/palette.html new file mode 100644 index 0000000..9271995 --- /dev/null +++ b/Templates/OpenBench/Blocks/palette.html @@ -0,0 +1,83 @@ + + + From 977ac2e4f9f8b9dd1c4825c3d1294831357f5292 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 17:27:52 +0200 Subject: [PATCH 12/22] Quick search: drop the Discord entry --- Templates/OpenBench/Blocks/palette.html | 1 - 1 file changed, 1 deletion(-) diff --git a/Templates/OpenBench/Blocks/palette.html b/Templates/OpenBench/Blocks/palette.html index 9271995..2a0bf95 100644 --- a/Templates/OpenBench/Blocks/palette.html +++ b/Templates/OpenBench/Blocks/palette.html @@ -52,7 +52,6 @@ {% endif %}
  • OpenBench on GitHub
  • -
  • Discord
  • {% for engine, data in config.engines.items %}
  • {{engine}} source
  • {% endfor %} From 963ba2151e15859fd2bd96b12d23d5b7dbb12791 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 17:28:10 +0200 Subject: [PATCH 13/22] Quick search: palette styles --- OpenBench/static/palette.css | 283 +++++++++++++++++++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 OpenBench/static/palette.css diff --git a/OpenBench/static/palette.css b/OpenBench/static/palette.css new file mode 100644 index 0000000..58bcedb --- /dev/null +++ b/OpenBench/static/palette.css @@ -0,0 +1,283 @@ +/* ========================================================================== + Quick search ( Ctrl+K ): a Spotlight-style palette. + Loaded after refresh.css, and uses its tokens. + ========================================================================== */ + +html.palette-open { overflow: hidden; } + +/* The shortcut hint inside the top bar button */ + +.topbar-kbd { + margin-left: 8px; + padding: 1px 6px; + border: 1px solid var(--line-strong); + border-radius: 5px; + color: var(--muted); + font-family: var(--font-mono); + font-size: 11px; + line-height: 1.5; +} + +@media (hover: none), (max-width: 900px) { + .topbar-kbd { display: none; } +} + +/* Overlay */ + +#palette { + position: fixed; + inset: 0; + z-index: 1000; + display: flex; + justify-content: center; + align-items: flex-start; + padding: 13vh 16px 16px; +} + +#palette[hidden] { display: none; } + +.pl-backdrop { + position: absolute; + inset: 0; + background: rgba(8, 9, 11, 0.55); + -webkit-backdrop-filter: blur(6px); + backdrop-filter: blur(6px); +} + +/* Panel */ + +.pl-panel { + position: relative; + display: flex; + flex-direction: column; + width: min(660px, 100%); + max-height: min(70vh, 560px); + overflow: hidden; + background: rgba(31, 34, 39, 0.9); + -webkit-backdrop-filter: blur(28px) saturate(1.4); + backdrop-filter: blur(28px) saturate(1.4); + border: 1px solid rgba(237, 234, 227, 0.1); + border-radius: 14px; + box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(0, 0, 0, 0.6); +} + +@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { + .pl-panel { background: #1F2227; } +} + +/* Search field: big and quiet, like the one on macOS */ + +.pl-field { + display: flex; + align-items: center; + gap: 14px; + padding: 16px 20px; +} + +.pl-glass { + flex: none; + color: var(--muted); + font-size: 18px; +} + +#palette input.pl-input { + flex: 1; + width: 100%; + height: auto; + margin: 0; + padding: 0; + background: transparent; + border: 0; + border-radius: 0; + box-shadow: none; + outline: none; + color: var(--color-font1); + font-family: inherit; + font-size: 20px; + font-weight: 400; + line-height: 1.3; +} + +#palette input.pl-input::placeholder { color: var(--muted); opacity: 1; } + +/* Results */ + +.pl-list { + flex: 1 1 auto; + min-height: 0; + margin: 0; + padding: 6px 8px 8px; + list-style: none; + overflow-y: auto; + overscroll-behavior: contain; + border-top: 1px solid var(--line); +} + +.pl-group { + padding: 10px 12px 4px; + color: var(--muted); + font-size: 12px; + font-weight: 600; +} + +.pl-group:first-child { padding-top: 6px; } + +.pl-item { + display: flex; + align-items: center; + gap: 12px; + padding: 7px 10px; + border-radius: 9px; + color: var(--color-font1); + cursor: pointer; +} + +.pl-icon { + flex: none; + display: grid; + place-items: center; + width: 30px; + height: 30px; + border-radius: 8px; + background: var(--accent-soft); + color: var(--accent-hover); + font-size: 14px; +} + +.pl-text { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + gap: 1px; +} + +.pl-title { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + font-size: 15px; + line-height: 1.3; +} + +.pl-title b { font-weight: 700; } + +.pl-sub { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + color: var(--muted); + font-size: 12.5px; + line-height: 1.3; +} + +.pl-ext { + flex: none; + color: var(--muted); + font-size: 11px; +} + +/* A test's verdict */ + +.pl-chip { + flex: none; + padding: 2px 9px; + border-radius: 999px; + background: rgba(237, 234, 227, 0.08); + color: var(--color-font2); + font-size: 11.5px; + font-weight: 600; +} + +.pl-chip[data-state="passed"] { background: rgba(110, 219, 154, 0.14); color: var(--ok); } +.pl-chip[data-state="failed"] { background: rgba(239, 123, 114, 0.14); color: var(--bad); } +.pl-chip[data-state="running"] { background: var(--accent-soft); color: var(--accent-hover); } +.pl-chip[data-state="pending"], +.pl-chip[data-state="awaiting"] { background: rgba(233, 178, 76, 0.14); color: var(--warn); } +.pl-chip[data-state="stopped"] { + background-image: repeating-linear-gradient(135deg, transparent 0, transparent 4px, rgba(237, 234, 227, 0.14) 4px, rgba(237, 234, 227, 0.14) 5.5px); +} + +.pl-enter { + display: none; + flex: none; + margin-left: 2px; + font-family: inherit; + font-size: 14px; + opacity: 0.9; +} + +/* The row Enter would open: filled like a selection on macOS */ + +.pl-item[aria-selected="true"] { + background: var(--accent); + color: #fff; +} + +.pl-item[aria-selected="true"] .pl-icon { background: rgba(255, 255, 255, 0.18); color: #fff; } +.pl-item[aria-selected="true"] .pl-sub, +.pl-item[aria-selected="true"] .pl-ext { color: rgba(255, 255, 255, 0.95); } +.pl-item[aria-selected="true"] .pl-chip { background: rgba(255, 255, 255, 0.2); background-image: none; color: #fff; } +.pl-item[aria-selected="true"] .pl-enter { display: block; } + +/* Footer with the keys */ + +.pl-foot { + display: flex; + gap: 18px; + padding: 9px 16px; + border-top: 1px solid var(--line); + color: var(--muted); + font-size: 12px; +} + +.pl-foot kbd { + display: inline-grid; + place-items: center; + min-width: 20px; + height: 20px; + margin-right: 6px; + padding: 0 5px; + border: 1px solid var(--line); + border-radius: 5px; + background: rgba(237, 234, 227, 0.08); + color: var(--color-font2); + font: 500 11px/1 inherit; +} + +.pl-foot kbd + kbd { margin-left: -2px; } + +.pl-sr { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip: rect(0 0 0 0); + white-space: nowrap; +} + +/* Motion: only when the palette is opened, and never for people who ask for less */ + +@keyframes pl-panel-in { + from { opacity: 0; transform: translateY(-8px) scale(0.985); } + to { opacity: 1; transform: none; } +} + +@keyframes pl-fade-in { + from { opacity: 0; } + to { opacity: 1; } +} + +#palette.is-open .pl-panel { animation: pl-panel-in 0.16s cubic-bezier(0.2, 0.8, 0.2, 1); } +#palette.is-open .pl-backdrop { animation: pl-fade-in 0.16s ease-out; } + +@media (prefers-reduced-motion: reduce) { + #palette.is-open .pl-panel, + #palette.is-open .pl-backdrop { animation: none; } +} + +@media (max-width: 640px) { + #palette { padding-top: 8vh; } + #palette input.pl-input { font-size: 17px; } + .pl-foot { display: none; } +} From d2827ee8f3b34b78ac06d8248aa24799778c9841 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 17:28:19 +0200 Subject: [PATCH 14/22] Quick search: fix font fallbacks --- OpenBench/static/palette.css | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenBench/static/palette.css b/OpenBench/static/palette.css index 58bcedb..8aa3cd8 100644 --- a/OpenBench/static/palette.css +++ b/OpenBench/static/palette.css @@ -13,7 +13,7 @@ html.palette-open { overflow: hidden; } border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); - font-family: var(--font-mono); + font-family: var(--font-mono, ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace); font-size: 11px; line-height: 1.5; } @@ -242,7 +242,10 @@ html.palette-open { overflow: hidden; } border-radius: 5px; background: rgba(237, 234, 227, 0.08); color: var(--color-font2); - font: 500 11px/1 inherit; + font-family: var(--font-sans); + font-size: 11px; + font-weight: 500; + line-height: 1; } .pl-foot kbd + kbd { margin-left: -2px; } From 26a0394ca9df1c1d3b5528ecdbc31ab46d08b33c Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 17:28:50 +0200 Subject: [PATCH 15/22] Quick search: palette behaviour --- OpenBench/static/palette.js | 462 ++++++++++++++++++++++++++++++++++++ 1 file changed, 462 insertions(+) create mode 100644 OpenBench/static/palette.js diff --git a/OpenBench/static/palette.js b/OpenBench/static/palette.js new file mode 100644 index 0000000..96b1e74 --- /dev/null +++ b/OpenBench/static/palette.js @@ -0,0 +1,462 @@ +/* OpenBench quick search: a Spotlight-style palette. + Opens with Ctrl+K or Cmd+K ( and with / outside of text fields ). + No dependencies. Without this file the Search button still opens /search. */ + +(function () { + 'use strict'; + + var root = document.getElementById('palette'); + var source = document.getElementById('palette-source'); + if (!root || !source) return; + + var input = root.querySelector('.pl-input'); + var list = root.querySelector('.pl-list'); + var status = root.querySelector('.pl-sr'); + var form = document.getElementById('palette-search'); + var trigger = document.getElementById('palette-open'); + + var isMac = /Mac|iPhone|iPad|iPod/i.test(navigator.platform || navigator.userAgent || ''); + + var STATES = { + passed: 'Passed', failed: 'Failed', stopped: 'Stopped', running: 'Running', + pending: 'Pending', awaiting: 'Awaiting', deleted: 'Deleted' + }; + + /* Pages and actions come from the server, so they follow the login state */ + + var pages = Array.prototype.map.call(source.querySelectorAll('li'), function (li) { + return { + kind : 'link', + key : 'page:' + li.getAttribute('data-href'), + title : li.textContent.trim(), + href : li.getAttribute('data-href'), + icon : li.getAttribute('data-icon') || 'fa-arrow-right', + group : li.getAttribute('data-group') || 'Go to', + keywords : (li.getAttribute('data-keywords') || '').toLowerCase(), + featured : li.hasAttribute('data-featured'), + external : li.hasAttribute('data-external') + }; + }); + + var rows = []; // what is on screen: { item, el } + var active = -1; + var moved = false; // the person has picked a row themselves + var returnTo = null; + var cache = {}; // query -> tests from the server + var lastTests = []; // the latest answer, shown while the next one loads + var inflight = null; // { timer, controller } + + /* ---------- Matching ---------- */ + + function match(text, query) { + + if (!query) return { score: 0, hits: [] }; + + var t = text.toLowerCase(), q = query.toLowerCase(); + var at = t.indexOf(q), hits = [], i; + + if (at !== -1) { + for (i = 0; i < q.length; i++) hits.push(at + i); + var boundary = at === 0 || /[\s\-_\/.]/.test(t.charAt(at - 1)); + return { score: (at === 0 ? 120 : boundary ? 100 : 70) - Math.min(at, 30), hits: hits }; + } + + // The letters in order, so that "mch" still finds "Machines" + var from = 0, gaps = 0; + for (i = 0; i < q.length; i++) { + var found = t.indexOf(q.charAt(i), from); + if (found === -1) return null; + if (hits.length && found !== hits[hits.length - 1] + 1) gaps++; + hits.push(found); + from = found + 1; + } + return { score: Math.max(10, 50 - gaps * 8), hits: hits }; + } + + function liveTests(q) { + + if (cache[q]) return cache[q]; + + // Until the answer for this exact query arrives, keep what still fits + var needle = q.toLowerCase(); + return lastTests.filter(function (t) { + return (t.name + ' ' + t.author + ' ' + t.engine + ' ' + t.id).toLowerCase().indexOf(needle) !== -1; + }); + } + + /* ---------- What to show ---------- */ + + function buildGroups(q) { + + var groups = [], i; + + // Tests: a direct jump for numbers, then whatever the server found + var tests = liveTests(q).map(function (t) { + var m = match(t.name, q); + return { + kind: 'link', key: 'test:' + t.id, href: t.url, icon: 'fa-flask', + title: t.name, hits: m ? m.hits : [], state: t.status, + sub: '#' + t.id + ' by ' + t.author + ', ' + t.tc + }; + }); + + var number = /^#?(\d{1,9})$/.exec(q); + if (number && !tests.some(function (t) { return t.key === 'test:' + number[1]; })) { + tests.unshift({ + kind: 'link', key: 'test:' + number[1], href: '/test/' + number[1] + '/', icon: 'fa-flask', + title: 'Open test #' + number[1], sub: 'Jump straight to it', hits: [] + }); + } + + // Pages and actions, grouped as on the server, best group first + var buckets = [], byName = {}; + pages.forEach(function (page) { + + var m = null; + if (!q) { if (!page.featured) return; m = { score: 0, hits: [] }; } + else { + m = match(page.title, q); + if (!m && page.keywords.indexOf(q.toLowerCase()) !== -1) m = { score: 35, hits: [] }; + } + if (!m) return; + + var bucket = byName[page.group]; + if (!bucket) { bucket = byName[page.group] = { label: page.group, best: 0, items: [] }; buckets.push(bucket); } + + bucket.best = Math.max(bucket.best, m.score); + bucket.items.push({ item: page, score: m.score, hits: m.hits }); + }); + + var best = 0; + if (q) buckets.sort(function (a, b) { return b.best - a.best; }); + buckets.forEach(function (bucket) { + if (q) bucket.items.sort(function (a, b) { return b.score - a.score; }); + best = Math.max(best, bucket.best); + }); + + var pageGroups = buckets.map(function (bucket) { + return { + label: bucket.label, + items: bucket.items.map(function (entry) { + var item = Object.create(entry.item); + item.hits = entry.hits; + return item; + }) + }; + }); + + var testGroup = tests.length ? [{ label: 'Tests', items: tests }] : []; + + // A page that starts with what was typed wins, otherwise tests come first + groups = (q && best < 100) ? testGroup.concat(pageGroups) : pageGroups.concat(testGroup); + + if (q) { + groups.push({ label: 'Search', items: [{ + kind: 'search', key: 'search', icon: 'fa-magnifying-glass', hits: [], + title: 'Search all tests for \u201C' + q + '\u201D', sub: 'Looks through every branch name' + }] }); + } + + return groups; + } + + /* ---------- Drawing ---------- */ + + function fill(el, text, hits) { + + if (!hits || !hits.length) { el.textContent = text; return; } + + var marked = {}, run = '', on = false, i; + hits.forEach(function (h) { marked[h] = true; }); + + function flush() { + if (!run) return; + if (on) { var b = document.createElement('b'); b.textContent = run; el.appendChild(b); } + else el.appendChild(document.createTextNode(run)); + run = ''; + } + + for (i = 0; i < text.length; i++) { + var hit = !!marked[i]; + if (hit !== on) { flush(); on = hit; } + run += text.charAt(i); + } + flush(); + } + + function element(tag, className, text) { + var el = document.createElement(tag); + if (className) el.className = className; + if (text) el.textContent = text; + return el; + } + + function buildRow(item, index) { + + var li = element('li', 'pl-item'); + li.id = 'pl-opt-' + index; + li.setAttribute('role', 'option'); + li.setAttribute('aria-selected', 'false'); + li.setAttribute('data-index', index); + + var tile = element('span', 'pl-icon'); + var icon = element('i', 'fa-solid ' + item.icon); + icon.setAttribute('aria-hidden', 'true'); + tile.appendChild(icon); + + var text = element('span', 'pl-text'); + var title = element('span', 'pl-title'); + fill(title, item.title, item.hits); + text.appendChild(title); + if (item.sub) text.appendChild(element('span', 'pl-sub', item.sub)); + + li.appendChild(tile); + li.appendChild(text); + + if (item.state) { + var chip = element('span', 'pl-chip', STATES[item.state] || item.state); + chip.setAttribute('data-state', item.state); + li.appendChild(chip); + } + + if (item.external) { + var out = element('i', 'fa-solid fa-arrow-up-right-from-square pl-ext'); + out.setAttribute('aria-hidden', 'true'); + li.appendChild(out); + } + + var enter = element('kbd', 'pl-enter', '\u21B5'); + enter.setAttribute('aria-hidden', 'true'); + li.appendChild(enter); + + return li; + } + + function setActive(index, scroll) { + + if (rows[active]) rows[active].el.setAttribute('aria-selected', 'false'); + active = index; + + if (!rows[index]) { input.removeAttribute('aria-activedescendant'); return; } + + rows[index].el.setAttribute('aria-selected', 'true'); + input.setAttribute('aria-activedescendant', rows[index].el.id); + + if (!scroll) return; + if (index === 0) list.scrollTop = 0; + else rows[index].el.scrollIntoView({ block: 'nearest' }); + } + + function render() { + + var q = input.value.trim(); + var keep = moved && rows[active] ? rows[active].item.key : null; + + list.textContent = ''; + rows = []; + + buildGroups(q).forEach(function (group) { + var head = element('li', 'pl-group', group.label); + head.setAttribute('role', 'presentation'); + list.appendChild(head); + + group.items.forEach(function (item) { + var el = buildRow(item, rows.length); + list.appendChild(el); + rows.push({ item: item, el: el }); + }); + }); + + var next = 0; + rows.forEach(function (row, i) { if (keep && row.item.key === keep) next = i; }); + + active = -1; + setActive(rows.length ? next : -1, false); + status.textContent = rows.length + (rows.length === 1 ? ' result' : ' results'); + } + + /* ---------- Asking the server for tests ---------- */ + + function cancel() { + if (!inflight) return; + if (inflight.timer) clearTimeout(inflight.timer); + if (inflight.controller) inflight.controller.abort(); + inflight = null; + } + + function request(q) { + + var controller = window.AbortController ? new AbortController() : null; + inflight = { timer: null, controller: controller }; + + fetch('/api/quick-search/?q=' + encodeURIComponent(q), { + credentials : 'same-origin', + headers : { 'Accept': 'application/json' }, + signal : controller ? controller.signal : undefined + }) + .then(function (response) { return response.ok ? response.json() : { tests: [] }; }) + .then(function (data) { + cache[q] = data.tests || []; + lastTests = cache[q]; + if (input.value.trim() === q) render(); + }) + .catch(function () { /* aborted, or offline: pages still work */ }); + } + + function schedule() { + + cancel(); + + var q = input.value.trim(); + if (!q || cache[q]) return; + + inflight = { timer: setTimeout(function () { request(q); }, 140), controller: null }; + } + + /* ---------- Opening, closing, choosing ---------- */ + + function isOpen() { return !root.hidden; } + + function open() { + + if (isOpen()) return; + + returnTo = document.activeElement; + root.hidden = false; + + root.classList.remove('is-open'); + void root.offsetWidth; // restart the entrance animation + root.classList.add('is-open'); + + document.documentElement.classList.add('palette-open'); + if (trigger) trigger.setAttribute('aria-expanded', 'true'); + + input.value = ''; + moved = false; + render(); + input.focus(); + } + + function close() { + + if (!isOpen()) return; + + cancel(); + root.hidden = true; + root.classList.remove('is-open'); + document.documentElement.classList.remove('palette-open'); + if (trigger) trigger.setAttribute('aria-expanded', 'false'); + + if (returnTo && returnTo.focus && document.contains(returnTo)) returnTo.focus(); + } + + function choose(item, newTab) { + + if (item.kind === 'search') { + form.querySelector('[name="keywords"]').value = input.value.trim(); + form.submit(); + return; + } + + if (item.external || newTab) { + window.open(item.href, '_blank', 'noopener'); + close(); + return; + } + + window.location.href = item.href; + close(); + } + + function move(step) { + if (!rows.length) return; + moved = true; + setActive((active + step + rows.length) % rows.length, true); + } + + /* ---------- Events ---------- */ + + input.addEventListener('input', function () { + moved = false; + render(); + schedule(); + }); + + input.addEventListener('keydown', function (event) { + + if (event.isComposing) return; + + if (event.key === 'ArrowDown') { event.preventDefault(); move(1); } + else if (event.key === 'ArrowUp') { event.preventDefault(); move(-1); } + else if (event.key === 'Tab') { event.preventDefault(); move(event.shiftKey ? -1 : 1); } + else if (event.key === 'Enter') { + event.preventDefault(); + if (rows[active]) choose(rows[active].item, event.metaKey || event.ctrlKey); + } + else if (event.key === 'Escape') { event.preventDefault(); close(); } + }); + + // Keep the caret in the field while the pointer works on the list + list.addEventListener('mousedown', function (event) { event.preventDefault(); }); + + list.addEventListener('mousemove', function (event) { + var li = event.target.closest ? event.target.closest('.pl-item') : null; + if (!li) return; + var index = parseInt(li.getAttribute('data-index'), 10); + if (index !== active) { moved = true; setActive(index, false); } + }); + + list.addEventListener('click', function (event) { + var li = event.target.closest ? event.target.closest('.pl-item') : null; + if (!li) return; + var row = rows[parseInt(li.getAttribute('data-index'), 10)]; + if (row) choose(row.item, event.metaKey || event.ctrlKey); + }); + + root.querySelector('.pl-backdrop').addEventListener('click', close); + + // Nothing behind the palette should take the focus + root.addEventListener('focusin', function (event) { + if (!root.querySelector('.pl-panel').contains(event.target)) input.focus(); + }); + + function typing(target) { + if (!target || !target.tagName) return false; + return /^(INPUT|TEXTAREA|SELECT)$/.test(target.tagName) || target.isContentEditable; + } + + document.addEventListener('keydown', function (event) { + + var key = (event.key || '').toLowerCase(); + + if ((event.metaKey || event.ctrlKey) && !event.altKey && !event.shiftKey && key === 'k') { + event.preventDefault(); + if (isOpen()) close(); else open(); + return; + } + + if (key === '/' && !event.metaKey && !event.ctrlKey && !event.altKey && !isOpen() && !typing(event.target)) { + event.preventDefault(); + open(); + } + }, true); + + if (trigger) { + trigger.setAttribute('aria-haspopup', 'dialog'); + trigger.setAttribute('aria-expanded', 'false'); + + trigger.addEventListener('click', function (event) { + if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey) return; + event.preventDefault(); + open(); + }); + } + + // Coming back with the Back button should never show an open palette + window.addEventListener('pageshow', function (event) { if (event.persisted) close(); }); + + Array.prototype.forEach.call(document.querySelectorAll('.topbar-kbd'), function (hint) { + hint.textContent = isMac ? '\u2318K' : 'Ctrl K'; + }); + +})(); From 5793204b1bf3272fab2364c4c1e251759d159597 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 11 Oct 2026 17:29:20 +0200 Subject: [PATCH 16/22] Quick search: Ctrl+K palette, live test endpoint and wiring --- OpenBench/urls.py | 1 + OpenBench/views.py | 35 +++++++++++++++++++++++++++++++++++ Templates/OpenBench/base.html | 8 ++++++-- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/OpenBench/urls.py b/OpenBench/urls.py index a096e78..764d856 100644 --- a/OpenBench/urls.py +++ b/OpenBench/urls.py @@ -94,6 +94,7 @@ urlpatterns = [ django.urls.path(r'api/buildinfo/', OpenBench.views.api_build_info), django.urls.path(r'api/pgns//', OpenBench.views.api_pgns), django.urls.path(r'api/test//llr-history/', OpenBench.views.test_llr_history), + django.urls.path(r'api/quick-search/', OpenBench.views.api_quick_search), # Redirect anything else to the Index django.urls.path(r'', OpenBench.views.index), diff --git a/OpenBench/views.py b/OpenBench/views.py index 5299493..47aed4a 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -585,6 +585,41 @@ def test_llr_history(request, id): return HttpResponse(str(llr_history_graph(test)), content_type='text/plain; charset=utf-8') +def api_quick_search(request): + + ## Feeds the Ctrl+K palette: up to eight workloads that match a branch name, + ## an author, an engine, or a workload id, newest first. + + if OPENBENCH_CONFIG['require_login_to_view'] and not request.user.is_authenticated: + return JsonResponse({ 'tests' : [] }, status=403) + + from OpenBench.templatetags.mytags import prettyName, workload_url + from OpenBench.templatetags.uitags import test_status + + query = request.GET.get('q', '').strip().lstrip('#')[:64] + if not query: + return JsonResponse({ 'tests' : [] }) + + match = Q(dev__name__icontains=query) | Q(author__icontains=query) | Q(dev_engine__icontains=query) + if query.isdigit() and len(query) <= 9: + match |= Q(id=int(query)) + + found = list(Test.objects.select_related('dev').filter(match).exclude(deleted=True).order_by('-id')[:8]) + + # An exact workload id is always the first hit + if query.isdigit(): + found.sort(key=lambda test: str(test.id) != query) + + return JsonResponse({ 'tests' : [{ + 'id' : test.id, + 'name' : prettyName(test.dev.name), + 'author' : test.author.capitalize(), + 'engine' : test.dev_engine, + 'tc' : test.dev_time_control, + 'status' : test_status(test), + 'url' : workload_url(test), + } for test in found] }) + def create_test(request): return create_workload(request, 'TEST') diff --git a/Templates/OpenBench/base.html b/Templates/OpenBench/base.html index 57909af..74a5c34 100644 --- a/Templates/OpenBench/base.html +++ b/Templates/OpenBench/base.html @@ -18,6 +18,7 @@ + @@ -32,6 +33,7 @@ + +