From 1ed7f6a24c106ea4ce8fd3d885eca7c0ed07652b Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Tue, 2 Aug 2022 17:10:41 +0100 Subject: [PATCH] Color types in Drilldown output --- app/local_settings.example.py | 1 + app/settings.py | 12 +++++++----- app/urls.py | 2 +- core/lib/opensearch.py | 4 ++-- core/templates/ui/drilldown/results.html | 12 ++++++++++++ core/views/ui/drilldown.py | 9 ++++----- 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/app/local_settings.example.py b/app/local_settings.example.py index d36c7f8..2b33a93 100644 --- a/app/local_settings.example.py +++ b/app/local_settings.example.py @@ -64,3 +64,4 @@ META_MAX_CHUNK_SIZE = 500 META_QUERY_SIZE = 10000 DEBUG = True +PROFILER = True diff --git a/app/settings.py b/app/settings.py index b28bbb3..9e7eed4 100644 --- a/app/settings.py +++ b/app/settings.py @@ -135,13 +135,15 @@ REST_FRAMEWORK = { } from app.local_settings import * # noqa -if PROFILER: + +if PROFILER: # noqa - trust me its there import pyroscope + pyroscope.configure( - application_name = "neptune", - server_address = "http://pyroscope:4040", - auth_token = os.getenv("PYROSCOPE_AUTH_TOKEN", ""), + application_name="neptune", + server_address="http://pyroscope:4040", + auth_token=os.getenv("PYROSCOPE_AUTH_TOKEN", ""), # tags = { # "region": f'{os.getenv("REGION")}', # } - ) \ No newline at end of file + ) diff --git a/app/urls.py b/app/urls.py index db7abd8..3aec021 100644 --- a/app/urls.py +++ b/app/urls.py @@ -21,7 +21,7 @@ from django.views.generic import TemplateView # Threshold API stuff from core.api.views.threshold import ThresholdChans, ThresholdOnline, ThresholdUsers -from core.views import Billing, Cancel, About, Order, Portal, Signup +from core.views import About, Billing, Cancel, Order, Portal, Signup from core.views.callbacks import Callback from core.views.manage.threshold.irc import ( ThresholdIRCActions, diff --git a/core/lib/opensearch.py b/core/lib/opensearch.py index b832864..657fd7e 100644 --- a/core/lib/opensearch.py +++ b/core/lib/opensearch.py @@ -1,7 +1,7 @@ from django.conf import settings +from django.contrib.auth.models import AnonymousUser from opensearchpy import OpenSearch from opensearchpy.exceptions import RequestError -from django.contrib.auth.models import AnonymousUser from core.lib.threshold import annotate_num_chans, annotate_num_users, annotate_online @@ -154,7 +154,7 @@ def query_results(request, size=None): user = None results = run_main_query( client, - user, + user, # passed through run_main_query to filter_blacklisted query, size=size, ) diff --git a/core/templates/ui/drilldown/results.html b/core/templates/ui/drilldown/results.html index f3d981c..fe4258c 100644 --- a/core/templates/ui/drilldown/results.html +++ b/core/templates/ui/drilldown/results.html @@ -28,7 +28,19 @@ {% for item in results %} + {% if item.type == 'join' %} + + {% elif item.type == 'quit' %} + + {% elif item.type == 'kick' %} + + {% elif item.type == 'part' %} + + {% elif item.type == 'mode' %} + + {% else %} + {% endif %} {% if item.src == 'irc' %} diff --git a/core/views/ui/drilldown.py b/core/views/ui/drilldown.py index 4251a98..b41cc6e 100644 --- a/core/views/ui/drilldown.py +++ b/core/views/ui/drilldown.py @@ -1,13 +1,12 @@ import json from django.conf import settings -from django.contrib.auth.mixins import LoginRequiredMixin +from django.contrib.auth.models import AnonymousUser from django.http import HttpResponse, HttpResponseForbidden, JsonResponse from django.shortcuts import render from django.views import View from rest_framework.parsers import FormParser from rest_framework.views import APIView -from django.contrib.auth.models import AnonymousUser from core.lib.opensearch import query_results from core.lib.threshold import ( @@ -23,7 +22,7 @@ class Drilldown(View): plan_name = "drilldown" def get(self, request): - #if not request.user.has_plan(self.plan_name): + # if not request.user.has_plan(self.plan_name): # return render(request, "denied.html") is_anonymous = isinstance(request.user, AnonymousUser) if is_anonymous: @@ -42,7 +41,7 @@ class DrilldownSearch(View): plan_name = "drilldown" def post(self, request): - #if not request.user.has_plan(self.plan_name): + # if not request.user.has_plan(self.plan_name): # return HttpResponseForbidden() context = query_results(request) @@ -71,7 +70,7 @@ class ThresholdInfoModal(APIView): template_name = "modals/drilldown.html" def post(self, request): - #if not request.user.has_plan(self.plan_name): + # if not request.user.has_plan(self.plan_name): # return JsonResponse({"success": False}) if "net" not in request.data: return JsonResponse({"success": False})