From 1d2f37f588a374b7bc6940a808b3d5d9f3f3858a Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 3 Aug 2022 07:20:30 +0100 Subject: [PATCH] Pass through more variables to the context modal and alter int handling --- core/templates/modals/context_table.html | 4 +++- core/templates/ui/drilldown/table_results_partial.html | 4 +++- core/views/ui/drilldown.py | 10 +++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/core/templates/modals/context_table.html b/core/templates/modals/context_table.html index f193b27..21fd832 100644 --- a/core/templates/modals/context_table.html +++ b/core/templates/modals/context_table.html @@ -28,7 +28,9 @@ "channel": "{{ channel }}", "time": "{{ time }}", "date": "{{ date }}", - "index": "{{ index }}"}' + "index": "{{ index }}", + "type": "{{ type }}", + "mtype": "{{ mtype }}"}' hx-target="#modal-context-table" hx-trigger="every 5s"> diff --git a/core/templates/ui/drilldown/table_results_partial.html b/core/templates/ui/drilldown/table_results_partial.html index 20aaf2f..c0ced6f 100644 --- a/core/templates/ui/drilldown/table_results_partial.html +++ b/core/templates/ui/drilldown/table_results_partial.html @@ -223,7 +223,9 @@ "channel": "{{ row.cells.channel|escapejs }}", "time": "{{ row.cells.time|escapejs }}", "date": "{{ row.cells.date|escapejs }}", - "index": "{{ params.index }}"}' + "index": "{{ params.index }}", + "type": "{{ row.cells.type }}", + "mtype": "{{ row.cells.mtype }}"}' hx-target="#modals-here" hx-trigger="click"> {{ row.cells.msg }} diff --git a/core/views/ui/drilldown.py b/core/views/ui/drilldown.py index 22c33f7..bf639a6 100644 --- a/core/views/ui/drilldown.py +++ b/core/views/ui/drilldown.py @@ -241,7 +241,6 @@ class DrilldownContextModal(APIView): def post(self, request): if request.resolver_match.url_name == "modal_context_table": - print("POST CONTEXT TABLE") self.template_name = "modals/context_table.html" size = 20 @@ -255,8 +254,12 @@ class DrilldownContextModal(APIView): for key in mandatory: if key not in query_params: query_params[key] = None + if query_params["index"] == "int": + if "mtype" not in query_params: + query_params["mtype"] = None query_params["sorting"] = "desc" - + if query_params["index"] == "int" and query_params["mtype"] == "msg": + query_params["index"] = "main" # Create the query with the context helper search_query = construct_query( query_params["index"], @@ -287,8 +290,9 @@ class DrilldownContextModal(APIView): "date": query_params["date"], "index": query_params["index"], "num": query_params["num"], + "type": query_params["type"], + "mtype": query_params["mtype"], } - print("CONTEXT", context) return render(request, self.template_name, context)