Color types in Drilldown output

This commit is contained in:
Mark Veidemanis 2022-08-02 17:10:41 +01:00
parent e4651c4ce1
commit 1ed7f6a24c
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
6 changed files with 27 additions and 13 deletions

View File

@ -64,3 +64,4 @@ META_MAX_CHUNK_SIZE = 500
META_QUERY_SIZE = 10000 META_QUERY_SIZE = 10000
DEBUG = True DEBUG = True
PROFILER = True

View File

@ -135,12 +135,14 @@ REST_FRAMEWORK = {
} }
from app.local_settings import * # noqa from app.local_settings import * # noqa
if PROFILER:
if PROFILER: # noqa - trust me its there
import pyroscope import pyroscope
pyroscope.configure( pyroscope.configure(
application_name = "neptune", application_name="neptune",
server_address = "http://pyroscope:4040", server_address="http://pyroscope:4040",
auth_token = os.getenv("PYROSCOPE_AUTH_TOKEN", ""), auth_token=os.getenv("PYROSCOPE_AUTH_TOKEN", ""),
# tags = { # tags = {
# "region": f'{os.getenv("REGION")}', # "region": f'{os.getenv("REGION")}',
# } # }

View File

@ -21,7 +21,7 @@ from django.views.generic import TemplateView
# Threshold API stuff # Threshold API stuff
from core.api.views.threshold import ThresholdChans, ThresholdOnline, ThresholdUsers 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.callbacks import Callback
from core.views.manage.threshold.irc import ( from core.views.manage.threshold.irc import (
ThresholdIRCActions, ThresholdIRCActions,

View File

@ -1,7 +1,7 @@
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from opensearchpy import OpenSearch from opensearchpy import OpenSearch
from opensearchpy.exceptions import RequestError 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 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 user = None
results = run_main_query( results = run_main_query(
client, client,
user, user, # passed through run_main_query to filter_blacklisted
query, query,
size=size, size=size,
) )

View File

@ -28,7 +28,19 @@
</thead> </thead>
<tbody> <tbody>
{% for item in results %} {% for item in results %}
{% if item.type == 'join' %}
<tr class="has-background-success-light">
{% elif item.type == 'quit' %}
<tr class="has-background-danger-light">
{% elif item.type == 'kick' %}
<tr class="has-background-danger-light">
{% elif item.type == 'part' %}
<tr class="has-background-warning-light">
{% elif item.type == 'mode' %}
<tr class="has-background-info-light">
{% else %}
<tr> <tr>
{% endif %}
<td> <td>
{% if item.src == 'irc' %} {% if item.src == 'irc' %}
<span class="icon" data-tooltip="IRC"> <span class="icon" data-tooltip="IRC">

View File

@ -1,13 +1,12 @@
import json import json
from django.conf import settings 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.http import HttpResponse, HttpResponseForbidden, JsonResponse
from django.shortcuts import render from django.shortcuts import render
from django.views import View from django.views import View
from rest_framework.parsers import FormParser from rest_framework.parsers import FormParser
from rest_framework.views import APIView from rest_framework.views import APIView
from django.contrib.auth.models import AnonymousUser
from core.lib.opensearch import query_results from core.lib.opensearch import query_results
from core.lib.threshold import ( from core.lib.threshold import (
@ -23,7 +22,7 @@ class Drilldown(View):
plan_name = "drilldown" plan_name = "drilldown"
def get(self, request): 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") # return render(request, "denied.html")
is_anonymous = isinstance(request.user, AnonymousUser) is_anonymous = isinstance(request.user, AnonymousUser)
if is_anonymous: if is_anonymous:
@ -42,7 +41,7 @@ class DrilldownSearch(View):
plan_name = "drilldown" plan_name = "drilldown"
def post(self, request): def post(self, request):
#if not request.user.has_plan(self.plan_name): # if not request.user.has_plan(self.plan_name):
# return HttpResponseForbidden() # return HttpResponseForbidden()
context = query_results(request) context = query_results(request)
@ -71,7 +70,7 @@ class ThresholdInfoModal(APIView):
template_name = "modals/drilldown.html" template_name = "modals/drilldown.html"
def post(self, request): 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}) # return JsonResponse({"success": False})
if "net" not in request.data: if "net" not in request.data:
return JsonResponse({"success": False}) return JsonResponse({"success": False})