diff --git a/core/static/style.css b/core/static/style.css index a5c3708..e7c6bea 100644 --- a/core/static/style.css +++ b/core/static/style.css @@ -47,7 +47,6 @@ p { font-size: 14px; line-height: 20px; letter-spacing: -0.154px; - color: #242d60; height: 100%; width: 100%; padding: 0 20px; @@ -123,3 +122,11 @@ h5 { align-items: left; justify-content: left; } + +.subtitle { + color: #dddddd; +} + +.search-bar { + margin-bottom: 1rem; +} \ No newline at end of file diff --git a/core/templates/checkout.html b/core/templates/checkout.html index 1b79742..2ab5309 100644 --- a/core/templates/checkout.html +++ b/core/templates/checkout.html @@ -1,10 +1,12 @@ +{% load static %} +
- Data image + Data image

Drilldown

200.00
@@ -13,7 +15,7 @@
- Data image + Data image

Sentiment

45.00
diff --git a/core/templates/denied.html b/core/templates/denied.html index c508c12..971d96d 100644 --- a/core/templates/denied.html +++ b/core/templates/denied.html @@ -3,12 +3,5 @@ {% block content %}

Access denied

Sorry, you do not have the necessary permissions to view this page.

-
- {% if user.subscription_active %} - {% include 'checkout.html' %} - {% else %} -

Please setup a payment mandate in the profile page to view products

- {% endif %} -
{% endblock %} diff --git a/core/templates/ui/drilldown.html b/core/templates/ui/drilldown.html index 8eb1754..71ddff3 100644 --- a/core/templates/ui/drilldown.html +++ b/core/templates/ui/drilldown.html @@ -4,30 +4,56 @@

Welcome to search, {{ user.first_name }}!

-
-
-
-
- {% if query is not None %} -

Searching for {{ query }}

- {% else %} -

Search our database

- {% endif %} +
+
+
+ {% csrf_token %} + -
- {% if query is None %} - -
- {% csrf_token %} - - -
- - {% endif %} + +
+
+ {% if results is not None %} +
+
+
+
Results
+
+

Searching for {{ query }}

+
+ + + + + + + + + + + + {% for item in results %} + + + + + + + + + {% endfor %} +
TSmsghostnickchannelnet
{{ item.ts }}{{ item.msg }}{{ item.host }}{{ item.nick }}{{ item.channel }}{{ item.net }}
+
-
+ {% endif %}
{% endblock %} diff --git a/core/ui/views/drilldown.py b/core/ui/views/drilldown.py index db11a87..8a9f9a7 100644 --- a/core/ui/views/drilldown.py +++ b/core/ui/views/drilldown.py @@ -9,20 +9,29 @@ client = initialise_opensearch() class Drilldown(LoginRequiredMixin, View): template_name = "ui/drilldown.html" + plan_name = "drilldown" def get(self, request): - if not request.user.has_plan("drilldown"): + if not request.user.has_plan(self.plan_name): return render(request, "denied.html") return render(request, self.template_name) def post(self, request): - if not request.user.has_plan("drilldown"): + print("POST") + if not request.user.has_plan(self.plan_name): return render(request, "denied.html") if "query" in request.POST: query = request.POST["query"] results = run_main_query(client, query) - print("RESULTS", results) - context = {"query": query} + results_parsed = [] + if "hits" in results.keys(): + print("hits in results") + if "hits" in results["hits"]: + print("hits in hits") + for item in results["hits"]["hits"]: + print("ITER", item) + results_parsed.append(item["_source"]) + context = {"query": query, "results": results_parsed} print("CONTEXT", context) return render(request, self.template_name, context) return render(request, self.template_name)