Add sinst to contexts

This commit is contained in:
Mark Veidemanis 2022-08-16 23:05:27 +01:00
parent 85c6521b07
commit 3b176e0a4a
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 16 additions and 0 deletions

View File

@ -128,12 +128,16 @@ class ThresholdIRCNetworkRelayDel(SuperUserRequiredMixin, APIView):
message = deleted["reason"]
message_class = "danger"
relays = threshold.get_irc_relays(net)
sinst = threshold.get_irc_sinst(net)
context = {
"net": net,
"message": message,
"class": message_class,
"relays": relays["relays"],
}
if sinst:
if sinst["success"]:
context["sinst"] = sinst["sinst"]
return render(request, self.template_name, context)
@ -153,12 +157,16 @@ class ThresholdIRCNetworkRelayProvision(SuperUserRequiredMixin, APIView):
message = provisioned["reason"]
message_class = "danger"
relays = threshold.get_irc_relays(net)
sinst = threshold.get_irc_sinst(net)
context = {
"net": net,
"message": message,
"class": message_class,
"relays": relays["relays"],
}
if sinst:
if sinst["success"]:
context["sinst"] = sinst["sinst"]
return render(request, self.template_name, context)
@ -178,12 +186,16 @@ class ThresholdIRCNetworkRelayAuth(SuperUserRequiredMixin, APIView):
message = provisioned["reason"]
message_class = "danger"
relays = threshold.get_irc_relays(net)
sinst = threshold.get_irc_sinst(net)
context = {
"net": net,
"message": message,
"class": message_class,
"relays": relays["relays"],
}
if sinst:
if sinst["success"]:
context["sinst"] = sinst["sinst"]
return render(request, self.template_name, context)
@ -205,11 +217,15 @@ class ThresholdIRCNetworkRelayStatus(SuperUserRequiredMixin, APIView):
message = "Error updating status"
message_class = "danger"
relays = threshold.get_irc_relays(net)
sinst = threshold.get_irc_sinst(net)
context = {
"relays": relays["relays"],
"message": message,
"class": message_class,
}
if sinst:
if sinst["success"]:
context["sinst"] = sinst["sinst"]
return render(request, self.template_name, context)