Cloned DMOJ
This commit is contained in:
parent
f623974b58
commit
49dc9ff10c
513 changed files with 132349 additions and 39 deletions
67
templates/status/judge-status-table.html
Normal file
67
templates/status/judge-status-table.html
Normal file
|
@ -0,0 +1,67 @@
|
|||
<tr>
|
||||
<th>{{ _('Judge') }}</th>
|
||||
{% if see_all_judges %}
|
||||
<th>{{ _('Online') }}</th>
|
||||
{% endif %}
|
||||
<th>{{ _('Uptime') }}</th>
|
||||
<th>{{ _('Ping') }}</th>
|
||||
<th>{{ _('Load') }}</th>
|
||||
<th>{{ _('Runtimes') }}</th>
|
||||
</tr>
|
||||
|
||||
{% for judge in judges %}
|
||||
<tr>
|
||||
<td>
|
||||
{% if perms.judge.change_judge %}
|
||||
<a href="{{ url('admin:judge_judge_change', judge.id) }}">{{ judge.name }}</a>
|
||||
{% else %}
|
||||
{{ judge.name }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% if see_all_judges %}
|
||||
<td>
|
||||
{% if judge.online %}
|
||||
<i style="color:#44AD41" class="fa fa-check-circle"></i>
|
||||
{% else %}
|
||||
<i style="color:#DE2121" class="fa fa-minus-circle"></i>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td>
|
||||
{% if judge.online %}
|
||||
{{ judge.uptime|timedelta("simple") }}
|
||||
{% else %}
|
||||
{{ _('N/A') }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="ping">
|
||||
{% if judge.online and judge.ping_ms %}
|
||||
{{ judge.ping_ms|floatformat(3) }} ms
|
||||
{% else %}
|
||||
{{ _('N/A') }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if judge.online %}
|
||||
{{ judge.load|floatformat(3) }}
|
||||
{% else %}
|
||||
{{ _('N/A') }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if judge.online %}
|
||||
{% for key, info in judge.runtime_versions -%}
|
||||
<a href="javascript:void(0)" data-judge="{{ judge.id }}" data-lang="{{ key }}"
|
||||
data-runtime-info="{{ runtime_versions(info.runtime) }}"
|
||||
class="runtime-label">{{ info.name }}</a>
|
||||
{%- if not loop.last %}, {% endif %}
|
||||
{%- endfor %}
|
||||
{% else %}{{ _('N/A') }}{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="6"><em>{{ _('There are no judges available at this time.') }}</em>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
23
templates/status/judge-status.html
Normal file
23
templates/status/judge-status.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block js_media %}
|
||||
{% include "status/media-js.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block media %}
|
||||
{% include "status/media-css.html" %}
|
||||
{% block content_media %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block title_ruler %}{% endblock %}
|
||||
|
||||
{% block title_row %}
|
||||
{% set tab = 'judges' %}
|
||||
{% include "status/status-tabs.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<table id="judge-status" class="table">
|
||||
{% include "status/judge-status-table.html" %}
|
||||
</table>
|
||||
{% endblock %}
|
60
templates/status/language-list.html
Normal file
60
templates/status/language-list.html
Normal file
|
@ -0,0 +1,60 @@
|
|||
{% extends "base.html" %}
|
||||
{% block media %}
|
||||
<style>
|
||||
.table td.language {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.table td.info .content-description {
|
||||
margin: -1em 1em -1em 1em;
|
||||
}
|
||||
|
||||
td.info {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.table td {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block title_ruler %}{% endblock %}
|
||||
|
||||
{% block title_row %}
|
||||
{% set tab = 'runtimes' %}
|
||||
{% include "status/status-tabs.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ _('ID') }}</th>
|
||||
<th>{{ _('Name') }}</th>
|
||||
<th>{{ _('Runtime Info') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for language in languages %}
|
||||
{# All online languages have runtime_versions, even if we're not going to display them #}
|
||||
{% if language.runtime_versions %}
|
||||
<tr>
|
||||
<td>{{ language.short_display_name }}</td>
|
||||
<td class="language">{{ language.name }}</td>
|
||||
<td class="info">
|
||||
<code>{{ runtime_versions(language.runtime_versions()) }}</code>
|
||||
{% if language.description %}
|
||||
<div class="content-description">
|
||||
{% cache 86400 'language_html' language.id %}
|
||||
{{ language.description|markdown('language') }}
|
||||
{% endcache %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
14
templates/status/media-css.html
Normal file
14
templates/status/media-css.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<style>
|
||||
.runtime-label {
|
||||
position: relative;
|
||||
white-space: nowrap
|
||||
}
|
||||
|
||||
.tooltipped:after {
|
||||
text-align: left
|
||||
}
|
||||
|
||||
td.ping {
|
||||
white-space: nowrap
|
||||
}
|
||||
</style>
|
62
templates/status/media-js.html
Normal file
62
templates/status/media-js.html
Normal file
|
@ -0,0 +1,62 @@
|
|||
<script src="{{ static('libs/tablesorter.js') }}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
var table = $("#judge-status");
|
||||
table.tablesorter();
|
||||
|
||||
var tooltip_classes = 'tooltipped tooltipped-w';
|
||||
var active_judge = null;
|
||||
var active_lang = null;
|
||||
|
||||
function display_tooltip(where) {
|
||||
where.addClass(tooltip_classes).attr('aria-label', where.attr('data-runtime-info'));
|
||||
}
|
||||
|
||||
function install_tooltips() {
|
||||
$('.runtime-label').each(function () {
|
||||
var link = $(this);
|
||||
link.mouseenter(function (e) {
|
||||
active_judge = link.attr('data-judge');
|
||||
active_lang = link.attr('data-lang');
|
||||
display_tooltip(link);
|
||||
}).mouseleave(function (e) {
|
||||
active_judge = active_lang = null;
|
||||
link.removeClass(tooltip_classes).removeAttr('aria-label');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var outdated = false;
|
||||
|
||||
function update_table() {
|
||||
if ($('body').hasClass('window-hidden'))
|
||||
return outdated = true;
|
||||
$.ajax({
|
||||
url: '{{ url('status_table') }}'
|
||||
}).done(function (data) {
|
||||
// Readd the tooltip classes to minimize flicker on update
|
||||
var new_node = $(data);
|
||||
|
||||
if (active_lang && active_judge) {
|
||||
var selected = new_node.find('[data-judge=' + active_judge + '][data-lang=' + active_lang + ']');
|
||||
if (selected) // Might have been removed, when a judge disconnected
|
||||
display_tooltip(selected);
|
||||
}
|
||||
|
||||
table.html(new_node);
|
||||
install_tooltips();
|
||||
}).always(function () {
|
||||
outdated = false;
|
||||
setTimeout(update_table, 10000);
|
||||
});
|
||||
}
|
||||
|
||||
$(window).on('dmoj:window-visible', function () {
|
||||
if (outdated)
|
||||
update_table();
|
||||
});
|
||||
|
||||
setTimeout(update_table, 10000);
|
||||
install_tooltips();
|
||||
});
|
||||
</script>
|
7
templates/status/status-tabs.html
Normal file
7
templates/status/status-tabs.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
{% extends "tabs-base.html" %}
|
||||
|
||||
{% block tabs %}
|
||||
{{ make_tab('judges', 'fa-server', url('status_all'), _('Judges')) }}
|
||||
{{ make_tab('runtimes', 'fa-code', url('runtime_list'), _('Runtimes')) }}
|
||||
{{ make_tab('matrix', 'fa-table', url('version_matrix'), _('Version Matrix')) }}
|
||||
{% endblock %}
|
42
templates/status/versions.html
Normal file
42
templates/status/versions.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title_ruler %}{% endblock %}
|
||||
|
||||
{% block title_row %}
|
||||
{% set tab = 'matrix' %}
|
||||
{% include "status/status-tabs.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<table id="judge-versions" class="table">
|
||||
<tr>
|
||||
<th></th>
|
||||
{% for judge in judges %}
|
||||
<th>{{ judge }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% for language in languages %}
|
||||
<tr>
|
||||
<th>{{ language.name }}</th>
|
||||
{% for judge in judges %}
|
||||
{% set versions = matrix[judge][language.id] %}
|
||||
<td class="version version-
|
||||
{%- if not versions -%}
|
||||
blank
|
||||
{%- elif versions.is_latest -%}
|
||||
latest
|
||||
{%- else -%}
|
||||
outdated
|
||||
{%- endif %}">
|
||||
{%- for version in versions -%}
|
||||
{{ version.name }}{% if version.version %} {{ version.version }}{% endif %}
|
||||
{% if not loop.last %}<br>{% endif %}
|
||||
{%- else -%}
|
||||
—
|
||||
{%- endfor -%}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue