- {% if item is not None %}
-
-
-
-
- src |
-
- {% if item|index:'src' == 'irc' %}
-
-
-
- IRC
- {% elif item|index:'src' == 'dis' %}
-
-
-
- Discord
- {% endif %}
- |
-
-
- nick |
-
- {% if item|index:'online' is True %}
-
-
-
- {{ item.nick }}
- {% elif item|index:'online' is False %}
-
-
-
- {{ item|index:'nick' }}
- {% else %}
-
-
-
- {{ item|index:'nick'}}
- {% endif %}
- {% if item|index:'num_chans' is not None %}
-
- {{ item|index:'num_chans' }}
-
- {% endif %}
- |
-
-
- host |
- {{ item.host }} |
-
-
- actions |
-
- {% if item.src == 'irc' %}
-
-
- {% endif %}
- |
-
-
- net |
- {{ item.net }} |
-
-
-
-
- {% endif %}
+
+
+ Information
+
+
+
+ {% if item is not None %}
+
+
+
+
+ src |
+
+ {% if item.src == 'irc' %}
+
+
+
+ IRC
+ {% elif item.src == 'dis' %}
+
+
+
+ Discord
+ {% endif %}
+ |
+
+
+ nick |
+
+ {% if item.online is True %}
+
+
+
+ {{ item.nick }}
+ {% elif item.online is False %}
+
+
+
+ {{ item.nick }}
+ {% else %}
+
+
+
+ {{ item.nick }}
+ {% endif %}
+ {% if item.num_chans is not None %}
+
+ {{ item.num_chans }}
+
+ {% endif %}
+ |
+
+
+ host |
+ {{ item.host }} |
+
+
+ actions |
+
+ {% if item.src == 'irc' %}
+
+ {% endif %}
+ |
+
+
+ net |
+ {{ item.net }} |
+
+
+
+
+ {% endif %}
+
+
+
\ No newline at end of file
diff --git a/core/views/dynamic/insights.py b/core/views/dynamic/insights.py
index 20cf62a..f50c0d9 100644
--- a/core/views/dynamic/insights.py
+++ b/core/views/dynamic/insights.py
@@ -22,7 +22,6 @@ class InsightsSearch(LoginRequiredMixin, View):
def post(self, request):
if not request.user.has_plan(self.plan_name):
return HttpResponseForbidden()
-
results, context = query_single_result(request)
if not context:
return HttpResponseForbidden()
@@ -32,10 +31,36 @@ class InsightsSearch(LoginRequiredMixin, View):
return HttpResponse("No results")
+class InsightsChannels(LoginRequiredMixin, APIView):
+ parser_classes = [FormParser]
+ template_name = "ui/insights/channels.html"
+ plan_name = "drilldown"
+
+ def post(self, request):
+ if not request.user.has_plan(self.plan_name):
+ return HttpResponseForbidden()
+ if "net" not in request.data:
+ return HttpResponse("No net")
+ if "nick" not in request.data:
+ return HttpResponse("No nick")
+ net = request.data["net"]
+ nick = request.data["nick"]
+ print("Insights channels item", nick)
+ chans = get_chans(net, [nick])
+ print("GET CHANS", chans)
+ if not chans:
+ return HttpResponseForbidden()
+ context = {"net": net, "nick": nick, "chans": chans}
+ if chans:
+ return render(request, self.template_name, context)
+ else:
+ return HttpResponse("No results")
+
+
class InsightsInfoModal(LoginRequiredMixin, APIView):
parser_classes = [FormParser]
plan_name = "drilldown"
- template_name = "modals/insights.html"
+ template_name = "modals/drilldown.html"
def post(self, request):
if not request.user.has_plan(self.plan_name):