Wire the UX layer into views.py and base.html
This commit is contained in:
1 parent
2b06146e7c
commit
e76aa8a977
2 files changed
+17
-5
No files matched your search
+15
-5
@@ -26,6 +26,7 @@ import django.contrib.auth
|
|||||||
|
|
||||||
import OpenBench.config
|
import OpenBench.config
|
||||||
import OpenBench.utils
|
import OpenBench.utils
|
||||||
|
import OpenBench.uiutils
|
||||||
|
|
||||||
from OpenBench.workloads.create_workload import create_workload
|
from OpenBench.workloads.create_workload import create_workload
|
||||||
from OpenBench.workloads.get_workload import get_workload
|
from OpenBench.workloads.get_workload import get_workload
|
||||||
@@ -417,16 +418,25 @@ def search(request):
|
|||||||
|
|
||||||
def users(request):
|
def users(request):
|
||||||
|
|
||||||
data = { 'profiles' : Profile.objects.select_related('user').order_by('-games', '-tests') }
|
data = OpenBench.uiutils.users_context(request)
|
||||||
return render(request, 'users.html', data)
|
return render(request, 'users.html', data)
|
||||||
|
|
||||||
def event(request, id):
|
def event(request, id):
|
||||||
|
|
||||||
|
log_event = LogEvent.objects.filter(id=id).first()
|
||||||
|
if log_event is None:
|
||||||
|
return redirect(request, '/errors/', error='No such event exists')
|
||||||
|
|
||||||
|
# Not every event has a log attached ( admin actions, some bench failures )
|
||||||
|
content = ''
|
||||||
|
if log_event.log_file:
|
||||||
try:
|
try:
|
||||||
with open(os.path.join(MEDIA_ROOT, LogEvent.objects.get(id=id).log_file)) as fin:
|
with open(os.path.join(MEDIA_ROOT, log_event.log_file), encoding='utf-8', errors='replace') as fin:
|
||||||
return render(request, 'event.html', { 'content' : fin.read() })
|
content = fin.read()
|
||||||
except:
|
except OSError:
|
||||||
return redirect(request, '/index/', error='No logs for event exist')
|
content = ''
|
||||||
|
|
||||||
|
return render(request, 'event.html', OpenBench.uiutils.event_context(log_event, content))
|
||||||
|
|
||||||
def events_actions(request, page=1):
|
def events_actions(request, page=1):
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
<link rel="stylesheet" href="{% static 'base.css' %}?{{ static_version }}">
|
<link rel="stylesheet" href="{% static 'base.css' %}?{{ static_version }}">
|
||||||
<link rel="stylesheet" href="{% static 'form.css' %}?{{ static_version }}">
|
<link rel="stylesheet" href="{% static 'form.css' %}?{{ static_version }}">
|
||||||
<link rel="stylesheet" href="{% static 'paging.css' %}?{{ static_version }}">
|
<link rel="stylesheet" href="{% static 'paging.css' %}?{{ static_version }}">
|
||||||
|
<link rel="stylesheet" href="{% static 'ux.css' %}?{{ static_version }}">
|
||||||
|
|
||||||
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css' rel='stylesheet'>
|
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css' rel='stylesheet'>
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<script src="{% static 'ui.js' %}?{{ static_version }}" defer></script>
|
<script src="{% static 'ui.js' %}?{{ static_version }}" defer></script>
|
||||||
|
<script src="{% static 'ux.js' %}?{{ static_version }}" defer></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|||||||
Reference in new issue
Block a user