{% extends "layout.html" %}
{% block title %}Deploys - MiniAPM{% endblock %}
{% block project_selector %}
{% if ctx.show_selector() %}
<form method="POST" action="/projects/switch" class="project-selector">
<select name="slug" onchange="this.form.submit()">
{% for project in ctx.projects %}
<option value="{{ project.slug }}" {% if ctx.is_current_project(project.id) %}selected{% endif %}>
{{ project.name }}
</option>
{% endfor %}
</select>
</form>
{% endif %}
{% endblock %}
{% block content %}
<h1>Deploys</h1>
<section class="card">
<h2>Deployment History</h2>
{% if deploys.is_empty() %}
<p class="empty">No deploys recorded yet</p>
<div class="help-text">
<p>Record deploys via the API:</p>
<pre><code>curl -X POST {{ base_url }}/ingest/deploys \
-H "Authorization: Bearer {{ api_key }}" \
-H "Content-Type: application/json" \
-d '{"git_sha": "abc123", "version": "v1.2.3"}'</code></pre>
</div>
{% else %}
<div class="table-wrapper">
<table>
<thead>
<tr>
<th>Version</th>
<th>Git SHA</th>
<th>Environment</th>
<th>Deployer</th>
<th>Deployed At</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{% for deploy in deploys %}
<tr>
<td>{{ deploy.version.as_deref().unwrap_or("-") }}</td>
<td><code>{{ deploy.short_sha() }}</code></td>
<td>{{ deploy.env.as_deref().unwrap_or("-") }}</td>
<td>{{ deploy.deployer.as_deref().unwrap_or("-") }}</td>
<td>{{ deploy.deployed_at }}</td>
<td>{{ deploy.description.as_deref().unwrap_or("-") }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</section>
{% endblock %}