neptune/core/templates/ui/drilldown/results.html

213 lines
8.3 KiB
HTML
Raw Permalink Normal View History

2022-07-21 12:50:51 +00:00
{% load static %}
2022-07-21 12:51:55 +00:00
{% load index %}
2022-08-09 06:20:30 +00:00
{% load joinsep %}
{% include 'partials/notify.html' %}
{% if results %}
2022-07-21 12:52:06 +00:00
<div style="display: none" id="jsonData" data-json="{{ data }}">
</div>
<div class="has-text-grey-light nowrap-parent">
2022-08-09 10:54:44 +00:00
<div class="nowrap-child block">
<i class="fa-solid fa-chart-mixed"></i>
</div>
<div class="nowrap-child">
<p>fetched {{ results|length }} of {{ card }} hits in {{ took }}ms</p>
</div>
{% if exemption is not None %}
<div class="nowrap-child">
<i class="fa-solid fa-book-bible"></i>
2022-08-03 06:20:30 +00:00
</div>
2022-08-09 10:54:44 +00:00
{% else %}
{% if redacted != 0 %}
2022-08-03 06:20:30 +00:00
<div class="nowrap-child">
2022-08-09 10:54:44 +00:00
<p>{{ redacted }} redacted</p>
2022-08-03 06:20:30 +00:00
</div>
2022-08-03 06:20:30 +00:00
{% endif %}
2022-08-09 10:54:44 +00:00
{% endif %}
2022-08-03 06:20:30 +00:00
</div>
2022-07-21 12:52:06 +00:00
<div class="box">
<div style="height: 30rem">
<canvas id="volume"></canvas>
2022-07-21 12:50:56 +00:00
</div>
2022-07-21 12:52:06 +00:00
<script src="{% static 'chart.js' %}"></script>
</div>
<div class="box">
<div class="table-container">
<table class="table is-striped is-hoverable is-fullwidth">
<thead>
<tr>
<th>src</th>
<th>type</th>
<th>ts</th>
<th>msg</th>
<th>host</th>
<th>nick</th>
<th>actions</th>
<th>channel</th>
<th>net</th>
</tr>
</thead>
<tbody>
{% for item in results %}
2022-08-09 10:54:44 +00:00
{# Workaround for curlylint #}
<tr class="{% if item.exemption == True %}
has-background-grey-lighter
{% elif item.type == 'join' %}
has-background-success-light
{% elif item.type == 'quit' %}
has-background-danger-light
{% elif item.type == 'kick' %}
has-background-danger-light
{% elif item.type == 'part' %}
has-background-warning-light
{% elif item.type == 'mode' %}
has-background-info-light
{% endif %}">
2022-07-21 12:52:06 +00:00
<td>
<a class="has-text-link is-underlined"
2022-08-09 06:20:30 +00:00
onclick="populateSearch('src', '{{ item.src|escapejs }}')">
{% if item.src == 'irc' %}
<span class="icon" data-tooltip="IRC">
<i class="fa-solid fa-hashtag" aria-hidden="true"></i>
</span>
{% elif item.src == 'dis' %}
<span class="icon" data-tooltip="Discord">
<i class="fa-brands fa-discord" aria-hidden="true"></i>
</span>
{% endif %}
</a>
2022-07-21 12:52:06 +00:00
</td>
<td>
<a class="has-text-link is-underlined"
2022-08-09 06:20:30 +00:00
onclick="populateSearch('type', '{{ item.type|escapejs }}')">
{% if item.type == 'msg' %}
<span class="icon" data-tooltip="Message">
<i class="fa-solid fa-message"></i>
</span>
{% elif item.type == 'join' %}
<span class="icon" data-tooltip="Join">
<i class="fa-solid fa-person-to-portal"></i>
</span>
{% elif item.type == 'part' %}
<span class="icon" data-tooltip="Part">
<i class="fa-solid fa-person-from-portal"></i>
</span>
{% elif item.type == 'quit' %}
<span class="icon" data-tooltip="Quit">
<i class="fa-solid fa-circle-xmark"></i>
</span>
{% elif item.type == 'kick' %}
<span class="icon" data-tooltip="Kick">
<i class="fa-solid fa-user-slash"></i>
</span>
{% elif item.type == 'nick' %}
<span class="icon" data-tooltip="Nick">
<i class="fa-solid fa-signature"></i>
</span>
{% elif item.type == 'mode' %}
<span class="icon" data-tooltip="Mode">
<i class="fa-solid fa-gear"></i>
</span>
{% elif item.type == 'action' %}
<span class="icon" data-tooltip="Action">
<i class="fa-solid fa-exclamation"></i>
</span>
{% else %}
{{ item.type }}
{% endif %}
</a>
2022-07-21 12:52:06 +00:00
</td>
<td>
<p>{{ item.date }}</p>
<p>{{ item.time }}</p>
</td>
2022-08-02 21:22:22 +00:00
<td style="max-width: 10em" class="wrap">{{ item.msg }}</td>
<td>
<a class="has-text-link is-underlined"
2022-08-09 06:20:30 +00:00
onclick="populateSearch('host', '{{ item.host|escapejs }}')">
{{ item.host }}
</a>
</td>
2022-07-21 12:52:06 +00:00
<td>
<div class="nowrap-parent">
<div class="nowrap-child">
{% if item.online is True %}
<span class="icon has-text-success has-tooltip-success" data-tooltip="Online">
<i class="fa-solid fa-circle"></i>
</span>
{% elif item.online 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 %}
</div>
2022-08-09 06:20:30 +00:00
<a class="nowrap-child has-text-link is-underlined" onclick="populateSearch('nick', '{{ item.nick|escapejs }}')">
{{ item.nick }}
</a>
2022-08-09 10:54:44 +00:00
{% if item.num_chans is not None %}
<div class="nowrap-child">
<span class="tag">
{{ item.num_chans }}
</span>
</div>
2022-08-09 10:54:44 +00:00
{% endif %}
</div>
2022-07-21 12:52:06 +00:00
</td>
<td>
{% if item.src == 'irc' %}
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-post="{% url 'modal_drilldown' %}"
hx-vals='{"net": "{{ item.net }}", "nick": "{{ item.nick }}", "channel": "{{ item.channel }}"}'
hx-target="#modals-here"
hx-trigger="click"
class="button is-small">
Information
</button>
{% endif %}
</td>
<td>
<div class="nowrap-parent">
<a class="nowrap-child has-text-link is-underlined"
2022-08-09 06:20:30 +00:00
onclick="populateSearch('channel', '{{ item.channel|escapejs }}')">
{{ item.channel }}
</a>
{% if item.num_users is not None %}
<div class="nowrap-child">
<span class="tag">
{{ item.num_users }}
</span>
</div>
{% endif %}
</div>
2022-07-21 12:52:06 +00:00
</td>
<td>
<a class="has-text-link is-underlined"
2022-08-09 06:20:30 +00:00
onclick="populateSearch('net', '{{ item.net|escapejs }}')">
{{ item.net }}
</a>
</td>
2022-07-21 12:50:51 +00:00
</tr>
2022-07-21 12:52:06 +00:00
{% endfor %}
</tbody>
</table>
2022-07-21 12:50:51 +00:00
</div>
2022-07-21 12:52:06 +00:00
</div>
2022-08-09 06:20:30 +00:00
{% endif %}
{# Update the tags in case the user changed the query #}
{# Check for focus and refocus #}
<script>
var inputTags = document.getElementsByClassName('tags-input');
var inputBox = document.querySelector("[placeholder='Add query']");
var isFocused = (document.activeElement === inputBox);
inputTags[0].outerHTML = '<input id="tags" class="input" type="tags" placeholder="Add query" value="{{ tags|joinsep:',' }}">';
setupTags();
var inputBox = document.querySelector("[placeholder='Add query']");
if (isFocused) {
inputBox.focus();
}
</script>