1
0
Fork 0

Show if deployment succeeded

This commit is contained in:
lois Verheij 2025-03-27 16:59:29 +01:00
parent 59f2ef1171
commit 6866b7b2b3
2 changed files with 26 additions and 3 deletions
panel/src/panel

View file

@ -9,7 +9,8 @@
hx-trigger="click"
hx-indicator="#spinner-container"
hx-disabled-elt="this"
hx-swap="none"
hx-target="#deployment-result"
hx-swap="innerHTML"
name="deploy">
Deploy
</button>
@ -19,5 +20,21 @@
<div id="spinner-container" class="htmx-indicator">
<span class="loader"></span>
</div>
<p id="deployment-result">
{% if deployment_status %}
<ul>
<li>
<input type="checkbox" id="peertube"> Peertube
</li>
<li>
<input type="checkbox" id="mastodon"> Mastodon
</li>
<li>
<input type="checkbox" id="pixelfed"> Pixelfed
</li>
</ul>
{% endif %}
</p>
</form>
{% endblock %}

View file

@ -8,6 +8,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.views.generic import TemplateView, DetailView
from django.views.generic.edit import FormView
from django.http import HttpResponse
from panel import models, settings
from panel import models
@ -98,9 +99,13 @@ class DeploymentStatus(ConfigurationForm):
# Check for deploy button
if "deploy" in self.request.POST.keys():
self.deployment(obj)
deployment_result = self.deployment(obj)
if deployment_result.returncode == 0:
deployment_status = "Deployment Succeeded"
else:
deployment_status = "Deployment Failed"
return super().form_valid(form)
return HttpResponse(deployment_status)
def deployment(self, obj):
submission = obj.parsed_value.model_dump_json()
@ -135,4 +140,5 @@ class DeploymentStatus(ConfigurationForm):
cwd=settings.repo_dir,
env=env,
)
print(deployment_result.returncode)
return deployment_result