Merge pull request 'Design refresh: new theme, Ctrl+K quick search, live updates' (#11) from design-refresh into master

This commit was merged in pull request #11.
This commit is contained in:
claude committed 2026-10-11 17:52:35 +02:00
commit 4fffbf50b4
14 files changed
+1641 -20

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
/* ==========================================================================
Live updates. Loaded after refresh.css, and uses its tokens.
========================================================================== */
/* The small status pill in the corner: a pulse while updates are on */
.live-pill {
position: fixed;
right: 16px;
bottom: 16px;
z-index: 40;
display: inline-flex;
align-items: center;
gap: 8px;
padding: 6px 12px 6px 10px;
border: 1px solid var(--line-strong);
border-radius: 999px;
background: rgba(26, 29, 34, 0.92);
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
color: var(--color-font2);
font-family: var(--font-sans);
font-size: 12.5px;
font-weight: 500;
line-height: 1;
cursor: pointer;
}
.live-pill[hidden] { display: none; }
.live-pill:hover {
border-color: var(--muted);
color: var(--color-font1);
}
.live-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--ok);
animation: live-pulse 2.4s ease-out infinite;
}
.live-pill[data-state="paused"] .live-dot { background: var(--muted); animation: none; }
.live-pill[data-state="retry"] .live-dot { background: var(--warn); animation: none; }
@keyframes live-pulse {
0% { box-shadow: 0 0 0 0 rgba(110, 219, 154, 0.45); }
70%, 100% { box-shadow: 0 0 0 7px rgba(110, 219, 154, 0); }
}
/* Whatever just changed gets a brief outline that fades away */
.live-flash { animation: live-flash 1.4s ease-out; }
@keyframes live-flash {
0% { outline: 2px solid rgba(110, 219, 154, 0.65); outline-offset: -2px; }
100% { outline: 2px solid rgba(110, 219, 154, 0); outline-offset: -2px; }
}
@media (prefers-reduced-motion: reduce) {
.live-dot,
.live-flash { animation: none; }
}
@media (max-width: 640px) {
.live-pill { right: 10px; bottom: 10px; }
}
+319
View File
@@ -0,0 +1,319 @@
/* OpenBench live updates: the pages keep themselves current.
Every few seconds the page asks the server for its own HTML, and only the
parts that changed are swapped in. Scroll position, text selection, open
forms and the LLR history graph are left alone. Polling pauses in a hidden
tab, backs off when the server is unreachable, and can be switched off with
the pill in the corner. No dependencies, and the pages work without it. */
(function () {
'use strict';
var PAGES = /^\/(?:(?:index|greens|machines|events|errors)(?:\/\d+)?|user\/[^\/]+(?:\/\d+)?|(?:test|tune|datagen)\/\d+)?\/?$/;
if (!PAGES.test(window.location.pathname)) return;
var content = document.getElementById('content');
if (!content || !window.fetch || !window.DOMParser) return;
var FULL = { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false };
var DAY = { month: 'short', day: '2-digit' };
// Never replaced: forms keep what is typed, banners can be dismissed, the graph loads itself
var PROTECT = 'form, .banner, .llr-history-panel, [data-live-skip], script, style';
// Attributes that other scripts add after the page loads
var KEEP = { 'data-href': true, 'data-epoch': true };
/* ---------- Timestamps ----------
The pages print raw epochs and the browser formats them. Remember the
epoch before that happens, so that two versions can be compared. */
function stash(root) {
Array.prototype.forEach.call(root.querySelectorAll('.timestamp, .datestamp'), function (el) {
var text = el.textContent.trim();
if (!el.hasAttribute('data-epoch') && /^\d+(\.\d+)?$/.test(text)) el.setAttribute('data-epoch', text);
});
}
function formatStamp(el) {
var epoch = parseFloat(el.getAttribute('data-epoch'));
if (isNaN(epoch)) return;
el.textContent = new Date(1000 * epoch).toLocaleString(undefined, el.classList.contains('datestamp') ? DAY : FULL);
}
function isStamp(el) {
return el.classList.contains('timestamp') || el.classList.contains('datestamp');
}
stash(content);
/* ---------- Patching ---------- */
function flash(el) {
if (!el || el.nodeType !== 1) return;
el.classList.remove('live-flash');
void el.offsetWidth;
el.classList.add('live-flash');
setTimeout(function () { el.classList.remove('live-flash'); }, 1500);
}
function protectedNode(node) {
return node.nodeType === 1 && node.matches(PROTECT);
}
function kids(el) {
return Array.prototype.filter.call(el.childNodes, function (child) {
if (child.nodeType === 3) return child.nodeValue.trim() !== '';
return child.nodeType === 1 && !protectedNode(child);
});
}
function same(a, b) {
if (a.nodeType !== b.nodeType) return false;
return a.nodeType !== 1 || a.tagName === b.tagName;
}
function syncAttributes(o, n) {
var i, attr;
for (i = 0; i < n.attributes.length; i++) {
attr = n.attributes[i];
if (attr.name === 'class') continue;
if (o.getAttribute(attr.name) !== attr.value) o.setAttribute(attr.name, attr.value);
}
for (i = o.attributes.length - 1; i >= 0; i--) {
attr = o.attributes[i];
if (attr.name === 'class' || KEEP[attr.name]) continue;
if (!n.hasAttribute(attr.name)) o.removeAttribute(attr.name);
}
// Classes come from the server, except the highlight this script adds
var wanted = (n.getAttribute('class') || '') + (o.classList.contains('live-flash') ? ' live-flash' : '');
if ((o.getAttribute('class') || '') !== wanted) {
if (wanted.trim()) o.setAttribute('class', wanted);
else o.removeAttribute('class');
}
}
function patchNode(o, n) {
if (o.nodeType === 3) {
if (o.nodeValue !== n.nodeValue) {
o.nodeValue = n.nodeValue;
flash(o.parentNode);
}
return;
}
if (o.nodeType !== 1 || protectedNode(o)) return;
if (isStamp(o)) {
if (o.getAttribute('data-epoch') !== n.getAttribute('data-epoch')) {
var fresh = document.importNode(n, true);
formatStamp(fresh);
o.parentNode.replaceChild(fresh, o);
flash(fresh);
}
return;
}
syncAttributes(o, n);
patchChildren(o, n);
}
/* Children are matched from both ends, and only what is left in the
middle is replaced. A row that appears, or a button that disappears,
leaves the rest of its parent untouched. */
function patchChildren(oldEl, newEl) {
var o = kids(oldEl), n = kids(newEl);
var start = 0, oe = o.length, ne = n.length, i;
while (start < oe && start < ne && same(o[start], n[start])) {
patchNode(o[start], n[start]);
start++;
}
while (oe > start && ne > start && same(o[oe - 1], n[ne - 1])) {
oe--; ne--;
patchNode(o[oe], n[ne]);
}
if (start === oe && start === ne) return;
var before = o[oe] || null;
for (i = start; i < oe; i++) oldEl.removeChild(o[i]);
for (i = start; i < ne; i++) {
var node = document.importNode(n[i], true);
if (node.nodeType === 1) {
Array.prototype.forEach.call(node.querySelectorAll('.timestamp, .datestamp'), formatStamp);
if (isStamp(node)) formatStamp(node);
}
oldEl.insertBefore(node, before);
flash(node.nodeType === 1 ? node : oldEl);
}
}
// ux.js makes whole rows clickable once, when the page loads
function restoreRows() {
Array.prototype.forEach.call(content.querySelectorAll('table.test-list tbody tr'), function (row) {
var link = row.querySelector('.col-test a');
if (link && !row.getAttribute('data-href')) row.setAttribute('data-href', link.getAttribute('href'));
});
}
function apply(html) {
var doc = new DOMParser().parseFromString(html, 'text/html');
var fresh = doc.getElementById('content');
if (!fresh) return false;
stash(fresh);
patchChildren(content, fresh);
restoreRows();
return true;
}
/* ---------- The indicator ---------- */
var pill = document.createElement('button');
pill.type = 'button';
pill.id = 'live-indicator';
pill.className = 'live-pill';
pill.innerHTML = '<span class="live-dot" aria-hidden="true"></span><span class="live-text">Live</span>';
document.body.appendChild(pill);
var enabled = true;
try { enabled = window.localStorage.getItem('ob:live') !== 'off'; } catch (error) { /* storage unavailable */ }
var timer = null, busy = false, failures = 0, last = Date.now(), dead = false;
function setState(state) {
var label = { live: 'Live', paused: 'Paused', retry: 'Reconnecting' }[state];
pill.setAttribute('data-state', state);
pill.setAttribute('aria-pressed', String(enabled));
pill.querySelector('.live-text').textContent = label;
pill.title = state === 'paused'
? 'Automatic updates are off. Click to turn them on.'
: 'Updated ' + new Date(last).toLocaleTimeString() + '. Click to pause.';
}
/* ---------- Polling ---------- */
function running() {
return !!document.querySelector('.page-head .fa-spin');
}
function interval() {
var path = window.location.pathname, base = 10000;
if (/^\/(test|tune|datagen)\//.test(path)) base = document.querySelector('.page-head .fa-spin') ? 8000 : 45000;
else if (/^\/(events|errors)/.test(path)) base = 20000;
return base * Math.pow(2, Math.min(failures, 3));
}
// Leave the page alone while somebody is reading, selecting or typing
function occupied() {
var selection = window.getSelection && window.getSelection();
if (selection && !selection.isCollapsed && selection.anchorNode && content.contains(selection.anchorNode)) return true;
var focused = document.activeElement;
if (focused && content.contains(focused) && /^(INPUT|TEXTAREA|SELECT)$/.test(focused.tagName)) return true;
var palette = document.getElementById('palette');
return !!(palette && !palette.hidden);
}
function schedule(delay) {
clearTimeout(timer);
if (!enabled || dead || document.hidden) return;
timer = setTimeout(tick, delay === undefined ? interval() : delay);
}
function tick() {
if (document.hidden) return;
if (occupied()) { schedule(3000); return; }
poll();
}
function strip(path) { return path.replace(/\/+$/, ''); }
function poll() {
if (busy) return;
busy = true;
var path = window.location.pathname;
fetch(window.location.pathname + window.location.search, {
credentials : 'same-origin',
cache : 'no-store',
headers : { 'Accept': 'text/html' }
})
.then(function (response) {
// Sent somewhere else ( a login page, or another kind of workload ): stop quietly
if (response.redirected && strip(new URL(response.url).pathname) !== strip(path)) {
dead = true;
throw new Error('moved');
}
if (!response.ok) throw new Error('status ' + response.status);
return response.text();
})
.then(function (html) {
// A test that has just finished still has a last data point to draw
var wasRunning = running();
if (!apply(html)) throw new Error('no content');
if (window.refreshLLRHistory && (wasRunning || running())) window.refreshLLRHistory();
failures = 0;
last = Date.now();
setState('live');
})
.catch(function () {
failures++;
if (dead) pill.hidden = true;
else setState('retry');
})
.then(function () {
busy = false;
schedule();
});
}
pill.addEventListener('click', function () {
enabled = !enabled;
try { window.localStorage.setItem('ob:live', enabled ? 'on' : 'off'); } catch (error) { /* ignore */ }
if (enabled) { setState('live'); poll(); }
else { clearTimeout(timer); setState('paused'); }
});
document.addEventListener('visibilitychange', function () {
if (document.hidden) { clearTimeout(timer); return; }
if (!enabled || dead) return;
// Coming back to the tab: catch up at once, unless it was just done
if (Date.now() - last > 4000) poll();
else schedule();
});
setState(enabled ? 'live' : 'paused');
schedule();
})();
+52 -1
View File
@@ -269,6 +269,25 @@
this.setActive(this.active);
};
/* Live updates: take a newer answer from the server and redraw in place.
The plot, and whichever point is being inspected, stay where they are. */
Graph.prototype.update = function (data) {
this.lower = Number(data.lower);
this.upper = Number(data.upper);
this.games = Number(data.games);
this.points = data.history.map(function (p) {
return { games: Number(p[0]), llr: Number(p[1]), estimated: !!p[2] };
}).sort(function (a, b) { return a.games - b.games; });
if (this.active >= this.points.length)
this.active = -1;
this.render();
};
/* ---------- snapping ---------- */
Graph.prototype.pick = function (x) {
@@ -417,13 +436,45 @@
if (!node)
return showError(container, 'No history to show yet.');
new Graph(node, JSON.parse(node.getAttribute('data-chart')));
graph = new Graph(node, JSON.parse(node.getAttribute('data-chart')));
}).catch(function () {
showError(container, 'Unable to load history graph.');
});
}
var graph = null;
function refresh(container) {
var url = container.getAttribute('data-history-url');
if (!url || !graph)
return Promise.resolve();
return fetch(url, { credentials: 'same-origin', cache: 'no-store' }).then(function (response) {
if (!response.ok)
throw new Error('Unable to refresh history graph');
return response.text();
}).then(function (markup) {
var holder = document.createElement('div');
holder.innerHTML = markup;
var node = holder.querySelector('.llr-chart');
if (node)
graph.update(JSON.parse(node.getAttribute('data-chart')));
});
}
// Called by live.js whenever the page has been brought up to date
window.refreshLLRHistory = function () {
var container = document.getElementById('llr-history-container');
return container ? refresh(container).catch(function () { /* keep the current graph */ }) : Promise.resolve();
};
document.addEventListener('DOMContentLoaded', function () {
var container = document.getElementById('llr-history-container');
if (container)
+286
View File
@@ -0,0 +1,286 @@
/* ==========================================================================
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, ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace);
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-family: var(--font-sans);
font-size: 11px;
font-weight: 500;
line-height: 1;
}
.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; }
}
+462
View File
@@ -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';
});
})();
+290
View File
@@ -0,0 +1,290 @@
/* ==========================================================================
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 <link> 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;
}
/* ==========================================================================
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;
}
#content td.col-author a {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
+21 -1
View File
@@ -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)
+1
View File
@@ -94,6 +94,7 @@ urlpatterns = [
django.urls.path(r'api/buildinfo/', OpenBench.views.api_build_info),
django.urls.path(r'api/pgns/<int:pgn_id>/', OpenBench.views.api_pgns),
django.urls.path(r'api/test/<int:id>/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),
+35
View File
@@ -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
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' : '/%s/%d/' % ('tune' if test.test_mode == 'SPSA' else 'test', test.id),
} for test in found] })
def create_test(request):
return create_workload(request, 'TEST')
+82
View File
@@ -0,0 +1,82 @@
<!-- Quick search palette ( Ctrl+K ). Driven by palette.js, styled by palette.css.
Without JavaScript the Search button in the top bar still opens /search. -->
<div id="palette" role="dialog" aria-modal="true" aria-label="Quick search" hidden>
<div class="pl-backdrop"></div>
<div class="pl-panel">
<div class="pl-field">
<i class="fa-solid fa-magnifying-glass pl-glass" aria-hidden="true"></i>
<input class="pl-input" type="text" role="combobox" aria-expanded="true" aria-controls="pl-list"
aria-autocomplete="list" aria-label="Search" autocomplete="off" autocapitalize="off"
spellcheck="false" enterkeyhint="go" placeholder="Search tests, pages and actions">
</div>
<ul class="pl-list" id="pl-list" role="listbox" aria-label="Results"></ul>
<div class="pl-foot" aria-hidden="true">
<span><kbd>&uarr;</kbd><kbd>&darr;</kbd>move</span>
<span><kbd>&crarr;</kbd>open</span>
<span><kbd>esc</kbd>close</span>
</div>
<div class="pl-sr" aria-live="polite"></div>
</div>
<!-- Pages and actions. Only the featured ones are listed before anything is typed -->
<ul id="palette-source" hidden>
<li data-group="Go to" data-href="/index" data-icon="fa-house" data-keywords="home tests overview" data-featured>Index</li>
<li data-group="Go to" data-href="/greens" data-icon="fa-heart" data-keywords="passed wins" data-featured>Greens</li>
<li data-group="Go to" data-href="/search" data-icon="fa-sliders" data-keywords="filter find tests" data-featured>Advanced search</li>
<li data-group="Go to" data-href="/machines" data-icon="fa-microchip" data-keywords="workers clients fleet" data-featured>Machines</li>
<li data-group="Go to" data-href="/users" data-icon="fa-users" data-keywords="people contributors">Users</li>
<li data-group="Go to" data-href="/events" data-icon="fa-circle-exclamation" data-keywords="log actions">Events</li>
<li data-group="Go to" data-href="/errors" data-icon="fa-triangle-exclamation" data-keywords="crash failures log">Errors</li>
<li data-group="Go to" data-href="/networks" data-icon="fa-circle-nodes" data-keywords="nets nnue">Networks</li>
<li data-group="Create" data-href="/newTest" data-icon="fa-plus" data-keywords="new sprt test" data-featured>Create test</li>
<li data-group="Create" data-href="/newTune" data-icon="fa-vial" data-keywords="new spsa tune" data-featured>Create tune</li>
<li data-group="Create" data-href="/newDatagen" data-icon="fa-database" data-keywords="new data generation">Create datagen</li>
<li data-group="Create" data-href="/newNetwork" data-icon="fa-upload" data-keywords="new network net nnue">Upload net</li>
{% if user.is_authenticated %}
<li data-group="Account" data-href="/profile/" data-icon="fa-user" data-keywords="settings password email">Profile</li>
<li data-group="Account" data-href="/logout/" data-icon="fa-right-from-bracket" data-keywords="sign out">Log out</li>
{% else %}
<li data-group="Account" data-href="/login" data-icon="fa-right-to-bracket" data-keywords="sign in">Log in</li>
<li data-group="Account" data-href="/register" data-icon="fa-registered" data-keywords="sign up account">Register</li>
{% endif %}
<li data-group="Links" data-href="{{config.client_repo_url}}" data-icon="fa-brands fa-github" data-keywords="source client code" data-external>OpenBench on GitHub</li>
{% for engine, data in config.engines.items %}
<li data-group="Links" data-href="{{data.source}}" data-icon="fa-chess-knight" data-keywords="engine source repository" data-external>{{engine}} source</li>
{% endfor %}
</ul>
<!-- Hands a free text search over to the existing /search/ page, with every filter left open -->
<form id="palette-search" method="POST" action="/search/" hidden>
{% csrf_token %}
<input type="hidden" name="keywords" value="">
<input type="hidden" name="author" value="">
<input type="hidden" name="engine" value="">
<input type="hidden" name="opening-book" value="">
<input type="hidden" name="test-mode" value="">
<input type="hidden" name="syzygy-wdl" value="">
<input type="hidden" name="tc-type" value="">
<input type="hidden" name="tc-value-select" value="=">
<input type="hidden" name="tc-value-input" value="">
<input type="hidden" name="threads-select" value="&gt;=">
<input type="hidden" name="threads-input" value="1">
<input type="hidden" name="show-greens" value="">
<input type="hidden" name="show-blues" value="">
<input type="hidden" name="show-yellows" value="">
<input type="hidden" name="show-reds" value="">
<input type="hidden" name="show-stopped" value="">
</form>
</div>
+9 -3
View File
@@ -1,12 +1,18 @@
{% load mytags uitags %}
<td class="col-author"><a href="/user/{{test.author}}">{{test.author|capfirst|slice:":6"}}</a></td>
<td class="col-author"><a href="/user/{{test.author}}" title="{{test.author|capfirst}}">{{test.author|capfirst}}</a></td>
<td class="col-engine">{{test.dev_engine}}</td>
<td class="col-test">
<a href="{{test|workload_url}}">{{test|prettyDevName}}</a>
{% if test.error %}<span class="flag flag-error" title="Crash or illegal move">crash</span>{% endif %}
{% if test|test_is_fischer %}<span class="flag flag-frc" title="Fischer random chess">frc</span>{% endif %}
{% with progress=test|progress_info %}
{% if progress %}
{% if progress.gauge %}
<div class="llr llr-{{ progress.tone }}" role="meter" aria-label="LLR" aria-valuemin="{{ progress.lower }}" aria-valuemax="{{ progress.upper }}" aria-valuenow="{{ progress.llr }}" title="LLR {{ progress.llr }} (bounds {{ progress.lower }} to {{ progress.upper }})">
<span class="llr-fill" style="left: {{ progress.left }}%; width: {{ progress.width }}%"></span>
<span class="llr-zero" style="left: {{ progress.zero }}%"></span>
</div>
<div class="llr-scale"><span>{{ progress.lower }}</span><b>{{ progress.llr }}</b><span>{{ progress.upper }}</span></div>
{% elif progress %}
<div class="ob-progress ob-progress-{{ progress.tone }}" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="{{ progress.pct }}" title="{{ progress.pct }}%"><span style="width: {{ progress.pct }}%"></span></div>
{% endif %}
{% endwith %}
@@ -17,4 +23,4 @@
{% if test|test_is_time_odds %}<span class="flag flag-time" title="Time odds">time odds</span>{% endif %}
{% if test|test_is_smp_odds %}<span class="flag flag-smp" title="Thread odds">thread odds</span>{% endif %}
</td>
<td class='statblock statblock-{{test|testResultColour}} col-result'><strong>{{test|shortStatBlock|linebreaksbr}}</strong></td>
<td class='statblock statblock-{{test|testResultColour}} state-{{ test|test_status }} col-result'><strong>{{test|shortStatBlock|linebreaksbr}}</strong></td>
+13 -5
View File
@@ -7,7 +7,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#0B0E14">
<meta name="theme-color" content="#14161A">
<meta name="color-scheme" content="dark">
<link rel="icon" type="image/svg+xml" href="{% static 'logo.svg' %}?{{ static_version }}">
@@ -17,12 +17,15 @@
<link rel="stylesheet" href="{% static 'paging.css' %}?{{ static_version }}">
<link rel="stylesheet" href="{% static 'ux.css' %}?{{ static_version }}">
<link rel="stylesheet" href="{% static 'board.css' %}?{{ static_version }}">
<link rel="stylesheet" href="{% static 'refresh.css' %}?{{ static_version }}">
<link rel="stylesheet" href="{% static 'palette.css' %}?{{ static_version }}">
<link rel="stylesheet" href="{% static 'live.css' %}?{{ static_version }}">
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css' rel='stylesheet'>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<title>RektBench</title>
@@ -31,6 +34,8 @@
<script src="{% static 'ui.js' %}?{{ static_version }}" defer></script>
<script src="{% static 'ux.js' %}?{{ static_version }}" defer></script>
<script src="{% static 'palette.js' %}?{{ static_version }}" defer></script>
<script src="{% static 'live.js' %}?{{ static_version }}" defer></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
@@ -46,7 +51,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);
}
}
@@ -96,8 +102,8 @@
<div class="topbar-spacer"></div>
<nav class="topbar-actions" aria-label="Quick actions">
<a class="topbar-btn" href="/search" title="Search tests">
<i class="fa-solid fa-magnifying-glass fa-fw"></i><span>Search</span>
<a class="topbar-btn" id="palette-open" href="/search" title="Search tests" aria-keyshortcuts="Control+K Meta+K">
<i class="fa-solid fa-magnifying-glass fa-fw"></i><span>Search</span><kbd class="topbar-kbd" aria-hidden="true">Ctrl K</kbd>
</a>
<a class="topbar-btn topbar-btn-primary" href="/newTest" title="Create a new test">
<i class="fa-solid fa-plus fa-fw"></i><span>Create Test</span>
@@ -222,5 +228,7 @@
<div id="toast" role="status" aria-live="polite"></div>
{% include "OpenBench/Blocks/palette.html" %}
</body>
</html>
-7
View File
@@ -24,13 +24,6 @@
<div class="stat-label">Pending approval</div>
</div>
</div>
<div class="stat-card stat-purple">
<span class="stat-icon"><i class="fa-solid fa-hammer"></i></span>
<div>
<div class="stat-value">{{ awaiting|length }}</div>
<div class="stat-label">Awaiting artifacts</div>
</div>
</div>
{% if fleet %}
<div class="stat-card stat-green">
<span class="stat-icon"><i class="fa-solid fa-microchip"></i></span>
+3 -3
View File
@@ -20,7 +20,7 @@
<table class="test-config left-align wrappable">
<tr><td class="td-label">Author</td><td>{{workload.author|capfirst}}</td></tr>
<tr><td class="td-label">Creation</td><td class="timestamp">{{workload.creation|date:'U'}}</td></tr>
<tr><td class="td-label">Creation</td><td><time class="timestamp" data-epoch="{{workload.creation|date:'U'}}" datetime="{{workload.creation|date:'c'}}">{{workload.creation|date:'Y-m-d H:i'}}</time></td></tr>
<!-- All of the Dev Engine ( or Sole Engine ) information -->
<tr><td class="td-label">{{dev_text}} Source</td><td><a href="{{workload.dev_repo}}">{{workload.dev_repo}}</a></td></tr>
@@ -257,7 +257,7 @@
<tr {% if result.active %} class="active-highlight" {% endif %}>
<td><a href="/machines/{{result.data.machine.id}}">{{result.data.machine.id}}</a></td>
<td>{{result.data.machine.user.username|capfirst}}</td>
<td class="timestamp">{{result.data.updated|date:'U'}}</td>
<td><time class="timestamp" data-epoch="{{result.data.updated|date:'U'}}" datetime="{{result.data.updated|date:'c'}}">{{result.data.updated|date:'Y-m-d H:i'}}</time></td>
<td class="numeric">{{result.data.games}}</td>
<td class="numeric">{{result.data.wins}}</td>
<td class="numeric">{{result.data.losses}}</td>
@@ -271,4 +271,4 @@
</div>
{% endblock %}
{% endblock %}