|
|
|
@ -133,6 +133,31 @@ class ThresholdIRCNetworkRelayDel(SuperUserRequiredMixin, APIView):
|
|
|
|
|
return render(request, self.template_name, context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ThresholdIRCNetworkRelayProvision(SuperUserRequiredMixin, APIView):
|
|
|
|
|
template_name = "manage/threshold/irc/network/relays.html"
|
|
|
|
|
|
|
|
|
|
def post(self, request, net, num):
|
|
|
|
|
"""
|
|
|
|
|
Provision a relay
|
|
|
|
|
"""
|
|
|
|
|
provisioned = threshold.irc_provision_relay(net, num)
|
|
|
|
|
if provisioned["success"]:
|
|
|
|
|
|
|
|
|
|
message = f"Provisioned relay {num}"
|
|
|
|
|
message_class = "success"
|
|
|
|
|
else:
|
|
|
|
|
message = provisioned["reason"]
|
|
|
|
|
message_class = "danger"
|
|
|
|
|
relays = threshold.get_irc_relays(net)
|
|
|
|
|
context = {
|
|
|
|
|
"net": net,
|
|
|
|
|
"message": message,
|
|
|
|
|
"class": message_class,
|
|
|
|
|
"relays": relays["relays"],
|
|
|
|
|
}
|
|
|
|
|
return render(request, self.template_name, context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ThresholdIRCNetworkRelayStatus(SuperUserRequiredMixin, APIView):
|
|
|
|
|
template_name = "manage/threshold/irc/network/relays.html"
|
|
|
|
|
|
|
|
|
|