Pipeline pages: pipeline and run templates

This commit is contained in:
claude committed 2026-10-11 22:35:35 +02:00
1 parent 752650fd31
commit 860bb6f0d2
2 files changed
+227

No files matched your search

+141
View File
@@ -0,0 +1,141 @@
{% extends "OpenBench/base.html" %}
{% block page_head %}
<div>
<a class="crumb" href="/pipelines/"><i class="fa-solid fa-chevron-left"></i> Pipelines</a>
<h1 class="page-title">{{ pipeline.name }}</h1>
<p class="page-sub">By {{ pipeline.author|capfirst }}</p>
</div>
<div class="page-actions">
{% if not pipeline.enabled %}<span class="badge badge-warn">Paused</span>{% endif %}
{% if can_manage %}
{% if running %}
<a class="anchorbutton btn-start" href="/pipelines/run/{{ running.id }}/">Open the running run</a>
{% elif pipeline.enabled and usable %}
<form method="post" action="/pipelines/{{ pipeline.id }}/start/">
{% csrf_token %}
<button class="anchorbutton btn-blue" type="submit">Start run</button>
</form>
{% else %}
<button class="anchorbutton btn-disabled" type="button" disabled
title="{% if usable %}Resume the pipeline to start it{% else %}Fix the pipeline settings first{% endif %}">Start run</button>
{% endif %}
<form method="post" action="/pipelines/{{ pipeline.id }}/toggle/">
{% csrf_token %}
<button class="anchorbutton btn-start" type="submit">{% if pipeline.enabled %}Pause{% else %}Resume{% endif %}</button>
</form>
<form method="post" action="/pipelines/{{ pipeline.id }}/delete/"
onsubmit="return confirm('Delete this pipeline? Runs that are going are cancelled. Tests that already started keep running.');">
{% csrf_token %}
<button class="anchorbutton btn-red" type="submit">Delete</button>
</form>
{% endif %}
</div>
{% endblock %}
{% block content %}
{% if usable %}
<div class="card">
<div class="card-head"><h2 class="card-title">Flow</h2></div>
<div class="pl-scroll">{{ svg|safe }}</div>
</div>
{% else %}
<div class="banner error-message" role="alert">
<i class="fa-solid fa-circle-exclamation banner-icon"></i>
<pre>This pipeline cannot run because its settings are damaged. An administrator can fix them on the admin site.</pre>
</div>
{% endif %}
{% if issues %}
<div class="card">
<div class="card-head">
<h2 class="card-title">Checks</h2>
<span class="count">{{ issues|length }}</span>
</div>
<ul class="pl-checks">
{% for issue in issues %}
<li class="pl-check pl-check-{{ issue.level }}">
<i class="fa-solid {% if issue.level == 'error' %}fa-circle-exclamation{% elif issue.level == 'warning' %}fa-triangle-exclamation{% else %}fa-circle-info{% endif %}"></i>
<span>{% if issue.name %}<strong>{{ issue.name }}</strong> {% endif %}{{ issue.message }}</span>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if steps %}
<div class="card">
<div class="card-head">
<h2 class="card-title">Steps</h2>
<span class="count">{{ steps|length }}</span>
</div>
<table class="stripes">
<tr class="table-header">
<th>Step</th>
<th>Kind</th>
<th>Runs</th>
<th>What happens next</th>
</tr>
{% for step in steps %}
<tr>
<td class="col-test">{{ step.name }}{% if step.start %} <span class="badge badge-info">Starts here</span>{% endif %}</td>
<td>{{ step.kind }}</td>
<td class="col-tc">{{ step.what }} {{ step.speed }}</td>
<td class="pl-leads">
{% for line in step.leads %}<div>{{ line }}</div>{% empty %}<span class="muted">The pipeline ends here</span>{% endfor %}
</td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
<div class="card">
<div class="card-head">
<h2 class="card-title">Runs</h2>
<span class="count">{{ runs|length }}</span>
</div>
{% if runs %}
<table class="hoverable">
<tr class="table-header">
<th>Run</th>
<th>Started</th>
<th>By</th>
<th>Status</th>
</tr>
{% for run in runs %}
<tr data-href="/pipelines/run/{{ run.id }}/">
<td class="col-test"><a href="/pipelines/run/{{ run.id }}/">Run {{ run.id }}</a></td>
<td class="col-date"><span class="timestamp">{{ run.started|date:"U" }}</span></td>
<td>{{ run.starter|capfirst }}</td>
<td><span class="badge {{ run.state.badge }}">{{ run.state.label }}</span></td>
</tr>
{% endfor %}
</table>
{% else %}
<div class="empty-state">
<i class="fa-solid fa-flag-checkered"></i>
<p>This pipeline has not run yet.</p>
{% if can_manage and pipeline.enabled and usable %}<p class="muted-small">Use Start run to begin with the first step.</p>{% endif %}
</div>
{% endif %}
</div>
{% endblock %}
+86
View File
@@ -0,0 +1,86 @@
{% extends "OpenBench/base.html" %}
{% load static %}
{% block scripts %}
<script src="{% static 'pipeline.js' %}?{{ static_version }}" defer></script>
{% endblock %}
{% block page_head %}
<div>
<a class="crumb" href="/pipelines/{{ pipeline.id }}/"><i class="fa-solid fa-chevron-left"></i> {{ pipeline.name }}</a>
<h1 class="page-title">Run {{ run.id }}</h1>
</div>
{% endblock %}
{% block content %}
<div id="pl-live" data-signature="{{ signature }}" data-running="{{ live|yesno:'true,false' }}">
<div class="pl-toolbar">
<span class="badge {{ state.badge }}">{{ state.label }}</span>
{% if can_manage and live %}
<form method="post" action="/pipelines/run/{{ run.id }}/cancel/"
onsubmit="return confirm('Cancel this run? Nothing more will start. Tests that already started keep running.');">
{% csrf_token %}
<button class="anchorbutton btn-red" type="submit">Cancel run</button>
</form>
{% endif %}
</div>
<dl class="ev-meta">
<div><dt>Started</dt><dd><span class="timestamp">{{ run.started|date:"U" }}</span></dd></div>
<div><dt>Started by</dt><dd>{{ run.starter|capfirst }}</dd></div>
<div><dt>Tests created</dt><dd>{{ rows|length }}</dd></div>
<div><dt>Pipeline</dt><dd><a href="/pipelines/{{ pipeline.id }}/">{{ pipeline.name }}</a></dd></div>
</dl>
<div class="card">
<div class="card-head"><h2 class="card-title">Path taken</h2></div>
<div class="pl-scroll">{{ svg|safe }}</div>
</div>
<div class="card">
<div class="card-head">
<h2 class="card-title">Tests</h2>
<span class="count">{{ rows|length }}</span>
</div>
<table class="stripes">
<tr class="table-header">
<th>Step</th>
<th>How it started</th>
<th>Status</th>
<th>Test</th>
</tr>
{% for row in rows %}
<tr>
<td class="col-test">{{ row.name }}</td>
<td>{{ row.after }}</td>
<td>
<span class="badge {{ row.state.badge }}">{{ row.state.label }}</span>
{% if row.waiting %}<div class="muted-small">Waiting for an approver to approve the test</div>{% endif %}
{% if row.step.message %}<div class="muted-small pl-message">{{ row.step.message }}</div>{% endif %}
</td>
<td>{% if row.url %}<a href="{{ row.url }}">Test {{ row.step.test_id }}</a>{% else %}<span class="muted">Not created</span>{% endif %}</td>
</tr>
{% endfor %}
</table>
</div>
{% if run.notes %}
<div class="card">
<div class="card-head"><h2 class="card-title">Why it went this way</h2></div>
<ul class="pl-checks">
{% for note in run.notes %}
<li class="pl-check pl-check-info"><i class="fa-solid fa-circle-info"></i><span>{{ note }}</span></li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
{% endblock %}