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
+542 -597

No files matched your search

+26 -20
View File
@@ -27,36 +27,42 @@ FRAMEWORK_DEFAULTS = {
'engines' : {
'Ethereal' : {
'name' : 'Ethereal',
'source' : 'https://github.com/AndyGrant/Ethereal',
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
'nps' : 1500000,
'proto' : 'uci',
'proto' : 'uci',
'nps' : 1500000,
'name' : 'Ethereal',
'source' : 'https://github.com/AndyGrant/Ethereal',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
},
},
'Laser' : {
'proto' : 'uci',
'nps' : 625000,
'name' : 'Laser',
'source' : 'https://github.com/jeffreyan11/uci-chess-engine',
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
'nps' : 625000,
'proto' : 'uci',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
},
},
'Weiss' : {
'proto' : 'uci',
'nps' : 4000000,
'name' : 'Weiss',
'source' : 'https://github.com/TerjeKir/weiss',
'stc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 128, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 512, 'timecontrol' : '20.0+0.2' },
'nps' : 4000000,
'proto' : 'uci',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 128, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 512, 'timecontrol' : '20.0+0.2' },
},
},
},
+4 -2
View File
@@ -101,8 +101,10 @@ a:link, a:visited, a:hover, a:active {
}
#content .summarytable th {
padding-top: 20px;
padding-right: 10px;
font-size: 20px;
padding-bottom: 20px;
font-size: 16px;
color: #00CCFF;
}
@@ -120,7 +122,7 @@ a:link, a:visited, a:hover, a:active {
}
#content #actions {
float: left;
float: right;
}
#content #actions .anchorbutton {
+7 -6
View File
@@ -98,9 +98,10 @@ def editProfile(request):
profile.user.email = request.POST['email']
profile.engine = request.POST['enginename']
profile.repo = request.POST['repo']
profile.user.save()
profile.save()
# Change Passwords
# Change Passwords if requested
password1 = request.POST['password1']
password2 = request.POST['password2']
if password1 != '' and password1 == password2:
@@ -110,8 +111,8 @@ def editProfile(request):
username=request.user.username,
password=password1))
# Send back to see the changes
return HttpResponseRedirect('/viewProfile/')
# Send back to see the homepage
return HttpResponseRedirect('/index/')
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)}
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
events = LogEvent.objects.all().order_by('-id')
items = len(events)
start = page * pageLength
end = start + pageLength
start = max(0, min(start, items))
end = max(0, min(end, items))
start = max(1, min(start, items))
end = max(1, min(end, items))
paging = pagingContext(page, pageLength, items, 'eventLog')
# 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>
+66 -58
View File
@@ -1,69 +1,77 @@
<!DOCTYPE html>
<html lang="en">
{% load static %}
{% load static %}
<head>
<link rel="stylesheet" href="{% static 'style.css' %}">
<title>OpenBench</title>
<script>
{% block scripts %}
{% endblock %}
</script>
</head>
<body>
<head>
<link rel="stylesheet" href="{% static 'style.css' %}">
<title>OpenBench</title>
<script>
{% block scripts %}
{% endblock %}
</script>
</head>
<body>
<!-- Views may return an error message -->
{% if error %}
<div id="error">
<strong>{{error}}</strong>
</div>
{% endif %}
<!-- Tell unauthenticated users to contact the Admin -->
{% if request.user.is_authenticated and not profile.enabled %}
<div id="error">
<strong>{{profile.user.username}}! Your account is not enabled.</strong>
<strong>Contact the Admin ( {{config.serveradmin}} )</strong>
</div>
{% endif %}
<div id="sidebar">
<ul>
<li class="header">ADMIN</li>
{% if user.is_authenticated %}
<li><a href="/logout/">Logout</a></li>
<li><a href="/viewProfile/">Profile</a></li>
{% else %}
<li><a href="/login">Login </a></li>
<li><a href="/register">Register</a></li>
{% endif %}
</ul>
<ul>
<li class="header">TESTS</li>
<li><a href="/index">Index</a></li>
<li><a href="/greens">Greens</a></li>
<li><a href="/search">Search</a></li>
<li><a href="/newTest">New Test</a></li>
</ul>
<ul>
<li class="header">INFO</li>
<li><a href="/users">Users</a></li>
<li><a href="/eventLog">Events</a></li>
<li><a href="/machines">Machines</a></li>
<li><a href="{{config.framework}}">OpenBench</a></li>
</ul>
<ul>
<li class="header">ENGINES</li>
{% for engine, data in config.engines.items|dictsort:"0.lower" %}
<li><a href="{{data.source}}">{{data.name}}</a></li>
{% endfor %}
</ul>
{% if error %}
<div id="error">
<strong>{{error}}</strong>
</div>
{% endif %}
{% if request.user.is_authenticated and not profile.enabled %}
<div id="error">
<strong>{{profile.user.username}}! Your account is not enabled.</strong>
<strong>Contact the Admin ( {{config.serveradmin}} )</strong>
<div id="content">
{% block content %}
{% endblock %}
</div>
{% endif %}
<div id="sidebar">
{% block sidebar %}
<ul>
<li class="header">ADMIN</li>
{% if user.is_authenticated %}
<li><a href="/logout/">Logout</a></li>
<li><a href="/viewProfile/">Profile</a></li>
{% else %}
<li><a href="/login">Login </a></li>
<li><a href="/register">Register</a></li>
{% endif %}
</ul>
<ul>
<li class="header">TESTS</li>
<li><a href="/index">Index</a></li>
<li><a href="/greens">Greens</a></li>
<li><a href="/search">Search</a></li>
<li><a href="/newTest">New Test</a></li>
</ul>
<ul>
<li class="header">INFO</li>
<li><a href="/users">Users</a></li>
<li><a href="/eventLog">Events</a></li>
<li><a href="/machines">Machines</a></li>
<li><a href="{{config.framework}}">OpenBench</a></li>
</ul>
<ul>
<li class="header">ENGINES</li>
{% for engine, data in config.engines.items|dictsort:"0.lower" %}
<li><a href="{{data.source}}">{{data.name}}</a></li>
{% endfor %}
</ul>
{% endblock %}
</div>
<div id="content">
{% block content %}
{% endblock %}
</div>
</body>
</body>
</html>
+22 -32
View File
@@ -1,37 +1,27 @@
{% extends "OpenBench/base.html" %}
{% block style %}
{% load static %}
{% endblock %}
{% block content %}
<table class="rawtable">
<tr>
<th>Date</th>
<th>User</th>
<th>Test</th>
<th>Action</th>
</tr>
{% for event in events %}
<tr>
<td>{{event.creation|date:'Y-m-d H:i:s'}}</td>
<td>{{event.author}}</td>
<td><a href="/viewTest/{{event.test.id}}">{{event.test.dev.name}}</a></td>
<td>{{event.data}}</td>
</tr>
{% endfor %}
<table>
<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 %}
<table class="rawtable">
<tr>
<th>Date</th>
<th>User</th>
<th>Test</th>
<th>Action</th>
</tr>
{% for event in events %}
<tr>
<td>{{event.creation|date:'Y-m-d H:i:s'}}</td>
<td>{{event.author}}</td>
<td><a href="/viewTest/{{event.test.id}}">{{event.test.dev.name}}</a></td>
<td>{{event.data}}</td>
</tr>
{% endfor %}
<a class="page" href="/{{paging.url}}/{{paging.next}}">--&gt;</a>
{% endif %}
</div>
<table>
{% include "OpenBench/Blocks/pagebrowser.html" %}
{% endblock %}
+31 -51
View File
@@ -1,58 +1,38 @@
{% extends "OpenBench/base.html" %}
{% load mytags %}
{% block content %}
<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>
<table class="datatable">
<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>
<!-- Only show Pending tests for the front page of the Index -->
{% if paging.page == 1 and greens == False %}
<!-- Currently Pending tests (Waiting to be approved) -->
<tr><td class="embedded" colspan='6'><h2>Pending</h2></td></tr>
{% for test in pending %}
{% include "OpenBench/Blocks/testsummary.html" %}
{% endfor %}
<!-- Show Worker information when running a test -->
{% if active %}
<tr><td class="embedded" colspan='6'><h2>Active {{status}}</h2></td></tr>
{% endif %}
<!-- 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 %}
<a class="page" href="/{{paging.url}}/{{paging.next}}">--&gt;</a>
{% endif %}
</div>
</table>
{% include "OpenBench/Blocks/pagebrowser.html" %}
{% endblock %}
+8 -12
View File
@@ -1,16 +1,12 @@
{% extends "OpenBench/base.html" %}
{% block style %}
{% load static %}
{% endblock %}
{% block content %}
<form method="POST" action="/login/">
{% csrf_token %}
<label type="text">Username</label>
<input type="text" name="username"></br>
<label type="text">Password</label>
<input type="password" name="password"></br>
<input type="submit" name="submit" value="Login">
</form>
<form method="POST" action="/login/">
{% csrf_token %}
<label type="text">Username</label> <input type="text" name="username"><br>
<label type="text">Password</label> <input type="password" name="password"><br>
<input type="submit" name="submit" value="Login">
</form>
{% endblock %}
+27 -27
View File
@@ -1,33 +1,33 @@
{% extends "OpenBench/base.html" %}
{% load mytags %}
{% block style %}
{% load static %}
{% endblock %}
{% load mytags %} <!-- For twoDigitPrecision() -->
{% block content %}
<table class="rawtable">
<tr>
<th>ID</th>
<th>User</th>
<th>System</th>
<th>Updated</th>
<th>Workload</th>
<th>Threads</th>
<th>MNPS</th>
</tr>
{% for machine in machines %}
<tr>
<td class="numeric">{{machine.id}}</td>
<td>{{machine.owner}}</td>
<td>{{machine.osname}}</td>
<td>{{machine.updated|date:'Y-m-d H:i'}}</td>
<td> <a href="/viewTest/{{machine.workload.id}}">{{machine.workload.dev.name}}</a></td>
<td class="numeric">{{machine.threads}}</td>
<td class="numeric">{{machine.mnps|twoDigitPrecision}}</td>
</tr>
{% endfor %}
</table>
<table class="rawtable">
<tr>
<th>ID</th>
<th>User</th>
<th>System</th>
<th>Updated</th>
<th>Workload</th>
<th>Threads</th>
<th>MNPS</th>
</tr>
{% for machine in machines %}
<tr>
<td class="numeric">{{machine.id}}</td>
<td>{{machine.owner}}</td>
<td>{{machine.osname}}</td>
<td>{{machine.updated|date:'Y-m-d H:i'}}</td>
<td> <a href="/viewTest/{{machine.workload.id}}">{{machine.workload.dev.name}}</a></td>
<td class="numeric">{{machine.threads}}</td>
<td class="numeric">{{machine.mnps|twoDigitPrecision}}</td>
</tr>
{% endfor %}
</table>
{% endblock %}
+82 -96
View File
@@ -1,40 +1,26 @@
{% extends "OpenBench/base.html" %}
{% 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 = {
{% for name, data in config.engines.items %}
'{{name}}' : {
'stc' : {
"threads" : "{{data.stc.threads}}",
"hash" : "{{data.stc.hash}}",
"timecontrol" : "{{data.stc.timecontrol}}"
'{{name}}' : {
{% for type, settings in data.testmodes.items %}
'{{type}}' : {
"threads" : "{{settings.threads}}",
"hash" : "{{settings.hash}}",
"timecontrol" : "{{settings.timecontrol}}"
},
{% endfor %}
},
'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 %}
};
function configure(mode) {
// Update global test mode
testMode = mode;
// Find the selected engine
var selection = document.getElementById("enginename");
var engine = selection.options[selection.selectedIndex].value;
@@ -49,76 +35,76 @@
document.getElementById("baseoptions").value = "Threads=" + threads + " Hash=" + hash;
document.getElementById("timecontrol").value = timecontrol;
}
{% endblock %}
{% block content %}
<form method="POST" action="/newTest/">
{% csrf_token %}
<div class="settings-column">
<h3> Engine </h3>
<label> Name </label>
<select id="enginename" name="enginename" onchange="configure(testMode)">
{% for engine in config.engines %}
{% if engine == profile.engine %}
<option selected value="{{engine}}">{{engine}}</option>
{% else %}
<option value="{{engine}}">{{engine}}</option>
{% endif %}
{% endfor %}
<option value="{{engine}}">{{engine}}</option>
</select><br>
<label> Source </label>
<input value="{{profile.repo}}" name="source"></br>
<h3> Dev Settings </h3>
<label> Bench </label>
<input name="devbench"></br>
<label> Branch </label>
<input name="devbranch" autofocus></br>
<label> Options </label>
<input id="devoptions" name="devoptions"></br>
<h3> Base Settings </h3>
<label> Bench </label>
<input name="basebench"></br>
<label> Branch </label>
<input value="master" name="basebranch"></br>
<label> Options </label>
<input id="baseoptions" name="baseoptions"></br>
</div>
<div class="settings-column">
<h3> Game Settings </h3>
<label> Book </label>
<select name="bookname">
{% for name, data in config.books.items %}
{% if data.default %}
<option selected value="{{name}}">{{data.name}}</option>
{% else %}
<option value="{{name}}">{{data.name}}</option>
{% endif %}
{% endfor %}
</select></br>
<label> Time </label>
<input id="timecontrol" name="timecontrol"></br>
<h3> SPRT Settings </h3>
<label> Lower </label>
<input value="{{config.sprt.elolower}}" name="elolower"></br>
<label> Upper </label>
<input value="{{config.sprt.eloupper}}" name="eloupper"></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>
<label> Priority </label>
<input value="0" name="priority"></br>
<label> Throughput </label>
<input value="1000" name="throughput"></br>
</div>
<br><input type="submit" name="submit" value="Create Engine Test"><br>
</form>
<div id="test-mode-buttons">
<button class="left-floated"onClick="configure('stc')">Setup STC</button>
<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 %}
{% block content %}
<form method="POST" action="/newTest/">
{% csrf_token %}
<div class="settings-column">
<h3> Engine </h3>
<label> Name </label> <select id="enginename" name="enginename">
{% for engine in config.engines %}
{% if engine == profile.engine %}
<option selected value="{{engine}}">{{engine}}</option>
{% else %}
<option value="{{engine}}">{{engine}}</option>
{% endif %}
{% endfor %}
<option value="{{engine}}">{{engine}}</option>
</select><br>
<label> Source </label> <input value="{{profile.repo}}" name="source"><br>
<h3> Dev Settings </h3>
<label> Bench </label> <input name="devbench"><br>
<label> Branch </label> <input name="devbranch" autofocus><br>
<label> Options </label> <input id="devoptions" name="devoptions"><br>
<h3> Base Settings </h3>
<label> Bench </label> <input name="basebench"><br>
<label> Branch </label> <input value="master" name="basebranch"><br>
<label> Options </label> <input id="baseoptions" name="baseoptions"><br>
</div>
<div class="settings-column">
<h3> Game Settings </h3>
<label> Book </label> <select name="bookname">
{% for name, data in config.books.items %}
{% if data.default %}
<option selected value="{{name}}">{{data.name}}</option>
{% else %}
<option value="{{name}}">{{data.name}}</option>
{% endif %}
{% endfor %}
</select><br>
<label> Time </label> <input id="timecontrol" name="timecontrol"><br>
<h3> SPRT Settings </h3>
<label> Lower </label> <input value="{{config.sprt.elolower}}" name="elolower"><br>
<label> Upper </label> <input value="{{config.sprt.eloupper}}" name="eloupper"><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>
<label> Priority </label> <input value="0" name="priority"><br>
<label> Throughput </label> <input value="1000" name="throughput"><br>
</div>
<br><input type="submit" name="submit" value="Create Engine Test">
</form>
<div id="test-mode-buttons">
<button class="left-floated" onClick="configure('stc')">Setup STC</button>
<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 %}
+10 -16
View File
@@ -1,20 +1,14 @@
{% extends "OpenBench/base.html" %}
{% block style %}
{% load static %}
{% endblock %}
{% block content %}
<form id="registerForm" method="POST" action="/register/">
{% csrf_token %}
<label>Username</label>
<input name="username"></br>
<label>Password</label>
<input type="password" name="password1"></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">
</form>
<form id="registerForm" method="POST" action="/register/">
{% csrf_token %}
<label>Username</label> <input name="username"><br>
<label>Password</label> <input type="password" name="password1"><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">
</form>
{% endblock %}
+59 -55
View File
@@ -1,59 +1,63 @@
{% extends "OpenBench/base.html" %}
{% load mytags %}
{% block content %}
{% if not tests %}
<form method="POST" action="/search/">
{% csrf_token %}
<label> Keywords </label>
<input name="keywords"></br>
<label> Author </label>
<input name="author"></br>
<label> Engine </label>
<select name="engine">
<option selected value="">ALL</option>
{% for name, data in config.engines.items %}
<option value="{{name}}">{{data.name}}</option>
{% if not tests %}
<form method="POST" action="/search/">
{% csrf_token %}
<label> Keywords </label> <input name="keywords"><br>
<label> Author </label> <input name="author"><br>
<label> Engine </label>
<select name="engine">
<option selected value="">ALL</option>
{% for name, data in config.engines.items %}
<option value="{{name}}">{{data.name}}</option>
{% endfor %}
</select><br>
<label> Show Passed </label>
<select name="showgreens">
<option selected value="True">True</option>
<option value="False">False</option>
</select><br>
<label> Show Failed </label>
<select name="showyellows">
<option selected value="True">True</option>
<option value="False">False</option>
</select><br>
<label> Show Neutral </label>
<select name="showreds">
<option selected value="True">True</option>
<option value="False">False</option>
</select><br>
<label> Show Stopped </label>
<select name="showunfinished">
<option value="True">True</option>
<option selected value="False">False</option>
</select><br>
<label> Show Deleted </label>
<select name="showdeleted">
<option value="True">True</option>
<option selected value="False">False</option>
</select><br>
<input type="submit" name="submit" value="Search Tests">
</form>
{% endif %}
<table class="datatable">
{% for test in tests %}
{% include "OpenBench/Blocks/testsummary.html" %}
{% endfor %}
</select><br>
<label> Show Passed </label>
<select name="showgreens">
<option selected value="True">True</option>
<option value="False">False</option>
</select><br>
<label> Show Failed </label>
<select name="showyellows">
<option selected value="True">True</option>
<option value="False">False</option>
</select><br>
<label> Show Neutral </label>
<select name="showreds">
<option selected value="True">True</option>
<option value="False">False</option>
</select><br>
<label> Show Stopped </label>
<select name="showunfinished">
<option value="True">True</option>
<option selected value="False">False</option>
</select><br>
<label> Show Deleted </label>
<select name="showdeleted">
<option value="True">True</option>
<option selected value="False">False</option>
</select><br>
<input type="submit" name="submit" value="Search Tests">
</form>
{% endif %}
<table class="datatable">
{% for test in tests %}
<tr>
<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 %}
</table>
</table>
{% endblock %}
+35 -34
View File
@@ -1,39 +1,40 @@
{% extends "OpenBench/base.html" %}
{% load mytags %}
{% block style %}
{% load static %}
{% endblock %}
{% load mytags %} <!-- For sumAttributes() & insertCommas() -->
{% block content %}
<table class="summarytable">
<tr>
<th class="numeric"> OVERALL </th>
<th class="numeric">| USERS {{ profiles|length }} </th>
<th class="numeric">| TESTS {{ profiles|sumAttributes:"tests"|insertCommas }}</th>
<th class="numeric">| GAMES {{ profiles|sumAttributes:"games"|insertCommas }}</th>
</tr>
</table>
<br>
<table class="rawtable">
<tr>
<th>Username</th>
<th>Last Seen</th>
<th class="numeric">Games</th>
<th class="numeric">Tests</th>
<th>Engine</th>
<th>Source Repository</th>
</tr>
{% for profile in profiles %}
<tr>
<td><a href="/viewUser/{{profile.user.username}}">{{profile.user.username}}</a></td>
<td>{{profile.updated|date:'Y-m-d'}}</td>
<td class="numeric">{{profile.games}}</td>
<td class="numeric">{{profile.tests}}</td>
<td>{{profile.engine}}</td>
<td><a href="{{profile.repo}}">{{profile.repo}}</a></td>
</tr>
{% endfor %}
<table>
<table class="summarytable">
<tr>
<th class="numeric"> OVERALL </th>
<th class="numeric">| USERS {{ profiles|length }} </th>
<th class="numeric">| TESTS {{ profiles|sumAttributes:"tests"|insertCommas }}</th>
<th class="numeric">| GAMES {{ profiles|sumAttributes:"games"|insertCommas }}</th>
</tr>
</table>
<table class="rawtable">
<tr>
<th>Username</th>
<th>Last Seen</th>
<th class="numeric">Games</th>
<th class="numeric">Tests</th>
<th>Engine</th>
<th>Source Repository</th>
</tr>
{% for profile in profiles %}
<tr>
<td><a href="/viewUser/{{profile.user.username}}">{{profile.user.username}}</a></td>
<td>{{profile.updated|date:'Y-m-d'}}</td>
<td class="numeric">{{profile.games}}</td>
<td class="numeric">{{profile.tests}}</td>
<td>{{profile.engine}}</td>
<td><a href="{{profile.repo}}">{{profile.repo}}</a></td>
</tr>
{% endfor %}
</table>
{% endblock %}
+29 -31
View File
@@ -1,35 +1,33 @@
{% extends "OpenBench/base.html" %}
{% block style %}
{% load static %}
{% endblock %}
{% block content %}
<form method="POST" action="/editProfile/">
{% csrf_token %}
<label>Username</label>
<input readonly value="{{profile.user.username}}" name="username"></br>
<label>Email</label>
<input value="{{profile.user.email}}" name="email"></br>
<label>New Password</label>
<input type="password" name="password1"></br>
<label>New Password</label>
<input type="password" name="password2"></br>
<label>Source Repo</label>
<input value="{{profile.repo}}" name="repo"></br>
<label>Engine</label>
<select id="enginename" name="enginename" onchange="configure(testMode)">
{% for engine in config.engines %}
{% if profile.engine == engine %}
<option selected value="{{engine}}">{{engine}}</option>
{% else %}
<option value="{{engine}}">{{engine}}</option>
{% endif %}
{% endfor %}
{% if not profile.engine %}
<option selected value=""></option>
{% endif %}
</select><br>
<input type="submit" name="submit" value="Update Profile">
</form>
<form method="POST" action="/editProfile/">
{% csrf_token %}
<!-- User definition. Everything may be changed but the Username -->
<label>Username </label> <input readonly value="{{profile.user.username}}" name="username"><br>
<label>Email </label> <input value="{{profile.user.email}}" name="email"><br>
<label>Source Repo </label> <input value="{{profile.repo}}" name="repo"><br>
<label>New Password</label> <input type="password" name="password1"><br>
<label>New Password</label> <input type="password" name="password2"><br>
<!-- User's have a default engine. Select the default, otherwise show an empty line -->
<label>Engine</label> <select id="enginename" name="enginename" onchange="configure(testMode)">
{% for engine in config.engines %}
{% if profile.engine == engine %}
<option selected value="{{engine}}">{{engine}}</option>
{% else %}
<option value="{{engine}}">{{engine}}</option>
{% endif %}
{% endfor %}
{% if not profile.engine %}
<option selected value=""></option>
{% endif %}
</select><br>
<input type="submit" name="submit" value="Update Profile">
</form>
{% endblock %}
+114 -157
View File
@@ -7,171 +7,128 @@
{% endblock %}
{% 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>
<h2>Actions</h2>
<div id="actions">
<!-- Approve Button: For Admins, or Cross-approvers -->
{% if not test.approved and profile.approver and profile.user.username != test.author %}
<a class="anchorbutton" id="approvebutton" href="/approveTest/{{test.id}}/">Approve</a>
{% elif not test.approved and request.user.is_superuser %}
<a class="anchorbutton" id="approvebutton" href="/approveTest/{{test.id}}/">Approve</a>
{% else %}
<a class="anchorbutton deadbutton">Approve</a>
{% endif %}
<h2>Actions</h2>
<!-- Restart Button: For Approvers or Test Authors of finished tests -->
{% if test.finished and profile.approver %}
<a class="anchorbutton" id="stopbutton" href="/restartTest/{{test.id}}/">Restart</a>
{% elif test.finished and profile.user.username == test.author %}
<a class="anchorbutton" id="stopbutton" href="/restartTest/{{test.id}}/">Restart</a>
{% elif test.finished %}
<a class="anchorbutton deadbutton">Restart</a>
{% endif %}
<!-- Stop Button: For Approvers or Test Authors of active tests -->
{% if not test.finished and profile.approver %}
<a class="anchorbutton" id="restartbutton" href="/stopTest/{{test.id}}/">Stop</a>
{% elif not test.finished and profile.user.username == test.author %}
<a class="anchorbutton" id="restartbutton" href="/stopTest/{{test.id}}/">Stop</a>
{% elif not test.finished %}
<a class="anchorbutton deadbutton">Stop</a>
{% endif %}
<!-- Delete Button: For Approvers or Test Authors -->
{% if profile.approver or profile.user.username == test.author %}
<a class="anchorbutton" id="deletebutton" href="/deleteTest/{{test.id}}/">Delete</a>
{% else %}
<a class="anchorbutton deadbutton">Delete</a>
{% endif %}
<!-- Dev vs Base [Git Diff Link] -->
<h4>{{test.dev.name}} vs {{test.base.name}}
<a href="{{test|gitDiffLink}}">DIFF</a>
</h4>
<!-- ELO, SPRT, LLR, Games -->
<pre>{{test|longStatBlock|linebreaksbr}}</pre>
<form method="POST" action="/editTest/{{test.id}}/">
{% csrf_token %}
<label>Priority</label>
<input value="{{test.priority}}" name="priority"></br>
<label>Throughput</label>
<input value="{{test.throughput}}" name="throughput"></br>
{% if profile.approver or profile.user.username == test.author %}
<input type="submit" name="submit" value="Modify">
<!-- Approve Button: For Admins, or Cross-approvers -->
{% if not test.approved and profile.approver and profile.user.username != test.author %}
<a class="anchorbutton" id="approvebutton" href="/approveTest/{{test.id}}/">Approve</a>
{% elif not test.approved and request.user.is_superuser %}
<a class="anchorbutton" id="approvebutton" href="/approveTest/{{test.id}}/">Approve</a>
{% else %}
<input class="deadbutton" type="submit" name="submit" value="Modify">
<a class="anchorbutton deadbutton">Approve</a>
{% endif %}
</form>
</div>
<br>
<div id="results">
<table class="datatable">
<tr>
<th>ID</th>
<th>Owner</th>
<th>Last Updated</th>
<th>Games</th>
<th style="width: 60px">Win</th>
<th style="width: 60px">Loss</th>
<th style="width: 60px">Draw</th>
<th style="width: 60px">Time</th>
<th style="width: 60px">Crash</th>
</tr>
{% for result in results %}
<!-- Restart Button: For Approvers or Test Authors of finished tests -->
{% if test.finished and profile.approver %}
<a class="anchorbutton" id="stopbutton" href="/restartTest/{{test.id}}/">Restart</a>
{% elif test.finished and profile.user.username == test.author %}
<a class="anchorbutton" id="stopbutton" href="/restartTest/{{test.id}}/">Restart</a>
{% elif test.finished %}
<a class="anchorbutton deadbutton">Restart</a>
{% endif %}
<!-- Stop Button: For Approvers or Test Authors of active tests -->
{% if not test.finished and profile.approver %}
<a class="anchorbutton" id="restartbutton" href="/stopTest/{{test.id}}/">Stop</a>
{% elif not test.finished and profile.user.username == test.author %}
<a class="anchorbutton" id="restartbutton" href="/stopTest/{{test.id}}/">Stop</a>
{% elif not test.finished %}
<a class="anchorbutton deadbutton">Stop</a>
{% endif %}
<!-- Delete Button: For Approvers or Test Authors -->
{% if profile.approver or profile.user.username == test.author %}
<a class="anchorbutton" id="deletebutton" href="/deleteTest/{{test.id}}/">Delete</a>
{% else %}
<a class="anchorbutton deadbutton">Delete</a>
{% endif %}
<!-- Dev vs Base [Git Diff Link] -->
<h4>{{test.dev.name}} vs {{test.base.name}}
<a href="{{test|gitDiffLink}}">DIFF</a>
</h4>
<!-- ELO, SPRT, LLR, Games -->
<pre>{{test|longStatBlock|linebreaksbr}}</pre>
<form method="POST" action="/editTest/{{test.id}}/">
{% csrf_token %}
<label>Priority</label><input value="{{test.priority}}" name="priority"><br>
<label>Throughput</label><input value="{{test.throughput}}" name="throughput"><br>
{% if profile.approver or profile.user.username == test.author %}
<input type="submit" name="submit" value="Modify">
{% else %}
<input class="deadbutton" type="submit" name="submit" value="Modify">
{% endif %}
</form>
</div>
<br>
<div id="results">
<table class="datatable">
<tr>
<td>{{result.machine.id}}</td>
<td>{{result.machine.owner}}</td>
<td>{{result.updated|date:'Y-m-d H:i'}}</td>
<td class="numeric">{{result.games}}</td>
<td class="numeric">{{result.wins}}</td>
<td class="numeric">{{result.losses}}</td>
<td class="numeric">{{result.draws}}</td>
<td class="numeric">{{result.timeloss}}</td>
<td class="numeric">{{result.crashes}}</td>
<th>ID</th>
<th>Owner</th>
<th>System</th>
<th>Last Updated</th>
<th style="width: 60px">Games</th>
<th style="width: 60px">Won</th>
<th style="width: 60px">Lost</th>
<th style="width: 60px">Drawn</th>
<th style="width: 60px">Time</th>
<th style="width: 60px">Crash</th>
</tr>
{% endfor %}
</table>
</div>
{% for result in results %}
<tr>
<td>{{result.machine.id}}</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 class="numeric">{{result.games}}</td>
<td class="numeric">{{result.wins}}</td>
<td class="numeric">{{result.losses}}</td>
<td class="numeric">{{result.draws}}</td>
<td class="numeric">{{result.timeloss}}</td>
<td class="numeric">{{result.crashes}}</td>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}