Properly fetch query data

This commit is contained in:
2022-08-03 07:20:30 +01:00
parent 6af8e94336
commit 60270d9636
3 changed files with 36 additions and 9 deletions

View File

@@ -19,7 +19,7 @@ from core.lib.threshold import (
get_users,
)
from core.views.ui.tables import DrilldownTable
from core.lib import threshold
def parse_dates(dates):
spl = dates.split(" - ")
@@ -244,6 +244,7 @@ class DrilldownContextModal(APIView):
self.template_name = "modals/context_table.html"
size = 20
nicks = None
# Create the query params from the POST arguments
mandatory = ["net", "channel", "num", "src", "index", "nick"]
invalid = [None, False, "", "None"]
@@ -257,6 +258,12 @@ class DrilldownContextModal(APIView):
if query_params["index"] == "int":
if "mtype" not in query_params:
query_params["mtype"] = None
if request.user.is_superuser:
if query_params["type"] == "query":
#bot_nick = threshold.irc_get_nick(query_params["net"], query_params["num"])
print("BOT NICK", query_params["channel"])
print("QUERY NICK", query_params["nick"])
nicks = [query_params["channel"], query_params["nick"]]
query_params["sorting"] = "desc"
if (
query_params["index"] == "int"
@@ -272,6 +279,7 @@ class DrilldownContextModal(APIView):
query_params["src"],
query_params["num"],
size,
nicks=nicks,
)
results = query_results(
request, query_params, annotate=True, custom_query=search_query