diff --git a/app/urls.py b/app/urls.py index a7e0e26..84d43ad 100644 --- a/app/urls.py +++ b/app/urls.py @@ -51,10 +51,9 @@ from core.views.manage.threshold.threshold import ( ) # Main tool pages -from core.views.ui.drilldown import ( +from core.views.ui.drilldown import ( # DrilldownTableView, Drilldown, DrilldownSearch, - DrilldownTableView, ThresholdInfoModal, ) from core.views.ui.insights import ( diff --git a/core/lib/opensearch.py b/core/lib/opensearch.py index c829701..926ebbe 100644 --- a/core/lib/opensearch.py +++ b/core/lib/opensearch.py @@ -136,7 +136,7 @@ def run_main_query(client, user, query, custom_query=False, index=None, size=Non response = client.search(body=search_query, index=index) except RequestError as err: print("OpenSearch error", err) - return False + return err filter_blacklisted(user, response) return response @@ -268,6 +268,15 @@ def query_results(request, size=None): ) if not results: return False + if isinstance(results, RequestError): + message = results.info["error"]["root_cause"][0]["reason"] + message_class = "danger" + return {"message": message, "class": message_class} + if len(results["hits"]["hits"]) == 0: + message = "No results." + message_class = "danger" + return {"message": message, "class": message_class} + results_parsed = [] if "hits" in results.keys(): if "hits" in results["hits"]: @@ -289,7 +298,6 @@ def query_results(request, size=None): element["date"] = date element["time"] = time results_parsed.append(element) - annotate_results(results_parsed) context = { diff --git a/core/templates/ui/drilldown/drilldown.html b/core/templates/ui/drilldown/drilldown.html index 81cb937..de3a889 100644 --- a/core/templates/ui/drilldown/drilldown.html +++ b/core/templates/ui/drilldown/drilldown.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% load static %} +{% load hy %} {% block content %}