From cd8274066284699212c8db652ab875339c808b40 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 21 Jul 2022 13:51:22 +0100 Subject: [PATCH] Improve UI usability --- core/api/views/threshold.py | 1 + core/static/chart.js | 2 + core/templates/modals/info.html | 8 ++-- core/templates/ui/drilldown.html | 1 + core/templates/ui/results.html | 72 +++++++++++++++++++++++++------- 5 files changed, 65 insertions(+), 19 deletions(-) diff --git a/core/api/views/threshold.py b/core/api/views/threshold.py index 03a8612..68681f7 100644 --- a/core/api/views/threshold.py +++ b/core/api/views/threshold.py @@ -96,6 +96,7 @@ class ThresholdInfoModal(LoginRequiredMixin, APIView): else: inter_chans = [] context = { + "net": net, "nick": nick, "channel": channel, "chans": channels, diff --git a/core/static/chart.js b/core/static/chart.js index ee10484..df45866 100644 --- a/core/static/chart.js +++ b/core/static/chart.js @@ -21,6 +21,8 @@ new Chart(ctx, { ], }, options: { + responsive: true, + maintainAspectRatio: false, parsing: { xAxisKey: 'date', yAxisKey: 'value', diff --git a/core/templates/modals/info.html b/core/templates/modals/info.html index f0ad2f0..a5d5224 100644 --- a/core/templates/modals/info.html +++ b/core/templates/modals/info.html @@ -60,7 +60,7 @@
-

Channels {{ nick }} is on

+

Channels for {{ nick }} on {{ net }}

{% for channel in chans %} @@ -71,7 +71,7 @@ {% endfor %}
-

Users on {{ channel }}

+

Users on {{ channel }} for {{ net }}

{% for user in users %}
@@ -82,7 +82,7 @@ {% endfor %}
-

Users sharing channels with {{ nick }}

+

Users sharing channels with {{ nick }} on {{ net }}

{% for user in inter_users %}
@@ -93,7 +93,7 @@ {% endfor %}
-

Channels sharing users with {{ channel }}

+

Channels sharing users with {{ channel }} on {{ net }}

{% for channel in inter_chans %}
diff --git a/core/templates/ui/drilldown.html b/core/templates/ui/drilldown.html index 7149b9e..a4f3f21 100644 --- a/core/templates/ui/drilldown.html +++ b/core/templates/ui/drilldown.html @@ -3,6 +3,7 @@ {% block content %}
- Online - Offline - Unknown - IRC: - Discord:
+ @@ -28,15 +26,51 @@ - {% for item in results %} +
srctype ts msg hostnet
{% if item.src == 'irc' %} - + + + {% elif item.src == 'dis' %} - + + + + {% endif %} + + {% if item.type == 'msg' %} + + + + {% elif item.type == 'join' %} + + + + {% elif item.type == 'part' %} + + + + {% elif item.type == 'quit' %} + + + + {% elif item.type == 'kick' %} + + + + {% elif item.type == 'nick' %} + + + + {% elif item.type == 'mode' %} + + + + {% else %} + {{ item.type }} {% endif %} @@ -47,11 +81,20 @@ {{ item.host }} {% if item.online is True %} - {{ item.nick }} + + + + {{ item.nick }} {% elif item.online is False %} - {{ item.nick }} + + + + {{ item.nick }} {% else %} - {{ item.nick }} + + + + {{ item.nick }} {% endif %} @@ -62,9 +105,8 @@ hx-vals='{"net": "{{ item.net }}", "nick": "{{ item.nick }}", "channel": "{{ item.channel }}"}' hx-target="#modals-here" hx-trigger="click" - class="btn btn-primary" - _="on htmx:afterOnLoad wait 10ms then add .show to #modal then add .show to #modal-backdrop"> - Information + class="btn btn-primary"> + Information
{% endif %}