diff --git a/core/lib/opensearch.py b/core/lib/opensearch.py index df610da..503a86c 100644 --- a/core/lib/opensearch.py +++ b/core/lib/opensearch.py @@ -548,8 +548,8 @@ def query_results( return context -def query_single_result(request): - context = query_results(request, request.POST.dict(), size=100) +def query_single_result(request, query_params): + context = query_results(request, query_params, size=100) if not context: return {"message": "Failed to run query", "message_class": "danger"} diff --git a/core/templates/base.html b/core/templates/base.html index cfdddc7..4c07344 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -156,12 +156,10 @@ {% endif %} - {% if user.is_authenticated %} - {% if user|has_plan:'drilldown' %} - - Insights - - {% endif %} + {% if perms.core.use_insights %} + + Insights + {% endif %} Install diff --git a/core/templates/ui/insights/insights.html b/core/templates/ui/insights/insights.html index 61452cc..dc3aa8d 100644 --- a/core/templates/ui/insights/insights.html +++ b/core/templates/ui/insights/insights.html @@ -47,7 +47,7 @@ {% csrf_token %} - + diff --git a/core/views/ui/insights.py b/core/views/ui/insights.py index c1a9cd9..42d373f 100644 --- a/core/views/ui/insights.py +++ b/core/views/ui/insights.py @@ -33,7 +33,10 @@ class InsightsSearch(LoginRequiredMixin, PermissionRequiredMixin, View): permission_required = "use_insights" def post(self, request): - context = query_single_result(request) + query_params = request.POST.dict() + if "query_full" in query_params: + query_params["query_full"] = "nick: " + query_params["query_full"] + context = query_single_result(request, query_params) if not context: return HttpResponseForbidden() return render(request, self.template_name, context)