From a59a797a9f0fc667a9ab20cc26d04a5e210929de Mon Sep 17 00:00:00 2001 From: Andrew Grant Date: Tue, 15 Dec 2020 14:20:07 -0500 Subject: [PATCH] Optional cross-approval; add long-lost git diff link --- OpenBench/config.py | 3 ++- OpenBench/static/style.css | 7 ++++++- OpenBench/views.py | 6 ++++++ Templates/OpenBench/test.html | 6 +++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/OpenBench/config.py b/OpenBench/config.py index d54bb1b..5ccd160 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -18,6 +18,8 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +USE_CROSS_APPROVAL = False + OPENBENCH_CONFIG = { 'error' : { @@ -25,7 +27,6 @@ OPENBENCH_CONFIG = { 'fakeuser' : 'This is not a real OpenBench User. Create an OpenBench account', }, - # Link to the repo on the sidebar, as well as the core files 'framework' : 'http://github.com/AndyGrant/OpenBench/', 'corefiles' : 'http://github.com/AndyGrant/OpenBench/raw/master/CoreFiles/', diff --git a/OpenBench/static/style.css b/OpenBench/static/style.css index b862d26..833f32a 100644 --- a/OpenBench/static/style.css +++ b/OpenBench/static/style.css @@ -102,7 +102,12 @@ a:link, a:visited, a:hover, a:active { #content #actions { margin-left: 32px; float: right; - margin-top: 60px; +} + +#content #actions h4 { + color: #A2A2A2; + font-size: 15px; + font-weight: bold; } #content #actions .anchorbutton { diff --git a/OpenBench/views.py b/OpenBench/views.py index 1f57b20..dd812b8 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -420,6 +420,7 @@ def newTest(request): return index(request, error='\n'.join(errors)) username = request.user.username + profile = Profile.objects.get(user=request.user) LogEvent.objects.create(data="CREATE", author=username, test=test) approved = Test.objects.filter(approved=True) @@ -433,6 +434,11 @@ def newTest(request): action = "AUTOAPP P={0} TP={1}".format(test.priority, test.throughput) LogEvent.objects.create(data=action, author=username, test=test) + elif not OpenBench.config.USE_CROSS_APPROVAL and profile.approver: + test.approved = True; test.save() + action = "APPROVE P={0} TP={1}".format(test.priority, test.throughput) + LogEvent.objects.create(data=action, author=username, test=test) + return django.http.HttpResponseRedirect('/index/') diff --git a/Templates/OpenBench/test.html b/Templates/OpenBench/test.html index 6b5c889..6a72f68 100644 --- a/Templates/OpenBench/test.html +++ b/Templates/OpenBench/test.html @@ -37,6 +37,11 @@
+ + +

{{test.dev.name|prettyName}} vs {{test.base.name|prettyName}}

+
+ {% if not test.approved and profile.approver and profile.user.username != test.author %} Approve @@ -74,7 +79,6 @@
{{test|longStatBlock|linebreaksbr}}
-