Remove some debug statements
This commit is contained in:
parent
d36f397c6e
commit
aaca3a8469
|
@ -180,8 +180,6 @@ def query_results(request, query_params, size=None):
|
|||
):
|
||||
from_ts = f"{query_params['from_date']}T{query_params['from_time']}Z"
|
||||
to_ts = f"{query_params['to_date']}T{query_params['to_time']}Z"
|
||||
print("from ts", from_ts)
|
||||
print("to_ts", to_ts)
|
||||
range_query = {
|
||||
"range": {
|
||||
"ts": {
|
||||
|
|
|
@ -85,16 +85,12 @@ def drilldown_search(request, return_context=False, template=None):
|
|||
sizes = settings.OPENSEARCH_MAIN_SIZES
|
||||
|
||||
if request.GET:
|
||||
print("GET")
|
||||
if not request.htmx:
|
||||
print("NOT REQUEST HTMX")
|
||||
template_name = "ui/drilldown/drilldown.html"
|
||||
query_params = request.GET.dict()
|
||||
elif request.POST:
|
||||
print("POST")
|
||||
query_params = request.POST.dict()
|
||||
else:
|
||||
print("ELSE")
|
||||
template_name = "ui/drilldown/drilldown.html"
|
||||
context = {"sizes": sizes}
|
||||
return render(request, template_name, context)
|
||||
|
@ -115,7 +111,6 @@ def drilldown_search(request, return_context=False, template=None):
|
|||
context = query_results(request, query_params)
|
||||
elif request.POST:
|
||||
context = query_results(request, query_params)
|
||||
print("QUERY PARAMS", query_params)
|
||||
|
||||
# Turn the query into tags for populating the taglist
|
||||
if "query" in query_params:
|
||||
|
@ -124,13 +119,11 @@ def drilldown_search(request, return_context=False, template=None):
|
|||
|
||||
context["params"] = query_params
|
||||
if "message" in context:
|
||||
print("MESSAGE IN CONTEXT")
|
||||
return render(request, template_name, context)
|
||||
|
||||
# Create data for chart.js sentiment graph
|
||||
graph = make_graph(context["object_list"])
|
||||
context["data"] = graph
|
||||
print("MADE GRAPH")
|
||||
|
||||
if context:
|
||||
context["sizes"] = sizes
|
||||
|
@ -150,19 +143,14 @@ def drilldown_search(request, return_context=False, template=None):
|
|||
|
||||
response = render(request, template_name, context)
|
||||
if request.GET:
|
||||
print("IS GET")
|
||||
if request.htmx:
|
||||
print("IS HTMX PUSHING", url_params)
|
||||
response["HX-Push"] = reverse("home") + "?" + url_params
|
||||
elif request.POST:
|
||||
print("IS POST")
|
||||
print("TEMPLATE", template_name)
|
||||
response["HX-Push"] = reverse("home") + "?" + url_params
|
||||
if return_context:
|
||||
return context
|
||||
return response
|
||||
else:
|
||||
print("NO RESULTS", context)
|
||||
return HttpResponse("No results")
|
||||
|
||||
|
||||
|
@ -172,18 +160,13 @@ class DrilldownTableView(SingleTableView):
|
|||
paginate_by = 5
|
||||
|
||||
def get_queryset(self, request, **kwargs):
|
||||
print("QUERYSET KWARGS", kwargs)
|
||||
context = drilldown_search(request, return_context=True)
|
||||
# Save the context as we will need to merge other attributes later
|
||||
self.context = context
|
||||
print(
|
||||
"VIEW CONTEXT",
|
||||
{k: v for k, v in context.items() if k not in ["object_list", "data"]},
|
||||
)
|
||||
|
||||
if "object_list" in context:
|
||||
return context["object_list"]
|
||||
else:
|
||||
print("NO OBJ LIST IN CONTEXT", context)
|
||||
return []
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
@ -203,25 +186,17 @@ class DrilldownTableView(SingleTableView):
|
|||
context = self.get_context_data()
|
||||
if isinstance(self.context, HttpResponse):
|
||||
return self.context
|
||||
print(
|
||||
"TABLE CONTEXT",
|
||||
{k: v for k, v in context.items() if k not in ["object_list", "data"]},
|
||||
)
|
||||
|
||||
for k, v in self.context.items():
|
||||
if k not in context:
|
||||
context[k] = v
|
||||
print(
|
||||
"FINAL CONTEXT",
|
||||
{k: v for k, v in context.items() if k not in ["object_list", "data"]},
|
||||
)
|
||||
|
||||
if request.method == "GET":
|
||||
if not request.htmx:
|
||||
print("NOT REQUEST HTMX")
|
||||
self.template_name = "ui/drilldown/drilldown.html"
|
||||
response = self.render_to_response(context)
|
||||
# if not request.method == "GET":
|
||||
if "client_uri" in context:
|
||||
print("PUSHING CLIENT URI", context["client_uri"])
|
||||
response["HX-Push"] = reverse("home") + "?" + context["client_uri"]
|
||||
return response
|
||||
|
||||
|
|
Loading…
Reference in New Issue