Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 57 additions & 25 deletions src/static/riot/competitions/detail/worker-monitor-toggle.tag
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,21 @@
</div>
</div>

<!-- Queue stats -->
<div class="workers-section" if="{ queueStats.length }">
<div class="workers-section-header">
<div class="workers-section-title">
Queues stats
</div>
<div class="workers-section-title">Queues stats</div>
<button type="button" class="workers-collapse-btn" onclick="{ toggleQueueStats }">
<i class="{ queueStatsCollapsed ? 'chevron down' : 'chevron up' } icon"></i>
{ queueStatsCollapsed ? 'Expand' : 'Collapse' }
</button>
</div>
<div class="workers-table-wrap">
<div if="{ !queueStatsCollapsed }" class="workers-table-wrap">
<table class="workers-table workers-table--stats">
<colgroup>
<col class="col-worker">
<col class="col-jobs">
<col class="col-jobs">
<col class="col-stat">
<col class="col-stat">
</colgroup>
<thead>
<tr>
Expand All @@ -62,7 +65,7 @@
</tr>
</thead>
<tbody>
<tr each="{ qs in queueStats }">
<tr each="{ qs in sortedQueueStats() }">
<td class="cell-worker">
<span class="worker-hostname">{ qs.source_name }</span>
<span class="queue-worker-count">
Expand All @@ -83,24 +86,24 @@
</tbody>
</table>
</div>
<div if="{ queueStatsCollapsed }" class="workers-collapsed">
<i class="compress icon"></i>
Queue stats collapsed.
</div>
</div>

<!-- Public workers -->
<div class="workers-section">
<div class="workers-section-header">
<div class="workers-section-title">
Public compute workers
<span class="workers-count">{ sortedWorkers().length }</span>
</div>

<button
type="button"
class="workers-collapse-btn"
onclick="{ togglePublicWorkers }">
<button type="button" class="workers-collapse-btn" onclick="{ togglePublicWorkers }">
<i class="{ publicWorkersCollapsed ? 'chevron down' : 'chevron up' } icon"></i>
{ publicWorkersCollapsed ? 'Expand' : 'Collapse' }
</button>
</div>

<div if="{ !publicWorkersCollapsed }" class="workers-table-wrap">
<table class="workers-table workers-table--public">
<colgroup>
Expand All @@ -110,7 +113,7 @@
</colgroup>
<thead>
<tr>
<th>Worker</th>
<th>Workers</th>
<th>Status</th>
<th>Last seen</th>
</tr>
Expand All @@ -128,9 +131,8 @@
</td>
<td class="cell-muted cell-nowrap">{ formatLastSeen(getLastSeenValue(worker)) }</td>
</tr>

<tr if="{ sortedWorkers().length === 0 }">
<td colspan="4">
<td colspan="3">
<div class="workers-empty">
<div class="header">No public compute workers detected</div>
<div class="description">Waiting for the first websocket snapshot.</div>
Expand All @@ -140,20 +142,25 @@
</tbody>
</table>
</div>

<div if="{ publicWorkersCollapsed }" class="workers-collapsed">
<i class="compress icon"></i>
Public workers list collapsed.
</div>
</div>

<div class="workers-section">
<div class="workers-section-title">
Private compute workers
<span class="workers-count">{ sortedPrivateWorkers().length }</span>
<!-- Private workers -->
<div class="workers-section" if="{ sortedPrivateWorkers().length || allWorkers }">
<div class="workers-section-header">
<div class="workers-section-title">
Private compute workers
<span class="workers-count">{ sortedPrivateWorkers().length }</span>
</div>
<button type="button" class="workers-collapse-btn" onclick="{ togglePrivateWorkers }">
<i class="{ privateWorkersCollapsed ? 'chevron down' : 'chevron up' } icon"></i>
{ privateWorkersCollapsed ? 'Expand' : 'Collapse' }
</button>
</div>

<div class="workers-table-wrap">
<div if="{ !privateWorkersCollapsed }" class="workers-table-wrap">
<table class="workers-table workers-table--private">
<colgroup>
<col class="col-worker">
Expand Down Expand Up @@ -183,9 +190,8 @@
</td>
<td class="cell-muted cell-nowrap">{ formatLastSeen(getLastSeenValue(worker)) }</td>
</tr>

<tr if="{ sortedPrivateWorkers().length === 0 }">
<td colspan="5">
<td colspan="4">
<div class="workers-empty">
<div class="header">No private compute workers detected</div>
<div class="description">Waiting for the first websocket snapshot.</div>
Expand All @@ -195,6 +201,10 @@
</tbody>
</table>
</div>
<div if="{ privateWorkersCollapsed }" class="workers-collapsed">
<i class="compress icon"></i>
Private workers list collapsed.
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -425,6 +435,8 @@
self.dragOffsetX = 0
self.dragOffsetY = 0
self.publicWorkersCollapsed = false
self.queueStatsCollapsed = false
self.privateWorkersCollapsed = false
self.panelResizeObserver = null

self.queueKey = function (worker) {
Expand Down Expand Up @@ -462,6 +474,18 @@
self.update()
}

self.toggleQueueStats = function (event) {
if (event) { event.preventDefault(); event.stopPropagation() }
self.queueStatsCollapsed = !self.queueStatsCollapsed
self.update()
}

self.togglePrivateWorkers = function (event) {
if (event) { event.preventDefault(); event.stopPropagation() }
self.privateWorkersCollapsed = !self.privateWorkersCollapsed
self.update()
}

self.toggleWorkersPanel = function () {
if (self.inlineMode) return

Expand All @@ -481,6 +505,14 @@
self.update()
}

self.sortedQueueStats = function () {
return (self.queueStats || []).slice().sort(function (a, b) {
if (a.source_name === 'default') return -1
if (b.source_name === 'default') return 1
return a.source_name.localeCompare(b.source_name)
})
}

self.close_workers_socket = function (allowReconnect) {
if (self.wsReconnectTimer) {
clearTimeout(self.wsReconnectTimer)
Expand Down
3 changes: 2 additions & 1 deletion src/templates/pages/monitor_queues.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{% endblock %}

{% block content %}
<!--
{% if user.is_authenticated %}
{% if user.is_superuser %}
<div class="ui container">
Expand Down Expand Up @@ -61,7 +62,7 @@ <h1>Monitor queues</h1>
<a href="{% url 'accounts:signup' %}">Sign Up</a> to view this page
</div>
</div>
{% endif %}
{% endif %}-->

{% if user.is_superuser %}
<div class="ui container">
Expand Down