feat: add task state status badge

This commit is contained in:
Matthieu Bessat 2024-07-28 12:08:54 +02:00
parent bdd50303ba
commit 71c2b9dc63
3 changed files with 27 additions and 3 deletions

View file

@ -12,3 +12,15 @@ table tbody tr td:first-child {
.logs-lines { .logs-lines {
white-space: nowrap; white-space: nowrap;
} }
.task-status_running {
background-color: blue;
}
.task-status_success {
background-color: green;
}
.task-status_failed {
background-color: red;
}

View file

@ -1,6 +1,11 @@
{% extends "layouts/base.html" %} {% extends "layouts/base.html" %}
{% block body %} {% block body %}
<h1>List of task runs for "{{ task.name }}"</h1> <h1>List of task runs for "{{ task.name }}"</h1>
{% if runs | length == 0 %}
<p class="notice">
No tasks runs to show
</p>
{% else %}
<table> <table>
<thead> <thead>
<tr> <tr>
@ -20,7 +25,9 @@
{{ task_run.started_at }} {{ task_run.started_at }}
</td> </td>
<td> <td>
{{ task_run.status }} <mark class="task-status_{{ task_run.status | lower }}">
{{ task_run.status }}
</mark>
</td> </td>
<td> <td>
<a href="/tasks/{{ task_id }}/runs/{{ task_run.id }}">Details</a> <a href="/tasks/{{ task_id }}/runs/{{ task_run.id }}">Details</a>
@ -29,4 +36,5 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% endif %}
{% endblock %} {% endblock %}

View file

@ -3,7 +3,11 @@
<h1>Task run details</h1> <h1>Task run details</h1>
<ul> <ul>
<li>Id: {{ run.id }}</li> <li>Id: {{ run.id }}</li>
<li>State: {{ run.status }}</li> <li>State:
<mark class="task-status_{{ run.status | lower }}">
{{ run.status }}
</mark>
</li>
<li>Submitted at: {{ run.submitted_at }}</li> <li>Submitted at: {{ run.submitted_at }}</li>
<li>Started at: {{ run.started_at }}</li> <li>Started at: {{ run.started_at }}</li>
<li>Ended at: {{ run.ended_at }}</li> <li>Ended at: {{ run.ended_at }}</li>
@ -14,7 +18,7 @@
<p>Exit code is {{ run.exit_code }}</p> <p>Exit code is {{ run.exit_code }}</p>
<pre class="logs-lines"> <pre class="logs-lines">
{% for line in logs_lines %} {% for line in logs_lines %}
<div class="line-{{ line.kind|lower }}">{{- line.content -}}</div> <div class="line-{{ line.kind|lower }}">{{- line.content -}}</div>
{% endfor %} {% endfor %}
</pre> </pre>
{% endblock %} {% endblock %}