neptune/core/views/dynamic/manage/threshold/irc.py

57 lines
1.8 KiB
Python
Raw Normal View History

from django.shortcuts import render
2022-07-25 18:08:28 +00:00
from django.views import View
2022-07-26 21:15:30 +00:00
from core.lib.manage.threshold import (
get_irc_channels,
get_irc_network,
get_irc_networks,
get_irc_relays,
get_irc_stats,
)
from core.views.manage.permissions import SuperUserRequiredMixin
2022-07-25 18:08:28 +00:00
class ThresholdIRCStats(SuperUserRequiredMixin, View):
2022-07-26 21:15:30 +00:00
stats_template = "dynamic/manage/threshold/irc/overview/stats.html"
def post(self, request):
stats = get_irc_stats()
context = {"stats": stats}
return render(request, self.stats_template, context)
class ThresholdIRCNetworks(SuperUserRequiredMixin, View):
2022-07-26 21:15:30 +00:00
template_name = "dynamic/manage/threshold/irc/overview/networks.html"
def post(self, request):
2022-07-26 21:15:30 +00:00
networks = get_irc_networks()
context = {"networks": networks}
return render(request, self.template_name, context)
class ThresholdIRCNetworkInfo(SuperUserRequiredMixin, View):
template_name = "dynamic/manage/threshold/irc/network/info.html"
def post(self, request, net):
network = get_irc_network(net)
context = {"network": network}
return render(request, self.template_name, context)
class ThresholdIRCNetworkRelays(SuperUserRequiredMixin, View):
template_name = "dynamic/manage/threshold/irc/network/relays.html"
def post(self, request, net):
relays = get_irc_relays(net)
context = {"relays": relays["relays"]}
return render(request, self.template_name, context)
class ThresholdIRCNetworkChannels(SuperUserRequiredMixin, View):
template_name = "dynamic/manage/threshold/irc/network/channels.html"
def post(self, request, net):
channels = get_irc_channels(net)
context = {"channels": channels["channels"]}
return render(request, self.template_name, context)