Number of CSS and display changes
Make copy button show hoverable pointer events Stop truncating usernames on worker result pages Fixes for setting dev/base options when doing cross-engine play - Base will inherit dev's threads and hash options - Base will discard everything else, and add their own specific options Move to using a 2-dot .. diff instead of a 3-dot ... diff for now.
This commit is contained in:
1 parent
711608a8ee
commit
000fcc17ba
6 files changed
+120
-99
No files matched your search
+102
-57
@@ -1,22 +1,24 @@
|
||||
|
||||
var config = JSON.parse(document.getElementById("json-config" ).textContent);
|
||||
var networks = JSON.parse(document.getElementById("json-networks").textContent);
|
||||
var repos = JSON.parse(document.getElementById("json-repos" ).textContent);
|
||||
var config = JSON.parse(document.getElementById('json-config' ).textContent);
|
||||
var networks = JSON.parse(document.getElementById('json-networks').textContent);
|
||||
var repos = JSON.parse(document.getElementById('json-repos' ).textContent);
|
||||
|
||||
function create_network_options(field_id, engine) {
|
||||
|
||||
var has_default = false;
|
||||
var network_options = document.getElementById(field_id);
|
||||
|
||||
// Delete all existing Networks
|
||||
while (network_options.length)
|
||||
network_options.remove(0);
|
||||
|
||||
// Add each Network that matches the given engine
|
||||
for (const network of networks) {
|
||||
|
||||
if (network.engine !== engine)
|
||||
continue;
|
||||
|
||||
var opt = document.createElement("option");
|
||||
var opt = document.createElement('option');
|
||||
opt.text = network.name;
|
||||
opt.value = network.sha256;
|
||||
opt.selected = network.default;
|
||||
@@ -25,10 +27,10 @@ function create_network_options(field_id, engine) {
|
||||
has_default = has_default || network.default;
|
||||
}
|
||||
|
||||
{
|
||||
var opt = document.createElement("option");
|
||||
opt.text = "None";
|
||||
opt.value = "";
|
||||
{ // Add a None option and set it to default if there was not one yet
|
||||
var opt = document.createElement('option');
|
||||
opt.text = 'None';
|
||||
opt.value = '';
|
||||
opt.selected = !has_default;
|
||||
network_options.add(opt);
|
||||
}
|
||||
@@ -37,7 +39,7 @@ function create_network_options(field_id, engine) {
|
||||
function create_testmode_buttons(engine) {
|
||||
|
||||
// Clear out all of the existing buttons
|
||||
var button_div = document.getElementById("test-mode-buttons");
|
||||
var button_div = document.getElementById('test-mode-buttons');
|
||||
while (button_div.hasChildNodes())
|
||||
button_div.removeChild(button_div.lastChild);
|
||||
|
||||
@@ -50,23 +52,23 @@ function create_testmode_buttons(engine) {
|
||||
btn.onclick = function() { set_test_mode(mode); };
|
||||
|
||||
// Apply all of our CSS bootstrapping
|
||||
btn.classList.add("anchorbutton");
|
||||
btn.classList.add("btn-preset");
|
||||
btn.classList.add("mt-2");
|
||||
btn.classList.add("w-100");
|
||||
btn.classList.add('anchorbutton');
|
||||
btn.classList.add('btn-preset');
|
||||
btn.classList.add('mt-2');
|
||||
btn.classList.add('w-100');
|
||||
|
||||
// Put the button in a div, so we can handle padding
|
||||
var div = document.createElement('div')
|
||||
div.appendChild(btn)
|
||||
div.classList.add("col-half");
|
||||
div.classList.add('col-half');
|
||||
|
||||
// Left pad everything but the first
|
||||
if ((index % 4) != 0)
|
||||
div.classList.add("pl-1");
|
||||
div.classList.add('pl-1');
|
||||
|
||||
// Right pad everything but the last
|
||||
if ((index % 4) != 3)
|
||||
div.classList.add("pr-1");
|
||||
div.classList.add('pr-1');
|
||||
|
||||
button_div.append(div);
|
||||
index++;
|
||||
@@ -74,79 +76,122 @@ function create_testmode_buttons(engine) {
|
||||
}
|
||||
|
||||
|
||||
function extract_mode_config(mode_str, target) {
|
||||
|
||||
// Find test mode configuration for either Dev or Base
|
||||
|
||||
var selection = document.getElementById(target + '_engine');
|
||||
var engine = selection.options[selection.selectedIndex].value;
|
||||
|
||||
return config.engines[engine].testmodes[mode_str];
|
||||
}
|
||||
|
||||
|
||||
function set_test_type() {
|
||||
|
||||
var selectA = document.getElementById("test_mode");
|
||||
var selectA = document.getElementById('test_mode');
|
||||
var mode = selectA.options[selectA.selectedIndex].value;
|
||||
|
||||
var selectB = document.getElementById("dev_engine");
|
||||
var selectB = document.getElementById('dev_engine');
|
||||
var engine = selectB.options[selectB.selectedIndex].value;
|
||||
|
||||
|
||||
if (mode == "SPRT") {
|
||||
document.getElementById("test_bounds" ).value = config.engines[engine].bounds
|
||||
document.getElementById("test_confidence").value = config.tests.confidence;
|
||||
document.getElementById("test_max_games" ).value = "N/A";
|
||||
if (mode == 'SPRT') {
|
||||
document.getElementById('test_bounds' ).value = config.engines[engine].bounds
|
||||
document.getElementById('test_confidence').value = config.tests.confidence;
|
||||
document.getElementById('test_max_games' ).value = 'N/A';
|
||||
}
|
||||
|
||||
if (mode == "GAMES") {
|
||||
document.getElementById("test_bounds" ).value = "N/A";
|
||||
document.getElementById("test_confidence").value = "N/A";
|
||||
document.getElementById("test_max_games" ).value = config.tests.max_games;
|
||||
if (mode == 'GAMES') {
|
||||
document.getElementById('test_bounds' ).value = 'N/A';
|
||||
document.getElementById('test_confidence').value = 'N/A';
|
||||
document.getElementById('test_max_games' ).value = config.tests.max_games;
|
||||
}
|
||||
}
|
||||
|
||||
function set_engine_options(mode_str, target) {
|
||||
|
||||
// Extract UCI options for both the Dev and Base engines
|
||||
var dev_options = extract_mode_config(mode_str, 'dev' )['options'] || 'Threads=1 Hash=8';
|
||||
var base_options = extract_mode_config(mode_str, 'base')['options'] || 'Threads=1 Hash=8';
|
||||
|
||||
// Simple case, where we are not updating a base that is cross-engine
|
||||
if (target == 'dev' || dev_options == base_options)
|
||||
document.getElementById(target + '_options').value = dev_options;
|
||||
|
||||
else {
|
||||
|
||||
// Use the Threads= and Hash= from the dev options, but then make
|
||||
// sure to include any specific options that appear in dev options
|
||||
|
||||
var regex = /(Threads=\d+)\s(Hash=\d+)/;
|
||||
var matches = dev_options.match(regex);
|
||||
|
||||
var standard_options = matches[1] + ' ' + matches[2];
|
||||
var specific_options = base_options.replace(regex, '');
|
||||
var combined_options = standard_options.trim() + ' ' + specific_options.trim();
|
||||
|
||||
document.getElementById('base_options').value = combined_options.trim();
|
||||
}
|
||||
}
|
||||
|
||||
function set_test_mode(mode_str) {
|
||||
|
||||
var selection = document.getElementById("dev_engine");
|
||||
var engine = selection.options[selection.selectedIndex].value;
|
||||
var mode = config.engines[engine].testmodes[mode_str];
|
||||
const selection = document.getElementById('dev_engine');
|
||||
const engine = selection.options[selection.selectedIndex].value;
|
||||
const mode = extract_mode_config(mode_str, 'dev');
|
||||
|
||||
document.getElementById("report_rate" ).value = mode["report_rate"] || 8;
|
||||
document.getElementById("workload_size").value = mode["workload_size"] || 32;
|
||||
document.getElementById("book_name" ).value = mode["book"] || config.engines[engine].book;
|
||||
document.getElementById('report_rate' ).value = mode['report_rate'] || 8;
|
||||
document.getElementById('workload_size').value = mode['workload_size'] || 32;
|
||||
document.getElementById('book_name' ).value = mode['book'] || config.engines[engine].book;
|
||||
|
||||
document.getElementById("dev_options" ).value = mode["options"] || "Threads=1 Hash=8";
|
||||
document.getElementById("dev_time_control" ).value = mode["timecontrol"] || "10.0+0.1";
|
||||
document.getElementById('dev_time_control' ).value = mode['timecontrol'] || '10.0+0.1';
|
||||
document.getElementById('base_time_control').value = mode['timecontrol'] || '10.0+0.1';
|
||||
|
||||
document.getElementById("base_options" ).value = mode["options"] || "Threads=1 Hash=8";
|
||||
document.getElementById("base_time_control").value = mode["timecontrol"] || "10.0+0.1";
|
||||
set_engine_options(mode_str, 'dev');
|
||||
set_engine_options(mode_str, 'base');
|
||||
|
||||
if (mode["bounds"] != null) {
|
||||
document.getElementById("test_mode").value = "SPRT"; set_test_type();
|
||||
document.getElementById("test_bounds").value = mode["bounds"];
|
||||
if (mode['bounds'] != null) {
|
||||
document.getElementById('test_mode').value = 'SPRT'; set_test_type();
|
||||
document.getElementById('test_bounds').value = mode['bounds'];
|
||||
}
|
||||
|
||||
if (mode["games"] != null) {
|
||||
document.getElementById("test_mode").value = "GAMES"; set_test_type();
|
||||
document.getElementById("test_max_games").value = mode["games"];
|
||||
if (mode['games'] != null) {
|
||||
document.getElementById('test_mode').value = 'GAMES'; set_test_type();
|
||||
document.getElementById('test_max_games').value = mode['games'];
|
||||
}
|
||||
|
||||
if (mode["bounds"] == null && mode["games"] == null) {
|
||||
document.getElementById("test_mode").value = "SPRT"; set_test_type();
|
||||
if (mode['bounds'] == null && mode['games'] == null) {
|
||||
document.getElementById('test_mode').value = 'SPRT'; set_test_type();
|
||||
}
|
||||
}
|
||||
|
||||
function set_engine(engine, target) {
|
||||
|
||||
document.getElementById(target + "_engine").value = engine;
|
||||
document.getElementById(target + "_repo" ).value = repos[engine] || "https://github.com/";
|
||||
// Always update the Engine and Repository to the defaults
|
||||
document.getElementById(target + '_engine').value = engine;
|
||||
document.getElementById(target + '_repo' ).value = repos[engine] || 'https://github.com/';
|
||||
|
||||
// Create dropdown of all Networks associated with the engine
|
||||
create_network_options(target + '_network', engine);
|
||||
|
||||
// Set default UCI options as if we were running an STC when changing
|
||||
set_engine_options('STC', target);
|
||||
|
||||
if (target == 'dev') {
|
||||
|
||||
// Dev engine decides the Adjudication and Book settings
|
||||
document.getElementById('book_name' ).value = config.engines[engine].book;
|
||||
document.getElementById('win_adj' ).value = config.engines[engine].win_adj;
|
||||
document.getElementById('draw_adj' ).value = config.engines[engine].draw_adj;
|
||||
|
||||
// When swapping the dev engine, redo buttons, base, and test mode
|
||||
create_testmode_buttons(engine);
|
||||
set_engine(engine, 'base');
|
||||
set_test_mode('STC');
|
||||
}
|
||||
|
||||
create_network_options(target + "_network", engine);
|
||||
|
||||
if (target == 'dev') {
|
||||
document.getElementById("book_name" ).value = config.engines[engine].book;
|
||||
document.getElementById("win_adj" ).value = config.engines[engine].win_adj;
|
||||
document.getElementById("draw_adj" ).value = config.engines[engine].draw_adj;
|
||||
}
|
||||
|
||||
else
|
||||
document.getElementById(target + "_branch").value = config.engines[engine].base;
|
||||
// Default the base engine to it's own base branch
|
||||
else document.getElementById(target + '_branch').value = config.engines[engine].base;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -241,10 +241,12 @@ body, html, main{
|
||||
#content .copy-button {
|
||||
color: var(--color-font2);
|
||||
transition: color 0.2s ease-in-out;
|
||||
|
||||
}
|
||||
|
||||
#content .copy-button:hover {
|
||||
color: var(--color-font3);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Short StatBlock to show SPRT and Test Results */
|
||||
|
||||
@@ -46,27 +46,13 @@ def twoDigitPrecision(value):
|
||||
|
||||
def gitDiffLink(test):
|
||||
|
||||
if type(test) != OpenBench.models.Test:
|
||||
dev = test['dev']['source']
|
||||
base = test['base']['source']
|
||||
devsha = test['dev']['sha']
|
||||
basesha = test['base']['sha']
|
||||
engine = test['dev_engine']
|
||||
|
||||
if OpenBench.config.OPENBENCH_CONFIG['engines'][test.dev_engine]['private']:
|
||||
repo = OpenBench.config.OPENBENCH_CONFIG['engines'][test.dev_engine]['source']
|
||||
else:
|
||||
dev = test.dev.source
|
||||
base = test.base.source
|
||||
devsha = test.dev.sha
|
||||
basesha = test.base.sha
|
||||
engine = test.dev_engine
|
||||
|
||||
if OpenBench.config.OPENBENCH_CONFIG['engines'][engine]['private']:
|
||||
repo = OpenBench.config.OPENBENCH_CONFIG['engines'][engine]['source']
|
||||
else:
|
||||
repo = OpenBench.utils.path_join(*dev.split('/')[:-2])
|
||||
repo = OpenBench.utils.path_join(*test.dev.source.split('/')[:-2])
|
||||
|
||||
return OpenBench.utils.path_join(repo, 'compare',
|
||||
'{0}...{1}'.format(basesha[:8], devsha[:8]))
|
||||
'{0}..{1}'.format( test.base.sha[:8], test.dev.sha[:8]))
|
||||
|
||||
def shortStatBlock(test):
|
||||
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
document.addEventListener(
|
||||
'DOMContentLoaded', function () {
|
||||
set_test_type();
|
||||
set_engine("{{ profile.engine }}", "dev");
|
||||
set_engine("{{ profile.engine }}", "base");
|
||||
set_test_mode("STC");
|
||||
set_engine('{{ profile.engine }}', 'dev');
|
||||
enforce_default_text('dev_repo', 'https://github.com/');
|
||||
enforce_default_text('base_repo', 'https://github.com/');
|
||||
}, false
|
||||
|
||||
@@ -122,6 +122,7 @@
|
||||
<a class="w-25 mr-2 anchorbutton btn-disabled">Delete</a>
|
||||
{% endif %}
|
||||
|
||||
<!-- Copy Button: Copy the current results statblock -->
|
||||
<a class="copy-button" onclick="copy_statblock()">
|
||||
<i class="fa-regular fa-clone copy-button"></i>
|
||||
</a>
|
||||
@@ -174,7 +175,7 @@
|
||||
{% for id, result in results.items %}
|
||||
<tr>
|
||||
<td>{{result.machine_id}}</td>
|
||||
<td>{{result.username|capfirst|slice:"6"}}</td>
|
||||
<td>{{result.username|capfirst}}</td>
|
||||
<td class="timestamp">{{result.updated|date:'U'}}</td>
|
||||
<td class="numeric">{{result.games}}</td>
|
||||
<td class="numeric">{{result.wins}}</td>
|
||||
|
||||
@@ -11,29 +11,18 @@
|
||||
<th>Games</th>
|
||||
<th>Tests</th>
|
||||
<th>Engine</th>
|
||||
<th>Default Repository</th>
|
||||
<th>Created</th>
|
||||
</tr>
|
||||
|
||||
<!---
|
||||
<tr style="font-weight: bold">
|
||||
<th>{{profiles|length}}</th>
|
||||
<th>{{profiles|sumAttributes:"games"|insertCommas}}</th>
|
||||
<th>{{profiles|sumAttributes:"tests"|insertCommas}}</th>
|
||||
<th></th><th></th>
|
||||
</tr>
|
||||
--->
|
||||
|
||||
{% for profile in profiles %}
|
||||
{% if profile.enabled %}
|
||||
{% if profile.games or profile.tests or profile.approver %}
|
||||
<tr>
|
||||
<td><a href="/user/{{profile.user.username}}">{{profile.user.username|capfirst}}</a></td>
|
||||
<td style="text-align: right">{{profile.games|insertCommas}}</td>
|
||||
<td style="text-align: right">{{profile.tests|insertCommas}}</td>
|
||||
<td>{{profile.engine}}</td>
|
||||
<td><a href="{{profile.repo}}">{{profile.repo}}</a></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if profile.games or profile.tests or profile.approver %}
|
||||
<tr>
|
||||
<td><a href="/user/{{profile.user.username}}">{{profile.user.username|capfirst}}</a></td>
|
||||
<td style="text-align: right">{{profile.games|insertCommas}}</td>
|
||||
<td style="text-align: right">{{profile.tests|insertCommas}}</td>
|
||||
<td>{{profile.engine}}</td>
|
||||
<td class="timestamp">{{profile.user.date_joined|date:'U'}}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
Reference in new issue
Block a user