refine create and details deployment ui

This commit is contained in:
rmanach
2023-09-21 11:51:57 +02:00
parent 53c54e9553
commit d1d87b4b97
10 changed files with 227 additions and 155 deletions
+52 -44
View File
@@ -15,54 +15,62 @@
{% endblock %}
{% block content %}
{% if user.is_authenticated %}
<table class="table table-striped table-hover">
<tr>
<th scope="col-3">Name</th>
<th scope="col-3">Type</th>
<th scope="col-3">Status</th>
<th class="col-1"></th>
<th class="col-2"></th>
</tr>
{% for deployment in page_obj %}
<tr id="{{ deployment.id }}">
<th name="name">{{ deployment.name }}</th>
<th name="type">{{ deployment.type }}</th>
<th name="status">{{ deployment.status }}</th>
<th>
<a href="{% url 'deployment-details' deployment.id %}">
<button class="btn btn-primary">Details</button>
</a>
</th>
{% if deployment.status == "FAILED" or deployment.status == "READY" %}
<th name="deploy">
<form action="{% url 'deployment-launch' deployment.id %}?page={{ page_obj.number }}" method="post">
{% csrf_token %}
<button class="btn btn-success" type="submit">Deploy</button>
</form>
</th>
{% elif deployment.status == "RUNNING" %}
<th name="deploy">
<button class="btn btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm" aria-hidden="true"></span>
<span role="status">Deploy</span>
</button>
</th>
{% else %}
<th></th>
{% endif %}
</tr>
{% endfor %}
</table>
{% include 'pagination.html' %}
<a class="btn btn-success" href="{% url 'deployment-create' %}" role="button">Create</a>
{% else %}
<div class="container-fluid">
<div class="row justify-content-md-center">
<div class="col-lg-8 col-md-8 col-sm-6">
<h4 style="text-align: center;">Please log in !</h4>
{% if user.is_authenticated %}
<table class="table table-striped table-hover">
<tr>
<th scope="col-3">Name</th>
<th scope="col-3">Type</th>
<th scope="col-3">Status</th>
<th class="col-2"></th>
<th class="col-2"></th>
</tr>
{% for deployment in page_obj %}
<tr id="{{ deployment.id }}">
<th name="name">{{ deployment.name }}</th>
<th name="type">{{ deployment.type }}</th>
<th name="status">{{ deployment.status }}</th>
<th>
<a href="{% url 'deployment-details' deployment.id %}">
<button class="btn btn-primary">Details</button>
</a>
</th>
{% if deployment.status == "FAILED" or deployment.status == "READY" %}
<th name="deploy">
<form action="{% url 'deployment-launch' deployment.id %}?page={{ page_obj.number }}" method="post">
{% csrf_token %}
<button class="btn btn-success" type="submit">Deploy</button>
</form>
</th>
{% elif deployment.status == "RUNNING" %}
<th name="deploy">
<button class="btn btn-primary" type="button" disabled>
<span class="spinner-border spinner-border-sm" aria-hidden="true"></span>
<span role="status">Deploy</span>
</button>
</th>
{% else %}
<th></th>
{% endif %}
</tr>
{% endfor %}
</table>
{% include 'pagination.html' %}
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#create-deployment-modal">
Create
</button>
{% else %}
<h4 style="text-align: center;">Please log in !</h4>
{% endif %}
</div>
</div>
{% endif %}
</div>
{% endblock %}
{% block modal %}
{% include 'deployment/create_modal.html' %}
{% endblock %}
{% block script %}