Pass through more variables to the context modal and alter int handling

This commit is contained in:
Mark Veidemanis 2022-08-03 07:20:30 +01:00
parent c9a17a6fa4
commit 1d2f37f588
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
3 changed files with 13 additions and 5 deletions

View File

@ -28,7 +28,9 @@
"channel": "{{ channel }}", "channel": "{{ channel }}",
"time": "{{ time }}", "time": "{{ time }}",
"date": "{{ date }}", "date": "{{ date }}",
"index": "{{ index }}"}' "index": "{{ index }}",
"type": "{{ type }}",
"mtype": "{{ mtype }}"}'
hx-target="#modal-context-table" hx-target="#modal-context-table"
hx-trigger="every 5s"> hx-trigger="every 5s">
</div> </div>

View File

@ -223,7 +223,9 @@
"channel": "{{ row.cells.channel|escapejs }}", "channel": "{{ row.cells.channel|escapejs }}",
"time": "{{ row.cells.time|escapejs }}", "time": "{{ row.cells.time|escapejs }}",
"date": "{{ row.cells.date|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-target="#modals-here"
hx-trigger="click"> hx-trigger="click">
{{ row.cells.msg }} {{ row.cells.msg }}

View File

@ -241,7 +241,6 @@ class DrilldownContextModal(APIView):
def post(self, request): def post(self, request):
if request.resolver_match.url_name == "modal_context_table": if request.resolver_match.url_name == "modal_context_table":
print("POST CONTEXT TABLE")
self.template_name = "modals/context_table.html" self.template_name = "modals/context_table.html"
size = 20 size = 20
@ -255,8 +254,12 @@ class DrilldownContextModal(APIView):
for key in mandatory: for key in mandatory:
if key not in query_params: if key not in query_params:
query_params[key] = None query_params[key] = None
if query_params["index"] == "int":
if "mtype" not in query_params:
query_params["mtype"] = None
query_params["sorting"] = "desc" 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 # Create the query with the context helper
search_query = construct_query( search_query = construct_query(
query_params["index"], query_params["index"],
@ -287,8 +290,9 @@ class DrilldownContextModal(APIView):
"date": query_params["date"], "date": query_params["date"],
"index": query_params["index"], "index": query_params["index"],
"num": query_params["num"], "num": query_params["num"],
"type": query_params["type"],
"mtype": query_params["mtype"],
} }
print("CONTEXT", context)
return render(request, self.template_name, context) return render(request, self.template_name, context)