From d3de054d5af46873ea53c612b4b9d14cb3a99ee6 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Fri, 26 Aug 2022 07:20:30 +0100 Subject: [PATCH] Fix src/source issue in management --- .../manage/threshold/irc/network/relays.html | 4 +- core/templates/ui/drilldown/drilldown.html | 55 ++++- core/templates/ui/drilldown/results.html | 219 ------------------ .../drilldown/table_results_partial copy.html | 80 ------- core/templates/widgets/table_results.html | 62 +++++ core/views/ui/drilldown.py | 2 +- 6 files changed, 108 insertions(+), 314 deletions(-) delete mode 100644 core/templates/ui/drilldown/results.html delete mode 100644 core/templates/ui/drilldown/table_results_partial copy.html create mode 100644 core/templates/widgets/table_results.html diff --git a/core/templates/manage/threshold/irc/network/relays.html b/core/templates/manage/threshold/irc/network/relays.html index 49a4d6e..171a13f 100644 --- a/core/templates/manage/threshold/irc/network/relays.html +++ b/core/templates/manage/threshold/irc/network/relays.html @@ -102,7 +102,7 @@ hx-post="{% url 'modal_context' %}" hx-vals='{"net": "{{ net }}", "num": "{{ relay.id }}", - "src": "irc", + "source": "irc", "channel": "*status", "time": "None", "date": "None", @@ -192,7 +192,7 @@ hx-post="{% url 'modal_context' %}" hx-vals='{"net": "{{ net }}", "num": "{{ relay.id }}", - "src": "irc", + "source": "irc", "channel": "{{ sinst.entity }}", "time": "None", "date": "None", diff --git a/core/templates/ui/drilldown/drilldown.html b/core/templates/ui/drilldown/drilldown.html index c50fd14..552aa49 100644 --- a/core/templates/ui/drilldown/drilldown.html +++ b/core/templates/ui/drilldown/drilldown.html @@ -69,22 +69,53 @@ -
-
-
-

- - Results -

-
-
-
- {% include 'ui/drilldown/table_results.html' %} +
+ {% if table %} +
+
+
+

+ + Results +

+
+
+ + + + + + {{ table.data|length }} hits in {{ took }}ms + {% if exemption is not None %} + + + + {% else %} + {% if redacted is not None %} + + + + {% endif %} + {% endif %} + {% if delay is not None %} + + + + {% endif %} + {% if randomised is True %} + + + + {% endif %} + + {% include 'ui/drilldown/table_results_partial.html' %} + {% include 'ui/drilldown/sentiment_partial.html' %} +
-
+ {% endif %}
diff --git a/core/templates/ui/drilldown/results.html b/core/templates/ui/drilldown/results.html deleted file mode 100644 index b526fd1..0000000 --- a/core/templates/ui/drilldown/results.html +++ /dev/null @@ -1,219 +0,0 @@ -{% load static %} -{% load index %} -{% load joinsep %} -{% include 'partials/notify.html' %} -{% if results %} - -
-
- -
-
-

fetched {{ results|length }} of {{ card }} hits in {{ took }}ms

-
- {% if exemption is not None %} -
- -
- {% else %} - {% if redacted is not None %} -
-

{{ redacted }} redacted

-
- {% endif %} - {% endif %} -
-
-
- -
- -
-
-
- - - - - - - - - - - - - - - - {% for item in results %} - {# Workaround for curlylint #} - - - - - - - - - - - - {% endfor %} - -
srctypetsmsghostnickactionschannelnet
- - {% 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' %} - - - - {% elif item.type == 'action' %} - - - - {% else %} - {{ item.type }} - {% endif %} - - -

{{ item.date }}

-

{{ item.time }}

-
{{ item.msg }} - - {{ item.host }} - - -
-
- {% if item.online is True %} - - - - {% elif item.online is False %} - - - - {% else %} - - - - {% endif %} -
- - {{ item.nick }} - - {% if item.num_chans is not None %} -
- - {{ item.num_chans }} - -
- {% endif %} -
-
- {% if item.src == 'irc' %} - - {% endif %} - -
- - {{ item.channel }} - - {% if item.num_users is not None %} -
- - {{ item.num_users }} - -
- {% endif %} -
-
- - {{ item.net }} - -
-
-
-{% endif %} -{# Update the tags in case the user changed the query #} -{# Check for focus and refocus #} - diff --git a/core/templates/ui/drilldown/table_results_partial copy.html b/core/templates/ui/drilldown/table_results_partial copy.html deleted file mode 100644 index 00433f9..0000000 --- a/core/templates/ui/drilldown/table_results_partial copy.html +++ /dev/null @@ -1,80 +0,0 @@ -{% extends 'django-tables2/bulma.html' %} - -{% load django_tables2 %} - -{% load i18n %} - -{% block table.thead %} - {% if table.show_header %} - - - {% for column in table.columns %} - - {{ column.header }} - - {% endfor %} - - - {% endif %} -{% endblock table.thead %} - -{# Pagination block overrides #} -{% block pagination.previous %} - {% if table.page.has_previous %} -
  • - -
  • - {% endif %} -{% endblock pagination.previous %} - -{% block pagination.range %} - {% for p in table.page|table_page_range:table.paginator %} -
  • - -
  • - {% endfor %} -{% endblock pagination.range %} -{% if table.page.has_next %} - {% block pagination.next %} -
  • - -
  • - {% endblock pagination.next %} -{% endif %} diff --git a/core/templates/widgets/table_results.html b/core/templates/widgets/table_results.html new file mode 100644 index 0000000..4cd3764 --- /dev/null +++ b/core/templates/widgets/table_results.html @@ -0,0 +1,62 @@ +{% load static %} +
    +
    +
    +
    +

    + + Results +

    +
    +
    + {% if table %} + + + + + + {{ table.data|length }} hits in {{ took }}ms + {% if exemption is not None %} + + + + {% else %} + {% if redacted is not None %} + + + + {% endif %} + {% endif %} + {% if delay is not None %} + + + + {% endif %} + {% if randomised is True %} + + + + {% endif %} + + {% include 'ui/drilldown/table_results_partial.html' %} + {% include 'ui/drilldown/sentiment_partial.html' %} + + {% endif %} +
    +
    +
    +
    +
    +
    + \ No newline at end of file diff --git a/core/views/ui/drilldown.py b/core/views/ui/drilldown.py index f83100c..36507ae 100644 --- a/core/views/ui/drilldown.py +++ b/core/views/ui/drilldown.py @@ -101,7 +101,7 @@ def drilldown_search(request, return_context=False, template=None): extra_params = {} if not template: - template_name = "ui/drilldown/table_results.html" + template_name = "widgets/table_results.html" else: template_name = template if request.user.is_anonymous: