Cleanup templates for all views

Make use of the block structure to clean up index/events/search heavily
Fix a bug for the paging context on the events view
This commit is contained in:
AndyGrant committed 2019-10-25 05:49:45 -04:00
1 parent caa5bcfdf6
commit 9ec29cf03b
16 files changed
+270 -325

No files matched your search

+12 -6
View File
@@ -27,36 +27,42 @@ FRAMEWORK_DEFAULTS = {
'engines' : { 'engines' : {
'Ethereal' : { 'Ethereal' : {
'proto' : 'uci',
'nps' : 1500000,
'name' : 'Ethereal', 'name' : 'Ethereal',
'source' : 'https://github.com/AndyGrant/Ethereal', 'source' : 'https://github.com/AndyGrant/Ethereal',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' }, 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' }, 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
'nps' : 1500000, },
'proto' : 'uci',
}, },
'Laser' : { 'Laser' : {
'proto' : 'uci',
'nps' : 625000,
'name' : 'Laser', 'name' : 'Laser',
'source' : 'https://github.com/jeffreyan11/uci-chess-engine', 'source' : 'https://github.com/jeffreyan11/uci-chess-engine',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' }, 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' }, 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
'nps' : 625000, },
'proto' : 'uci',
}, },
'Weiss' : { 'Weiss' : {
'proto' : 'uci',
'nps' : 4000000,
'name' : 'Weiss', 'name' : 'Weiss',
'source' : 'https://github.com/TerjeKir/weiss', 'source' : 'https://github.com/TerjeKir/weiss',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '10.0+0.1' }, 'stc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 128, 'timecontrol' : '60.0+0.6' }, 'ltc' : { 'threads' : 1, 'hash' : 128, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '5.0+0.05' }, 'smpstc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 512, 'timecontrol' : '20.0+0.2' }, 'smpltc' : { 'threads' : 8, 'hash' : 512, 'timecontrol' : '20.0+0.2' },
'nps' : 4000000, },
'proto' : 'uci',
}, },
}, },
+4 -2
View File
@@ -101,8 +101,10 @@ a:link, a:visited, a:hover, a:active {
} }
#content .summarytable th { #content .summarytable th {
padding-top: 20px;
padding-right: 10px; padding-right: 10px;
font-size: 20px; padding-bottom: 20px;
font-size: 16px;
color: #00CCFF; color: #00CCFF;
} }
@@ -120,7 +122,7 @@ a:link, a:visited, a:hover, a:active {
} }
#content #actions { #content #actions {
float: left; float: right;
} }
#content #actions .anchorbutton { #content #actions .anchorbutton {
+7 -6
View File
@@ -98,9 +98,10 @@ def editProfile(request):
profile.user.email = request.POST['email'] profile.user.email = request.POST['email']
profile.engine = request.POST['enginename'] profile.engine = request.POST['enginename']
profile.repo = request.POST['repo'] profile.repo = request.POST['repo']
profile.user.save()
profile.save() profile.save()
# Change Passwords # Change Passwords if requested
password1 = request.POST['password1'] password1 = request.POST['password1']
password2 = request.POST['password2'] password2 = request.POST['password2']
if password1 != '' and password1 == password2: if password1 != '' and password1 == password2:
@@ -110,8 +111,8 @@ def editProfile(request):
username=request.user.username, username=request.user.username,
password=password1)) password=password1))
# Send back to see the changes # Send back to see the homepage
return HttpResponseRedirect('/viewProfile/') return HttpResponseRedirect('/index/')
def index(request, page=1, pageLength=24, greens=False, username=None, error=''): def index(request, page=1, pageLength=24, greens=False, username=None, error=''):
@@ -257,15 +258,15 @@ def machines(request):
data = {'machines' : Machine.objects.filter(updated__gte=target)} data = {'machines' : Machine.objects.filter(updated__gte=target)}
return render(request, 'machines.html', data) return render(request, 'machines.html', data)
def eventLog(request, page=0, pageLength=50): def eventLog(request, page=1, pageLength=50):
# Choose events within the given page, if any # Choose events within the given page, if any
events = LogEvent.objects.all().order_by('-id') events = LogEvent.objects.all().order_by('-id')
items = len(events) items = len(events)
start = page * pageLength start = page * pageLength
end = start + pageLength end = start + pageLength
start = max(0, min(start, items)) start = max(1, min(start, items))
end = max(0, min(end, items)) end = max(1, min(end, items))
paging = pagingContext(page, pageLength, items, 'eventLog') paging = pagingContext(page, pageLength, items, 'eventLog')
# Build context dictionary for event log template # Build context dictionary for event log template
@@ -0,0 +1,13 @@
<div id="pagebrowse">
{% if paging.prev != paging.next %}
<a class="page" href="/{{paging.url}}/{{paging.prev}}">&lt;--</a>
{% for page in paging.pages %}
{% if page != "..." %}
<a class="page" href="/{{paging.url}}/{{page}}">{{page}}</a>
{% else %}
<a class="page"> {{page}} </a>
{% endif %}
{% endfor %}
<a class="page" href="/{{paging.url}}/{{paging.next}}">--&gt;</a>
{% endif %}
</div>
@@ -0,0 +1,9 @@
{% load mytags %}
<tr>
<td><a href="/viewUser/{{test.author}}">{{test.author|slice:":6"}}</a></td>
<td>{{test.engine}}</td>
<td><a href="/viewTest/{{test.id}}">{{test.dev.name}}</a></td>
<td class="textcenter"><a href="{{test|gitDiffLink}}">diff</a></td>
<td>{{test.timecontrol}}</td>
<td class='statblock {{test|testResultColour}}'><strong>{{test|shortStatBlock|linebreaksbr}}</strong></td>
</tr>
+15 -7
View File
@@ -1,25 +1,28 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
{% load static %} {% load static %}
<head> <head>
<link rel="stylesheet" href="{% static 'style.css' %}"> <link rel="stylesheet" href="{% static 'style.css' %}">
<title>OpenBench</title> <title>OpenBench</title>
<script> <script>
{% block scripts %} {% block scripts %}
{% endblock %} {% endblock %}
</script> </script>
</head> </head>
<body>
<body>
<!-- Views may return an error message -->
{% if error %} {% if error %}
<div id="error"> <div id="error">
<strong>{{error}}</strong> <strong>{{error}}</strong>
</div> </div>
{% endif %} {% endif %}
<!-- Tell unauthenticated users to contact the Admin -->
{% if request.user.is_authenticated and not profile.enabled %} {% if request.user.is_authenticated and not profile.enabled %}
<div id="error"> <div id="error">
<strong>{{profile.user.username}}! Your account is not enabled.</strong> <strong>{{profile.user.username}}! Your account is not enabled.</strong>
@@ -28,7 +31,7 @@
{% endif %} {% endif %}
<div id="sidebar"> <div id="sidebar">
{% block sidebar %}
<ul> <ul>
<li class="header">ADMIN</li> <li class="header">ADMIN</li>
{% if user.is_authenticated %} {% if user.is_authenticated %}
@@ -39,6 +42,7 @@
<li><a href="/register">Register</a></li> <li><a href="/register">Register</a></li>
{% endif %} {% endif %}
</ul> </ul>
<ul> <ul>
<li class="header">TESTS</li> <li class="header">TESTS</li>
<li><a href="/index">Index</a></li> <li><a href="/index">Index</a></li>
@@ -46,6 +50,7 @@
<li><a href="/search">Search</a></li> <li><a href="/search">Search</a></li>
<li><a href="/newTest">New Test</a></li> <li><a href="/newTest">New Test</a></li>
</ul> </ul>
<ul> <ul>
<li class="header">INFO</li> <li class="header">INFO</li>
<li><a href="/users">Users</a></li> <li><a href="/users">Users</a></li>
@@ -53,17 +58,20 @@
<li><a href="/machines">Machines</a></li> <li><a href="/machines">Machines</a></li>
<li><a href="{{config.framework}}">OpenBench</a></li> <li><a href="{{config.framework}}">OpenBench</a></li>
</ul> </ul>
<ul> <ul>
<li class="header">ENGINES</li> <li class="header">ENGINES</li>
{% for engine, data in config.engines.items|dictsort:"0.lower" %} {% for engine, data in config.engines.items|dictsort:"0.lower" %}
<li><a href="{{data.source}}">{{data.name}}</a></li> <li><a href="{{data.source}}">{{data.name}}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endblock %}
</div> </div>
<div id="content"> <div id="content">
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</div> </div>
</body>
</body>
</html> </html>
+9 -19
View File
@@ -1,17 +1,16 @@
{% extends "OpenBench/base.html" %} {% extends "OpenBench/base.html" %}
{% block style %}
{% load static %}
{% endblock %}
{% block content %} {% block content %}
<table class="rawtable">
<table class="rawtable">
<tr> <tr>
<th>Date</th> <th>Date</th>
<th>User</th> <th>User</th>
<th>Test</th> <th>Test</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
{% for event in events %} {% for event in events %}
<tr> <tr>
<td>{{event.creation|date:'Y-m-d H:i:s'}}</td> <td>{{event.creation|date:'Y-m-d H:i:s'}}</td>
@@ -20,18 +19,9 @@
<td>{{event.data}}</td> <td>{{event.data}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
<table>
<div id="pagebrowse"> <table>
{% if paging.prev != paging.next %}
<a class="page" href="/{{paging.url}}/{{paging.prev}}">&lt;--</a> {% include "OpenBench/Blocks/pagebrowser.html" %}
{% for page in paging.pages %}
{% if page != "..." %}
<a class="page" href="/{{paging.url}}/{{page}}">{{page}}</a>
{% else %}
<a class="page"> {{page}} </a>
{% endif %}
{% endfor %}
<a class="page" href="/{{paging.url}}/{{paging.next}}">--&gt;</a>
{% endif %}
</div>
{% endblock %} {% endblock %}
+31 -51
View File
@@ -1,58 +1,38 @@
{% extends "OpenBench/base.html" %} {% extends "OpenBench/base.html" %}
{% load mytags %}
{% block content %} {% block content %}
<table class="datatable"> <table class="datatable">
{% if paging.page == 1 and greens == False %}
<tr><td class="embedded" colspan='7'><h2>Pending</h2></td></tr>
{% for test in pending %}
<tr>
<td class="numeric"><a href="/viewUser/{{test.author}}">{{test.author}}</a></td>
<td class="numeric">{{test.engine}}</td>
<td><a href="/viewTest/{{test.id}}">{{test.dev.name}}</a></td>
<td class="textcenter"><a href="{{test|gitDiffLink}}">diff</a></td>
<td>{{test.timecontrol}}</td>
<td class="statblock"><strong>{{test|shortStatBlock|linebreaksbr}}</strong></td>
</tr>
{% endfor %}
{% if active %}
<tr><td class="embedded" colspan='7'><h2>Active {{status}}</h2></td></tr>
{% endif %}
{% for test in active %}
<tr>
<td class="numeric"><a href="/viewUser/{{test.author}}">{{test.author}}</a></td>
<td class="numeric">{{test.engine}}</td>
<td><a href="/viewTest/{{test.id}}">{{test.dev.name}}</a></td>
<td class="textcenter"><a href="{{test|gitDiffLink}}">diff</a></td>
<td>{{test.timecontrol}}</td>
<td class="statblock"><strong>{{test|shortStatBlock|linebreaksbr}}</strong></td>
</tr>
{% endfor %}
{% endif %}
<tr><td class="embedded" colspan='7'><h2>Finished</h2></td></tr>
{% for test in completed %}
<tr>
<td class="numeric"><a href="/viewUser/{{test.author}}">{{test.author}}</a></td>
<td class="numeric">{{test.engine}}</td>
<td><a href="/viewTest/{{test.id}}">{{test.dev.name}}</a></td>
<td class="textcenter"><a href="{{test|gitDiffLink}}">diff</a></td>
<td>{{test.timecontrol}}</td>
<td class='statblock {{test|testResultColour}}'><strong>{{test|shortStatBlock|linebreaksbr}}</strong></td>
</tr>
{% endfor %}
</table>
<div id="pagebrowse"> <!-- Only show Pending tests for the front page of the Index -->
{% if paging.prev != paging.next %} {% if paging.page == 1 and greens == False %}
<a class="page" href="/{{paging.url}}/{{paging.prev}}">&lt;--</a>
{% for page in paging.pages %} <!-- Currently Pending tests (Waiting to be approved) -->
{% if page != "..." %} <tr><td class="embedded" colspan='6'><h2>Pending</h2></td></tr>
<a class="page" href="/{{paging.url}}/{{page}}">{{page}}</a> {% for test in pending %}
{% else %} {% include "OpenBench/Blocks/testsummary.html" %}
<a class="page"> {{page}} </a>
{% endif %}
{% endfor %} {% endfor %}
<a class="page" href="/{{paging.url}}/{{paging.next}}">--&gt;</a>
<!-- Show Worker information when running a test -->
{% if active %}
<tr><td class="embedded" colspan='6'><h2>Active {{status}}</h2></td></tr>
{% endif %} {% endif %}
</div>
<!-- Currently Running tests (Waiting to be completed) -->
{% for test in active %}
{% include "OpenBench/Blocks/testsummary.html" %}
{% endfor %}
{% endif %}
<!-- Tests which have already finished -->
<tr><td class="embedded" colspan='6'><h2>Finished</h2></td></tr>
{% for test in completed %}
{% include "OpenBench/Blocks/testsummary.html" %}
{% endfor %}
</table>
{% include "OpenBench/Blocks/pagebrowser.html" %}
{% endblock %} {% endblock %}
+6 -10
View File
@@ -1,16 +1,12 @@
{% extends "OpenBench/base.html" %} {% extends "OpenBench/base.html" %}
{% block style %}
{% load static %}
{% endblock %}
{% block content %} {% block content %}
<form method="POST" action="/login/">
<form method="POST" action="/login/">
{% csrf_token %} {% csrf_token %}
<label type="text">Username</label> <label type="text">Username</label> <input type="text" name="username"><br>
<input type="text" name="username"></br> <label type="text">Password</label> <input type="password" name="password"><br>
<label type="text">Password</label>
<input type="password" name="password"></br>
<input type="submit" name="submit" value="Login"> <input type="submit" name="submit" value="Login">
</form> </form>
{% endblock %} {% endblock %}
+7 -7
View File
@@ -1,13 +1,11 @@
{% extends "OpenBench/base.html" %} {% extends "OpenBench/base.html" %}
{% load mytags %} {% load mytags %} <!-- For twoDigitPrecision() -->
{% block style %}
{% load static %}
{% endblock %}
{% block content %} {% block content %}
<table class="rawtable">
<table class="rawtable">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>User</th> <th>User</th>
@@ -17,6 +15,7 @@
<th>Threads</th> <th>Threads</th>
<th>MNPS</th> <th>MNPS</th>
</tr> </tr>
{% for machine in machines %} {% for machine in machines %}
<tr> <tr>
<td class="numeric">{{machine.id}}</td> <td class="numeric">{{machine.id}}</td>
@@ -28,6 +27,7 @@
<td class="numeric">{{machine.mnps|twoDigitPrecision}}</td> <td class="numeric">{{machine.mnps|twoDigitPrecision}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table>
</table>
{% endblock %} {% endblock %}
+51 -65
View File
@@ -1,40 +1,26 @@
{% extends "OpenBench/base.html" %} {% extends "OpenBench/base.html" %}
{% block scripts %} {% block scripts %}
var testMode = "stc"; // Take the settings from OpenBench/config.py for each engine
// and generate a new dictionary in javascript that can be used
var configurations = { var configurations = {
{% for name, data in config.engines.items %} {% for name, data in config.engines.items %}
'{{name}}' : { '{{name}}' : {
'stc' : { {% for type, settings in data.testmodes.items %}
"threads" : "{{data.stc.threads}}", '{{type}}' : {
"hash" : "{{data.stc.hash}}", "threads" : "{{settings.threads}}",
"timecontrol" : "{{data.stc.timecontrol}}" "hash" : "{{settings.hash}}",
}, "timecontrol" : "{{settings.timecontrol}}"
'ltc' : {
"threads" : "{{data.ltc.threads}}",
"hash" : "{{data.ltc.hash}}",
"timecontrol" : "{{data.ltc.timecontrol}}"
},
'smpstc' : {
"threads" : "{{data.smpstc.threads}}",
"hash" : "{{data.smpstc.hash}}",
"timecontrol" : "{{data.smpstc.timecontrol}}"
},
'smpltc' : {
"threads" : "{{data.smpltc.threads}}",
"hash" : "{{data.smpltc.hash}}",
"timecontrol" : "{{data.smpltc.timecontrol}}"
}, },
{% endfor %}
}, },
{% endfor %} {% endfor %}
}; };
function configure(mode) { function configure(mode) {
// Update global test mode
testMode = mode;
// Find the selected engine // Find the selected engine
var selection = document.getElementById("enginename"); var selection = document.getElementById("enginename");
var engine = selection.options[selection.selectedIndex].value; var engine = selection.options[selection.selectedIndex].value;
@@ -49,14 +35,17 @@
document.getElementById("baseoptions").value = "Threads=" + threads + " Hash=" + hash; document.getElementById("baseoptions").value = "Threads=" + threads + " Hash=" + hash;
document.getElementById("timecontrol").value = timecontrol; document.getElementById("timecontrol").value = timecontrol;
} }
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form method="POST" action="/newTest/">
<form method="POST" action="/newTest/">
{% csrf_token %} {% csrf_token %}
<div class="settings-column"> <div class="settings-column">
<h3> Engine </h3> <h3> Engine </h3>
<label> Name </label> <label> Name </label> <select id="enginename" name="enginename">
<select id="enginename" name="enginename" onchange="configure(testMode)">
{% for engine in config.engines %} {% for engine in config.engines %}
{% if engine == profile.engine %} {% if engine == profile.engine %}
<option selected value="{{engine}}">{{engine}}</option> <option selected value="{{engine}}">{{engine}}</option>
@@ -66,27 +55,24 @@
{% endfor %} {% endfor %}
<option value="{{engine}}">{{engine}}</option> <option value="{{engine}}">{{engine}}</option>
</select><br> </select><br>
<label> Source </label> <label> Source </label> <input value="{{profile.repo}}" name="source"><br>
<input value="{{profile.repo}}" name="source"></br>
<h3> Dev Settings </h3> <h3> Dev Settings </h3>
<label> Bench </label> <label> Bench </label> <input name="devbench"><br>
<input name="devbench"></br> <label> Branch </label> <input name="devbranch" autofocus><br>
<label> Branch </label> <label> Options </label> <input id="devoptions" name="devoptions"><br>
<input name="devbranch" autofocus></br>
<label> Options </label>
<input id="devoptions" name="devoptions"></br>
<h3> Base Settings </h3> <h3> Base Settings </h3>
<label> Bench </label> <label> Bench </label> <input name="basebench"><br>
<input name="basebench"></br> <label> Branch </label> <input value="master" name="basebranch"><br>
<label> Branch </label> <label> Options </label> <input id="baseoptions" name="baseoptions"><br>
<input value="master" name="basebranch"></br>
<label> Options </label>
<input id="baseoptions" name="baseoptions"></br>
</div> </div>
<div class="settings-column"> <div class="settings-column">
<h3> Game Settings </h3> <h3> Game Settings </h3>
<label> Book </label> <label> Book </label> <select name="bookname">
<select name="bookname">
{% for name, data in config.books.items %} {% for name, data in config.books.items %}
{% if data.default %} {% if data.default %}
<option selected value="{{name}}">{{data.name}}</option> <option selected value="{{name}}">{{data.name}}</option>
@@ -94,31 +80,31 @@
<option value="{{name}}">{{data.name}}</option> <option value="{{name}}">{{data.name}}</option>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</select></br> </select><br>
<label> Time </label> <label> Time </label> <input id="timecontrol" name="timecontrol"><br>
<input id="timecontrol" name="timecontrol"></br>
<h3> SPRT Settings </h3> <h3> SPRT Settings </h3>
<label> Lower </label> <label> Lower </label> <input value="{{config.sprt.elolower}}" name="elolower"><br>
<input value="{{config.sprt.elolower}}" name="elolower"></br> <label> Upper </label> <input value="{{config.sprt.eloupper}}" name="eloupper"><br>
<label> Upper </label> <label> Alpha </label> <input value="{{config.sprt.alpha}}" name="alpha"><br>
<input value="{{config.sprt.eloupper}}" name="eloupper"></br> <label> Beta </label> <input value="{{config.sprt.beta}}" name="beta"><br>
<label> Alpha </label>
<input value="{{config.sprt.alpha}}" name="alpha"></br>
<label> Beta </label>
<input value="{{config.sprt.beta}}" name="beta"></br>
<h3> Test Settings </h3> <h3> Test Settings </h3>
<label> Priority </label> <label> Priority </label> <input value="0" name="priority"><br>
<input value="0" name="priority"></br> <label> Throughput </label> <input value="1000" name="throughput"><br>
<label> Throughput </label>
<input value="1000" name="throughput"></br>
</div> </div>
<br><input type="submit" name="submit" value="Create Engine Test"><br>
</form> <br><input type="submit" name="submit" value="Create Engine Test">
<div id="test-mode-buttons">
<button class="left-floated"onClick="configure('stc')">Setup STC</button> </form>
<button class="right-floated"onClick="configure('ltc')">Setup LTC</button><br>
<button class="left-floated"onClick="configure('smpstc')">Setup SMP STC</button> <div id="test-mode-buttons">
<button class="right-floated"onClick="configure('smpltc')">Setup SMP LTC</button> <button class="left-floated" onClick="configure('stc')">Setup STC</button>
</div> <button class="right-floated" onClick="configure('ltc')">Setup LTC</button><br>
<button class="left-floated" onClick="configure('smpstc')">Setup SMP STC</button>
<button class="right-floated" onClick="configure('smpltc')">Setup SMP LTC</button>
</div>
{% endblock %} {% endblock %}
+8 -14
View File
@@ -1,20 +1,14 @@
{% extends "OpenBench/base.html" %} {% extends "OpenBench/base.html" %}
{% block style %}
{% load static %}
{% endblock %}
{% block content %} {% block content %}
<form id="registerForm" method="POST" action="/register/">
<form id="registerForm" method="POST" action="/register/">
{% csrf_token %} {% csrf_token %}
<label>Username</label> <label>Username</label> <input name="username"><br>
<input name="username"></br> <label>Password</label> <input type="password" name="password1"><br>
<label>Password</label> <label>Password</label> <input type="password" name="password2"><br>
<input type="password" name="password1"></br> <label>Email </label> <input name="email"><br>
<label>Password</label>
<input type="password" name="password2"></br>
<label>Email</label>
<input name="email"></br>
<input type="submit" name="submit" value="Create User"> <input type="submit" name="submit" value="Create User">
</form> </form>
{% endblock %} {% endblock %}
+24 -20
View File
@@ -1,13 +1,15 @@
{% extends "OpenBench/base.html" %} {% extends "OpenBench/base.html" %}
{% load mytags %}
{% block content %} {% block content %}
{% if not tests %}
<form method="POST" action="/search/"> {% if not tests %}
<form method="POST" action="/search/">
{% csrf_token %} {% csrf_token %}
<label> Keywords </label>
<input name="keywords"></br> <label> Keywords </label> <input name="keywords"><br>
<label> Author </label> <label> Author </label> <input name="author"><br>
<input name="author"></br>
<label> Engine </label> <label> Engine </label>
<select name="engine"> <select name="engine">
<option selected value="">ALL</option> <option selected value="">ALL</option>
@@ -15,45 +17,47 @@
<option value="{{name}}">{{data.name}}</option> <option value="{{name}}">{{data.name}}</option>
{% endfor %} {% endfor %}
</select><br> </select><br>
<label> Show Passed </label> <label> Show Passed </label>
<select name="showgreens"> <select name="showgreens">
<option selected value="True">True</option> <option selected value="True">True</option>
<option value="False">False</option> <option value="False">False</option>
</select><br> </select><br>
<label> Show Failed </label> <label> Show Failed </label>
<select name="showyellows"> <select name="showyellows">
<option selected value="True">True</option> <option selected value="True">True</option>
<option value="False">False</option> <option value="False">False</option>
</select><br> </select><br>
<label> Show Neutral </label> <label> Show Neutral </label>
<select name="showreds"> <select name="showreds">
<option selected value="True">True</option> <option selected value="True">True</option>
<option value="False">False</option> <option value="False">False</option>
</select><br> </select><br>
<label> Show Stopped </label> <label> Show Stopped </label>
<select name="showunfinished"> <select name="showunfinished">
<option value="True">True</option> <option value="True">True</option>
<option selected value="False">False</option> <option selected value="False">False</option>
</select><br> </select><br>
<label> Show Deleted </label> <label> Show Deleted </label>
<select name="showdeleted"> <select name="showdeleted">
<option value="True">True</option> <option value="True">True</option>
<option selected value="False">False</option> <option selected value="False">False</option>
</select><br> </select><br>
<input type="submit" name="submit" value="Search Tests"> <input type="submit" name="submit" value="Search Tests">
</form>
{% endif %} </form>
<table class="datatable">
{% endif %}
<table class="datatable">
{% for test in tests %} {% for test in tests %}
<tr> {% include "OpenBench/Blocks/testsummary.html" %}
<td>{{test.creation|date:"y-m-d"}}</td>
<td class="numeric"><a href="/viewUser/{{test.author}}">{{test.author}}</a></td>
<td class="numeric">{{test.engine}}</td>
<td><a href="/viewTest/{{test.id}}">{{test.dev.name}}</a></td>
<td class="textcenter"><a href="{{test|gitDiffLink}}">diff</a></td>
<td>{{test.timecontrol}}</td>
<td class='statblock {{test|testResultColour}}'><strong>{{test|shortStatBlock|linebreaksbr}}</strong></td>
</tr>
{% endfor %} {% endfor %}
</table> </table>
{% endblock %} {% endblock %}
+11 -10
View File
@@ -1,22 +1,20 @@
{% extends "OpenBench/base.html" %} {% extends "OpenBench/base.html" %}
{% load mytags %} {% load mytags %} <!-- For sumAttributes() & insertCommas() -->
{% block style %}
{% load static %}
{% endblock %}
{% block content %} {% block content %}
<table class="summarytable">
<table class="summarytable">
<tr> <tr>
<th class="numeric"> OVERALL </th> <th class="numeric"> OVERALL </th>
<th class="numeric">| USERS {{ profiles|length }} </th> <th class="numeric">| USERS {{ profiles|length }} </th>
<th class="numeric">| TESTS {{ profiles|sumAttributes:"tests"|insertCommas }}</th> <th class="numeric">| TESTS {{ profiles|sumAttributes:"tests"|insertCommas }}</th>
<th class="numeric">| GAMES {{ profiles|sumAttributes:"games"|insertCommas }}</th> <th class="numeric">| GAMES {{ profiles|sumAttributes:"games"|insertCommas }}</th>
</tr> </tr>
</table> </table>
<br>
<table class="rawtable"> <table class="rawtable">
<tr> <tr>
<th>Username</th> <th>Username</th>
<th>Last Seen</th> <th>Last Seen</th>
@@ -25,6 +23,7 @@
<th>Engine</th> <th>Engine</th>
<th>Source Repository</th> <th>Source Repository</th>
</tr> </tr>
{% for profile in profiles %} {% for profile in profiles %}
<tr> <tr>
<td><a href="/viewUser/{{profile.user.username}}">{{profile.user.username}}</a></td> <td><a href="/viewUser/{{profile.user.username}}">{{profile.user.username}}</a></td>
@@ -35,5 +34,7 @@
<td><a href="{{profile.repo}}">{{profile.repo}}</a></td> <td><a href="{{profile.repo}}">{{profile.repo}}</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
<table>
</table>
{% endblock %} {% endblock %}
+16 -18
View File
@@ -1,24 +1,19 @@
{% extends "OpenBench/base.html" %} {% extends "OpenBench/base.html" %}
{% block style %}
{% load static %}
{% endblock %}
{% block content %} {% block content %}
<form method="POST" action="/editProfile/">
<form method="POST" action="/editProfile/">
{% csrf_token %} {% csrf_token %}
<label>Username</label>
<input readonly value="{{profile.user.username}}" name="username"></br> <!-- User definition. Everything may be changed but the Username -->
<label>Email</label> <label>Username </label> <input readonly value="{{profile.user.username}}" name="username"><br>
<input value="{{profile.user.email}}" name="email"></br> <label>Email </label> <input value="{{profile.user.email}}" name="email"><br>
<label>New Password</label> <label>Source Repo </label> <input value="{{profile.repo}}" name="repo"><br>
<input type="password" name="password1"></br> <label>New Password</label> <input type="password" name="password1"><br>
<label>New Password</label> <label>New Password</label> <input type="password" name="password2"><br>
<input type="password" name="password2"></br>
<label>Source Repo</label> <!-- User's have a default engine. Select the default, otherwise show an empty line -->
<input value="{{profile.repo}}" name="repo"></br> <label>Engine</label> <select id="enginename" name="enginename" onchange="configure(testMode)">
<label>Engine</label>
<select id="enginename" name="enginename" onchange="configure(testMode)">
{% for engine in config.engines %} {% for engine in config.engines %}
{% if profile.engine == engine %} {% if profile.engine == engine %}
<option selected value="{{engine}}">{{engine}}</option> <option selected value="{{engine}}">{{engine}}</option>
@@ -30,6 +25,9 @@
<option selected value=""></option> <option selected value=""></option>
{% endif %} {% endif %}
</select><br> </select><br>
<input type="submit" name="submit" value="Update Profile"> <input type="submit" name="submit" value="Update Profile">
</form>
</form>
{% endblock %} {% endblock %}
+47 -90
View File
@@ -7,84 +7,31 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="configuration">
<table class="rawtable">
<tr>
<td>Engine</td>
<td>{{test.engine}}</td>
</tr>
<tr>
<td>Dev Branch</td>
<td>{{test.dev.name}}</td>
</tr>
<tr>
<td>Dev Bench</td>
<td>{{test.dev.bench}}</td>
</tr>
<tr>
<td>Dev Options</td>
<td>{{test.devoptions}}</td>
</tr>
<tr>
<td>Dev Protocol</td>
<td>{{test.dev.protocol}}</td>
</tr>
<tr>
<td>Dev Sha</td>
<td>{{test.dev.sha}}</td>
</tr>
<tr>
<td>Base Branch</td>
<td>{{test.base.name}}</td>
</tr>
<tr>
<td>Base Bench</td>
<td>{{test.base.bench}}</td>
</tr>
<tr>
<td>Base Options</td>
<td>{{test.baseoptions}}</td>
</tr>
<tr>
<td>Base Protocol</td>
<td>{{test.base.protocol}}</td>
</tr>
<tr>
<td>Base Sha</td>
<td>{{test.base.sha}}</td>
</tr>
<tr>
<td>Source Repo</td>
<td>{{test.source}}</td>
</tr>
<tr>
<td>Opening Book</td>
<td>{{test.bookname}}</td>
</tr>
<tr>
<td>Time Control</td>
<td>{{test.timecontrol}}s</td>
</tr>
<tr>
<td>Elo Bounds</td>
<td>[{{test.elolower}}, {{test.eloupper}}]</td>
</tr>
<tr>
<td>SPRT Bounds</td>
<td>({{test.lowerllr|twoDigitPrecision}}, {{test.upperllr|twoDigitPrecision}})</td>
</tr>
<tr>
<td>Creation</td>
<td>{{test.creation|date:'Y-m-d H:i:s'}}</td>
</tr>
<tr>
<td>Author</td>
<td>{{test.author}}</td>
</tr>
</table>
</div>
<div id="actions"> <div id="configuration">
<table class="rawtable">
<tr><td>Engine</td><td>{{test.engine}}</td></tr>
<tr><td>Dev Branch</td><td>{{test.dev.name}}</td></tr>
<tr><td>Dev Bench</td><td>{{test.dev.bench}}</td></tr>
<tr><td>Dev Options</td><td>{{test.devoptions}}</td></tr>
<tr><td>Dev Protocol</td><td>{{test.dev.protocol}}</td></tr>
<tr><td>Dev Sha</td><td>{{test.dev.sha}}</td></tr>
<tr><td>Base Branch</td><td>{{test.base.name}}</td></tr>
<tr><td>Base Bench</td><td>{{test.base.bench}}</td></tr>
<tr><td>Base Options</td><td>{{test.baseoptions}}</td></tr>
<tr><td>Base Protocol</td><td>{{test.base.protocol}}</td></tr>
<tr><td>Base Sha</td><td>{{test.base.sha}}</td></tr>
<tr><td>Source Repo</td><td>{{test.source}}</td></tr>
<tr><td>Opening Book</td><td>{{test.bookname}}</td></tr>
<tr><td>Time Control</td><td>{{test.timecontrol}}s</td></tr>
<tr><td>Elo Bounds</td><td>[{{test.elolower}}, {{test.eloupper}}]</td></tr>
<tr><td>SPRT Bounds</td><td>({{test.lowerllr|twoDigitPrecision}}, {{test.upperllr|twoDigitPrecision}})</td></tr>
<tr><td>Creation</td><td>{{test.creation|date:'Y-m-d H:i:s'}}</td></tr>
<tr><td>Author</td><td>{{test.author}}</td></tr>
</table>
</div>
<div id="actions">
<h2>Actions</h2> <h2>Actions</h2>
@@ -132,36 +79,44 @@
<form method="POST" action="/editTest/{{test.id}}/"> <form method="POST" action="/editTest/{{test.id}}/">
{% csrf_token %} {% csrf_token %}
<label>Priority</label>
<input value="{{test.priority}}" name="priority"></br> <label>Priority</label><input value="{{test.priority}}" name="priority"><br>
<label>Throughput</label> <label>Throughput</label><input value="{{test.throughput}}" name="throughput"><br>
<input value="{{test.throughput}}" name="throughput"></br>
{% if profile.approver or profile.user.username == test.author %} {% if profile.approver or profile.user.username == test.author %}
<input type="submit" name="submit" value="Modify"> <input type="submit" name="submit" value="Modify">
{% else %} {% else %}
<input class="deadbutton" type="submit" name="submit" value="Modify"> <input class="deadbutton" type="submit" name="submit" value="Modify">
{% endif %} {% endif %}
</form>
</div>
<br>
<div id="results"> </form>
</div>
<br>
<div id="results">
<table class="datatable"> <table class="datatable">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Owner</th> <th>Owner</th>
<th>System</th>
<th>Last Updated</th> <th>Last Updated</th>
<th>Games</th> <th style="width: 60px">Games</th>
<th style="width: 60px">Win</th> <th style="width: 60px">Won</th>
<th style="width: 60px">Loss</th> <th style="width: 60px">Lost</th>
<th style="width: 60px">Draw</th> <th style="width: 60px">Drawn</th>
<th style="width: 60px">Time</th> <th style="width: 60px">Time</th>
<th style="width: 60px">Crash</th> <th style="width: 60px">Crash</th>
</tr> </tr>
{% for result in results %} {% for result in results %}
<tr> <tr>
<td>{{result.machine.id}}</td> <td>{{result.machine.id}}</td>
<td>{{result.machine.owner}}</td> <td>{{result.machine.owner}}</td>
<td>{{result.machine.osname|truncatewords:1|slice:":-4"}}</td>
<td>{{result.updated|date:'Y-m-d H:i'}}</td> <td>{{result.updated|date:'Y-m-d H:i'}}</td>
<td class="numeric">{{result.games}}</td> <td class="numeric">{{result.games}}</td>
<td class="numeric">{{result.wins}}</td> <td class="numeric">{{result.wins}}</td>
@@ -171,7 +126,9 @@
<td class="numeric">{{result.crashes}}</td> <td class="numeric">{{result.crashes}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div>
</div>
{% endblock %} {% endblock %}