Implement channel pane for insights
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user