Add online status and jumping to nick to Insights page
This commit is contained in:
parent
bb8f6d119e
commit
589ee6d735
|
@ -49,7 +49,7 @@
|
|||
<div class="field-body">
|
||||
<div class="field">
|
||||
<div class="control is-expanded has-icons-left">
|
||||
<input name="query" class="input" type="text" placeholder="nickname">
|
||||
<input id="query" name="query" class="input" type="text" placeholder="nickname">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-magnifying-glass"></i>
|
||||
</span>
|
||||
|
|
|
@ -1,9 +1,26 @@
|
|||
{% load index %}
|
||||
|
||||
<div id="nicks">
|
||||
<div class="content" style="max-height: 30em; overflow: auto;">
|
||||
<table class="table is-fullwidth is-hoverable">
|
||||
{% for nick in nicks %}
|
||||
<tr>
|
||||
<td>
|
||||
{% if nick in online %}
|
||||
{% if online|index:nick is True %}
|
||||
<span class="icon has-text-success has-tooltip-success" data-tooltip="Online">
|
||||
<i class="fa-solid fa-circle"></i>
|
||||
</span>
|
||||
{% elif online|index:nick is False %}
|
||||
<span class="icon has-text-danger has-tooltip-danger" data-tooltip="Offline">
|
||||
<i class="fa-solid fa-circle"></i>
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="icon has-text-warning has-tooltip-warning" data-tooltip="Unknown">
|
||||
<i class="fa-solid fa-circle"></i>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<span
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-post="{% url 'modal_drilldown' %}"
|
||||
|
@ -13,6 +30,12 @@
|
|||
class="button is-small">
|
||||
{{ nick }}
|
||||
</span>
|
||||
<a
|
||||
class="icon has-text-info has-tooltip-info"
|
||||
data-tooltip="Populate search"
|
||||
onclick="document.getElementById('query').value='nick: {{ nick }}';">
|
||||
<i class="fa-solid fa-arrow-left-long-to-line"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -10,6 +10,7 @@ from core.lib.opensearch import query_single_result
|
|||
from core.lib.threshold import (
|
||||
annotate_num_chans,
|
||||
annotate_num_users,
|
||||
annotate_online,
|
||||
get_chans,
|
||||
get_users,
|
||||
)
|
||||
|
@ -66,9 +67,10 @@ class InsightsNicks(LoginRequiredMixin, APIView):
|
|||
net = request.data["net"]
|
||||
nick = request.data["nick"]
|
||||
nicks = get_nicks(request, net, nick)
|
||||
online = annotate_online(net, nicks)
|
||||
if not nicks:
|
||||
return HttpResponseForbidden()
|
||||
context = {"net": net, "nick": nick, "nicks": nicks}
|
||||
context = {"net": net, "nick": nick, "nicks": nicks, "online": online}
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue