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