diff --git a/core/lib/opensearch.py b/core/lib/opensearch.py
index 010f6a8..8afefcc 100644
--- a/core/lib/opensearch.py
+++ b/core/lib/opensearch.py
@@ -1,6 +1,6 @@
from django.conf import settings
from opensearchpy import OpenSearch
-from opensearchpy.exceptions import RequestError
+from opensearchpy.exceptions import NotFoundError, RequestError
from core.lib.threshold import annotate_num_chans, annotate_num_users, annotate_online
@@ -44,14 +44,24 @@ def annotate_results(results_parsed):
for net in nets:
# Annotate the online attribute from Threshold
- nicks = [
- x["nick"] for x in results_parsed if x["src"] == "irc" and x["net"] == net
- ]
- channels = [
- x["channel"]
- for x in results_parsed
- if x["src"] == "irc" and x["net"] == net
- ]
+ nicks = list(
+ set(
+ [
+ x["nick"]
+ for x in results_parsed
+ if x["src"] == "irc" and x["net"] == net and "nick" in x
+ ]
+ )
+ )
+ channels = list(
+ set(
+ [
+ x["channel"]
+ for x in results_parsed
+ if x["src"] == "irc" and x["net"] == net and "channel" in x
+ ]
+ )
+ )
online_info = annotate_online(net, nicks)
# Annotate the number of users in the channel
num_users = annotate_num_users(net, channels)
@@ -137,6 +147,9 @@ def run_main_query(client, user, query, custom_query=False, index=None, size=Non
except RequestError as err:
print("OpenSearch error", err)
return err
+ except NotFoundError as err:
+ print("OpenSearch error", err)
+ return err
filter_blacklisted(user, response)
return response
@@ -254,16 +267,36 @@ def query_results(request, query_params, size=None):
search_query["query"]["bool"]["must_not"] = [item]
if sort:
search_query["sort"] = sort
+ if "index" in query_params:
+ if not request.user.is_superuser:
+ message = "How did you get here?"
+ message_class = "danger"
+ return {"message": message, "class": message_class}
+ else:
+ index = query_params["index"]
+ if index == "main":
+ index = settings.OPENSEARCH_INDEX_MAIN
+ elif index == "meta":
+ index = settings.OPENSEARCH_INDEX_META
+ elif index == "int":
+ index = settings.OPENSEARCH_INDEX_INT
+ else:
+ message = "Index is not valid."
+ message_class = "danger"
+ return {"message": message, "class": message_class}
+ else:
+ index = settings.OPENSEARCH_INDEX_MAIN
results = run_main_query(
client,
request.user, # passed through run_main_query to filter_blacklisted
search_query,
custom_query=True,
+ index=index,
size=size,
)
if not results:
return False
- if isinstance(results, RequestError):
+ if isinstance(results, Exception):
message = results.info["error"]["root_cause"][0]["reason"]
message_class = "danger"
return {"message": message, "class": message_class}
diff --git a/core/static/js/column-shifter.js b/core/static/js/column-shifter.js
index 12481ec..6ccb5f7 100644
--- a/core/static/js/column-shifter.js
+++ b/core/static/js/column-shifter.js
@@ -48,6 +48,9 @@ $(document).ready(function(){
"num": "off",
"exemption": "off",
"online": "off",
+ "mtype": "off",
+ "realname": "off",
+ "server": "off",
},
};
} else {
diff --git a/core/templates/manage/threshold/irc/overview/alerts.html b/core/templates/manage/threshold/irc/overview/alerts.html
deleted file mode 100644
index 4ca4e70..0000000
--- a/core/templates/manage/threshold/irc/overview/alerts.html
+++ /dev/null
@@ -1,94 +0,0 @@
-
- {% include 'manage/threshold/partials/notify.html' %}
- {% if alerts is not None %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ts
- name
- type
- msg
-
-
- {% for alert in alerts %}
-
-
- {{ alert.date }}
- {{ alert.time }}
-
-
- {{ alert.net }}/{{ alert.num }}
-
-
- {% if alert.type == 'conn' %}
-
-
-
- {% elif alert.type == 'highlight' %}
-
-
-
- {% elif alert.type == 'znc' %}
-
-
-
- {% elif alert.type == 'query' %}
-
-
-
- {% elif alert.type == 'self' %}
-
-
-
- {% else %}
- {{ alert.type }}
- {% endif %}
-
-
- {{ alert.msg }}
-
-
- {% endfor %}
-
-
-
-
- {% endif %}
-
\ No newline at end of file
diff --git a/core/templates/manage/threshold/irc/overview/overview.html b/core/templates/manage/threshold/irc/overview/overview.html
index 7f3110c..89c1abc 100644
--- a/core/templates/manage/threshold/irc/overview/overview.html
+++ b/core/templates/manage/threshold/irc/overview/overview.html
@@ -37,15 +37,6 @@
hx-swap="outerHTML">
-
-
-
@@ -71,6 +62,7 @@
diff --git a/core/templates/ui/drilldown/drilldown.html b/core/templates/ui/drilldown/drilldown.html
index 38bf0ee..507eef1 100644
--- a/core/templates/ui/drilldown/drilldown.html
+++ b/core/templates/ui/drilldown/drilldown.html
@@ -351,6 +351,44 @@
+
+
+
+
+
+ {% if params.index == 'main' %}
+ Main
+ {% elif params.index == None %}
+ Main
+ {% else %}
+ Main
+ {% endif %}
+
+ {% if params.index == 'int' %}
+ Internal
+ {% else %}
+ Internal
+ {% endif %}
+
+ {% if params.index == 'meta' %}
+ Meta
+ {% else %}
+ Meta
+ {% endif %}
+
+
+
+
+
+
+
+
+
+ index
+
+
+
+
diff --git a/core/templates/ui/drilldown/table_results_partial.html b/core/templates/ui/drilldown/table_results_partial.html
index 8718b53..3fac1de 100644
--- a/core/templates/ui/drilldown/table_results_partial.html
+++ b/core/templates/ui/drilldown/table_results_partial.html
@@ -109,7 +109,14 @@
{% for row in table.paginated_rows %}
{% block table.tbody.row %}
-
+
{% for column, cell in row.items %}
{% if column.name in show %}
{% block table.tbody.td %}
@@ -139,56 +146,73 @@
{{ row.cells.date }}
{{ row.cells.time }}
- {% elif column.name == 'type' %}
+ {% elif column.name == 'type' or column.name == 'mtype' %}
- {% if row.cells.type == 'msg' %}
+ onclick="populateSearch('{{ column.name }}', '{{ cell|escapejs }}')">
+ {% if cell == 'msg' %}
- {% elif row.cells.type == 'join' %}
+ {% elif cell == 'join' %}
- {% elif row.cells.type == 'part' %}
+ {% elif cell == 'part' %}
- {% elif row.cells.type == 'quit' %}
+ {% elif cell == 'quit' %}
- {% elif row.cells.type == 'kick' %}
+ {% elif cell == 'kick' %}
- {% elif row.cells.type == 'nick' %}
+ {% elif cell == 'nick' %}
- {% elif row.cells.type == 'mode' %}
+ {% elif cell == 'mode' %}
- {% elif row.cells.type == 'action' %}
+ {% elif cell == 'action' %}
+ {% elif cell == 'notice' %}
+
+
+
+ {% elif cell == 'conn' %}
+
+
+
+ {% elif cell == 'znc' %}
+
+
+
+ {% elif cell == 'query' %}
+
+
+
+ {% elif cell == 'highlight' %}
+
+
+
+ {% elif cell == 'who' %}
+
+
+
{% else %}
- {{ row.cells.type }}
+ {{ cell }}
{% endif %}
{% elif column.name == 'msg' %}
{{ row.cells.msg }}
- {% elif column.name == 'host' %}
-
-
- {{ cell }}
-
-
{% elif column.name == 'nick' %}
@@ -252,34 +276,6 @@
{{ cell }}
{% endif %}
- {% elif column.name == 'net' %}
-
-
- {{ cell }}
-
-
- {% elif column.name == 'nick_id' %}
-
-
- {{ cell }}
-
-
- {% elif column.name == 'user_id' %}
-
-
- {{ cell }}
-
-
- {% elif column.name == 'channel_id' %}
-
-
- {{ cell }}
-
-
{% elif cell is True or cell is False %}
{% if cell is True %}
@@ -294,7 +290,10 @@
{% else %}
- {{ cell }}
+
+ {{ cell }}
+
{% endif %}
{% endblock table.tbody.td %}
diff --git a/core/views/ui/drilldown.py b/core/views/ui/drilldown.py
index 8d4ea2b..fb7dcaa 100644
--- a/core/views/ui/drilldown.py
+++ b/core/views/ui/drilldown.py
@@ -95,6 +95,13 @@ def drilldown_search(request, return_context=False, template=None):
context = {"sizes": sizes}
return render(request, template_name, context)
+ if "index" in query_params:
+ if not request.user.is_superuser:
+ message = "You can't use the index parameter"
+ message_class = "danger"
+ context = {"message": message, "class": message_class}
+ return render(request, template_name, context)
+
# Parse the dates
if "dates" in query_params:
dates = parse_dates(query_params["dates"])
diff --git a/core/views/ui/tables.py b/core/views/ui/tables.py
index 78fa5f8..0c8092c 100644
--- a/core/views/ui/tables.py
+++ b/core/views/ui/tables.py
@@ -61,5 +61,8 @@ class DrilldownTable(Table):
num_chans = Column()
num_users = Column()
online = Column()
+ mtype = Column()
+ realname = Column()
+ server = Column()
template_name = "ui/drilldown/table_results.html"
paginate_by = settings.DRILLDOWN_RESULTS_PER_PAGE