Drop the inline humanize_delta imports and string-precomputation; pass the raw datetime as latest_job_at / latest_build_at and let the template apply the timeago filter. One fewer code path computing relative-time strings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
36 lines
1.6 KiB
HTML
36 lines
1.6 KiB
HTML
<div id="server-actions"
|
|
{% if latest_job_is_running %}hx-get="/servers/{{ server.id }}/actions"
|
|
hx-trigger="every 2s" hx-swap="outerHTML"{% endif %}>
|
|
<div class="server-actions">
|
|
<span class="state-badge {{ state_class }}">{{ display_state }}</span>
|
|
{% if 'start' in visible_buttons %}
|
|
<form method="post" action="/servers/{{ server.id }}/start" class="inline-form">
|
|
<input type="hidden" name="csrf_token" value="{{ session.get('csrf_token', '') }}">
|
|
<button type="submit">start</button>
|
|
</form>
|
|
{% endif %}
|
|
{% if 'stop' in visible_buttons %}
|
|
<form method="post" action="/servers/{{ server.id }}/stop" class="inline-form">
|
|
<input type="hidden" name="csrf_token" value="{{ session.get('csrf_token', '') }}">
|
|
<button type="submit">stop</button>
|
|
</form>
|
|
{% endif %}
|
|
{% if 'reset' in visible_buttons %}
|
|
<button type="button" class="danger" data-modal-open="reset-server-modal">reset</button>
|
|
{% endif %}
|
|
</div>
|
|
{% if drift %}
|
|
<p class="state-drift"><strong>Warning:</strong> server is {{ server.actual_state }} but requested state is {{ server.desired_state }}.</p>
|
|
{% endif %}
|
|
{% if latest_job %}
|
|
<p class="last-job">
|
|
<a href="/jobs/{{ latest_job.id }}">{{ latest_job_phrase }}</a>
|
|
{% if latest_job_is_running %}since{% endif %}
|
|
{{ latest_job_at | timeago }}
|
|
(<a href="/servers/{{ server.id }}/jobs">show all</a>)
|
|
</p>
|
|
{% endif %}
|
|
{% if latest_job_is_running %}
|
|
<pre class="log-stream job-log" data-sse-url="/jobs/{{ latest_job.id }}/stream"></pre>
|
|
{% endif %}
|
|
</div>
|